def do_run(self, cmd, working_dir, **kwargs): project = ElmProject(cmd[1]) log_string('project.logging.settings', repr(project)) cmd[1] = fs.expanduser(project.main_path) cmd[2] = cmd[2].format(fs.expanduser(project.output_path)) project_dir = project.working_dir or working_dir # ST2: TypeError: __init__() got an unexpected keyword argument 'syntax' super(ElmMakeCommand, self).run(cmd, working_dir=project_dir, **kwargs)
def run_with_project(self, cmd, working_dir, null_device, **kwargs): file_arg, output_arg = cmd[1:3] project = ElmProject(file_arg) log_string('project.logging.settings', repr(project)) if '{output}' in output_arg: cmd[1] = fs.expanduser(project.main_path) output_path = fs.expanduser(project.output_path) cmd[2] = output_arg.format(output=output_path) else: # cmd[1] builds active file rather than project main cmd[2] = output_arg.format(null=null_device) project_dir = project.working_dir or working_dir # ST2: TypeError: __init__() got an unexpected keyword argument 'syntax' super(ElmMakeCommand, self).run(cmd, working_dir=project_dir, **kwargs)
def load_from_oracle(filename): """ Loads all data about the current file from elm oracle and adds it to the LOOKUPS global dictionary. """ global LOOKUPS project = ElmProject(filename) if project.working_dir is None: return os.chdir(project.working_dir) # Hide the console window on Windows shell = False path_separator = ':' if os.name == "nt": shell = True path_separator = ';' settings = sublime.load_settings('Elm Language Support.sublime-settings') path = settings.get('elm_paths', '') if path: old_path = os.environ['PATH'] os.environ["PATH"] = os.path.expandvars(path + path_separator + '$PATH') p = subprocess.Popen(['elm-oracle', filename, ''], stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=shell) if path: os.environ['PATH'] = old_path output, errors = p.communicate() output = output.strip() if settings.get('debug', False): string_settings = sublime.load_settings( 'Elm User Strings.sublime-settings') print( string_settings.get('logging.prefix', '') + '(elm-oracle) ' + str(output), '\nerrors: ' + str(errors.strip())) if str(errors.strip()): print('Your PATH is: ', os.environ['PATH']) try: data = json.loads(output.decode('utf-8')) except ValueError: return None LOOKUPS[filename] = data
def is_enabled(self): self.project = ElmProject(self.view.file_name()) return self.project.exists