Python sublime.TRANSIENT Examples
The following are 12
code examples of sublime.TRANSIENT().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
sublime
, or try the search function
.
Example #1
Source File: dired.py From SublimeFileBrowser with MIT License | 6 votes |
def run(self, edit): self.index = self.get_all() filenames = self.get_selected(full=True) if not filenames: return sublime.status_message(u'Nothing to preview') fqn = filenames[0] if isdir(fqn) or fqn == PARENT_SYM: if not ST3: return sublime.status_message(u'No preview for directories') self.view.run_command('dired_preview_directory', {'fqn': fqn}) return if exists(fqn): if ST3: self.view.run_command('dired_file_properties', {'fqn': fqn}) window = self.view.window() dired_view = self.view self.focus_other_group(window) window.open_file(fqn, sublime.TRANSIENT) window.focus_view(dired_view) else: sublime.status_message(u'File does not exist (%s)' % (basename(fqn.rstrip(os.sep)) or fqn))
Example #2
Source File: diagnostics.py From LSP with MIT License | 6 votes |
def set_diagnostic(self, file_diagnostic: Optional[Tuple[str, Diagnostic]]) -> None: self.clear() if file_diagnostic: file_path, diagnostic = file_diagnostic view = self._window.open_file(file_path, sublime.TRANSIENT) if view.is_loading(): sublime.set_timeout(lambda: self.apply_phantom(view, diagnostic), 500) else: self.apply_phantom(view, diagnostic) else: if self._last_phantom_set: view = self._last_phantom_set.view has_phantom = view.settings().get('lsp_diagnostic_phantom') if not has_phantom: view.settings().set('lsp_diagnostic_phantom', False)
Example #3
Source File: hover.py From LSP with MIT License | 6 votes |
def on_hover_navigate(self, href: str, point: int) -> None: for goto_kind in goto_kinds: if href == goto_kind.lsp_name: self.run_command_from_point(point, "lsp_symbol_" + goto_kind.subl_cmd_name) return if href == 'references': self.run_command_from_point(point, "lsp_symbol_references") elif href == 'rename': self.run_command_from_point(point, "lsp_symbol_rename") elif href.startswith('code-actions'): _, config_name = href.split(":") titles = [command["title"] for command in self._actions_by_config[config_name]] sel = self.view.sel() sel.clear() sel.add(sublime.Region(point, point)) self.view.show_popup_menu(titles, lambda i: self.handle_code_action_select(config_name, i)) elif href.startswith('location'): _, file_path, location = href.split(":", 2) file_path = os.path.join(self._base_dir, file_path) if self._base_dir else file_path window = self.view.window() if window: window.open_file(file_path + ":" + location, sublime.ENCODED_POSITION | sublime.TRANSIENT) else: webbrowser.open_new_tab(href)
Example #4
Source File: go_to_definition.py From FlowIDE with MIT License | 6 votes |
def run_async(self): result = None try: result = CLI(self.view).get_def() except InvalidContext: print('Invalid context') pass except Exception as e: display_unknown_error(self.view, e) return print(result) if not result or not result.get('path'): return sublime.active_window().open_file( result['path'] + ':' + str(result['line']) + ':' + str(result['start']), sublime.ENCODED_POSITION | sublime.TRANSIENT )
Example #5
Source File: find_usages.py From omnisharp-sublime with MIT License | 6 votes |
def _show_usages(self, data): if data is None or data['QuickFixes'] is None: return usages = data["QuickFixes"] items = [[u["Text"].strip(), u["FileName"] + " Line : " + str(u["Line"])] for u in usages] window = sublime.active_window() def on_done(i): if i is not -1: window.open_file('{}:{}:{}'.format(usages[i]["FileName"], usages[i]["Line"] or 0, usages[i]["Column"] or 0), sublime.ENCODED_POSITION) def on_highlight(i): if i is not -1: window.open_file('{}:{}:{}'.format(usages[i]["FileName"], usages[i]["Line"] or 0, usages[i]["Column"] or 0), sublime.ENCODED_POSITION | sublime.TRANSIENT) window.show_quick_panel(items, on_done, on_highlight=on_highlight)
Example #6
Source File: dired.py From dired with MIT License | 5 votes |
def run(self, view, path): window = self.view.window() groups = groups_on_preview(window) window.focus_group(groups[1]) # Get directory preview view. preview_id = self.view.settings().get('preview_id') preview_view = first(window.views(), lambda v: v.id() == preview_id) if os.path.isfile(path): if preview_view : window.focus_view(preview_view) window.run_command('close_file') window.open_file(path, sublime.TRANSIENT) try : window.active_view().set_read_only(True) window.active_view().set_scratch(True) except : pass elif os.path.isdir(path): if not preview_view : show(window, path) else : show(window, path, view_id=preview_id) window.active_view().set_name("Preview: " + window.active_view().name()) self.view.settings().set('preview_id' , window.active_view().id()) window.focus_group(groups[0])
Example #7
Source File: go_to_definition.py From Fuse.SublimePlugin with MIT License | 5 votes |
def gotoDefinition(data): window = sublime.active_window() path = data["Path"] caretPos = data["CaretPosition"] line = int(caretPos["Line"]) column = int(caretPos["Character"]) openCommand = data["Path"] + ":" + str(line) + ":" + str(column) view = window.open_file(openCommand, sublime.ENCODED_POSITION | sublime.TRANSIENT)
Example #8
Source File: input_for_path.py From FileManager with MIT License | 5 votes |
def open_in_transient(self, index): if self.no_browser_action is False and index < 2: return if not os.path.isfile( os.path.join(self.browser.path, self.browser.items[index]) ): return self.window.open_file( os.path.join(self.browser.path, self.browser.items[index]), sublime.TRANSIENT, )
Example #9
Source File: goto.py From LSP with MIT License | 5 votes |
def highlight_entry(window: Optional[sublime.Window], locations: List[str], idx: int) -> None: if not window: return window.open_file(locations[idx], group=window.active_group(), flags=sublime.TRANSIENT | sublime.ENCODED_POSITION)
Example #10
Source File: references.py From LSP with MIT License | 5 votes |
def open_ref_index(self, index: int, transient: bool = False) -> None: if index != -1: flags = sublime.ENCODED_POSITION | sublime.TRANSIENT if transient else sublime.ENCODED_POSITION window = self.view.window() if window: window.open_file(self.get_selected_file_path(index), flags)
Example #11
Source File: diagnostics.py From LSP with MIT License | 5 votes |
def navigate(self, href: str) -> None: if href == "hide": self.clear() elif href == "next": self._window.run_command("lsp_next_diagnostic") elif href == "previous": self._window.run_command("lsp_previous_diagnostic") elif href.startswith("location"): # todo: share with hover? _, file_path, location = href.split(":", 2) self._window.open_file(file_path + ":" + location, sublime.ENCODED_POSITION | sublime.TRANSIENT)
Example #12
Source File: panels.py From anaconda_go with GNU General Public License v3.0 | 5 votes |
def _jump(self, filename: str, line: int =None, col: int =None, transient: bool =False) -> None: """Jump to the given destination """ flags = sublime.ENCODED_POSITION if transient: flags |= sublime.TRANSIENT sublime.active_window().open_file( '{}:{}:{}'.format(filename, line or 0, col or 0), flags) self._toggle_indicator(line, col)