def run(self, edit): project = ProjectManager.get_current_project() if project: settings = project.get_settings() json_string = json.dumps(settings, indent=4, sort_keys=True) new_file = sublime.active_window().new_file() new_file.insert(edit, 0, json_string) new_file.set_syntax_file("Packages/JavaScript/Json.tmLanguage")
def run(self, edit): current_directory = os.path.dirname(self.view.file_name()) context = Context.get_context(self.view) if context.get("valid") is False: return log(ID, "abort, no valid path given:", context.get("needle")) path = context.get("needle") project = ProjectManager.get_current_project() if not (path and project): return log(ID, "path or project invalid", path, project) is_relative = Path.is_relative(path) if is_relative: path = Path.get_absolute_path(current_directory, path) path = re.sub(project.get_directory(), "", path) path = re.sub("^[\\\\/\.]", "", path) files = project.find_file(path) if len(files) == 0: return log(ID, "failed finding file", path) if len(files) == 1: self.open_file(project.get_directory(), files[0]) else: # if javascript, search for index.js current_scope = self.view.scope_name(Selection.get_position(self.view)) if re.search("\.js ", current_scope): for file in files: if "index.js" in file: return self.open_file(project.get_directory(), file) self.files = files self.project_folder = project.get_directory() self.view.show_popup_menu(files, self.select_file)
def on_activated(self, view): # view has gained focus CurrentFile.evaluate_current(view, ProjectManager.get_current_project())
def run(self, edit): project = ProjectManager.get_current_project() if project: Validate.view(self.view, project.get_settings(), True)
def changeDirectoryDone(text): project = ProjectManager.get_current_project() if project: project.set_setting("project_directory", text) else: print("abort. current project was not found")
def on_activated(self, view): # view has gained focus CurrentFile.evaluate_current(view, ProjectManager.get_current_project())
def changeDirectoryDone(text): project = ProjectManager.get_current_project() if project: project.set_setting("project_directory", text) else: print("abort. current project was not found")