当前位置: 首页>>代码示例>>Python>>正文


Python sublime.TRANSIENT属性代码示例

本文整理汇总了Python中sublime.TRANSIENT属性的典型用法代码示例。如果您正苦于以下问题:Python sublime.TRANSIENT属性的具体用法?Python sublime.TRANSIENT怎么用?Python sublime.TRANSIENT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在sublime的用法示例。


在下文中一共展示了sublime.TRANSIENT属性的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: run

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import TRANSIENT [as 别名]
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)) 
开发者ID:aziz,项目名称:SublimeFileBrowser,代码行数:27,代码来源:dired.py

示例2: set_diagnostic

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import TRANSIENT [as 别名]
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) 
开发者ID:sublimelsp,项目名称:LSP,代码行数:18,代码来源:diagnostics.py

示例3: on_hover_navigate

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import TRANSIENT [as 别名]
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) 
开发者ID:sublimelsp,项目名称:LSP,代码行数:27,代码来源:hover.py

示例4: run_async

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import TRANSIENT [as 别名]
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
        ) 
开发者ID:tptee,项目名称:FlowIDE,代码行数:24,代码来源:go_to_definition.py

示例5: _show_usages

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import TRANSIENT [as 别名]
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) 
开发者ID:OmniSharp,项目名称:omnisharp-sublime,代码行数:19,代码来源:find_usages.py

示例6: run

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import TRANSIENT [as 别名]
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]) 
开发者ID:kublaios,项目名称:dired,代码行数:32,代码来源:dired.py

示例7: gotoDefinition

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import TRANSIENT [as 别名]
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) 
开发者ID:fuse-open,项目名称:Fuse.SublimePlugin,代码行数:12,代码来源:go_to_definition.py

示例8: open_in_transient

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import TRANSIENT [as 别名]
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,
        ) 
开发者ID:math2001,项目名称:FileManager,代码行数:13,代码来源:input_for_path.py

示例9: highlight_entry

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import TRANSIENT [as 别名]
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) 
开发者ID:sublimelsp,项目名称:LSP,代码行数:6,代码来源:goto.py

示例10: open_ref_index

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import TRANSIENT [as 别名]
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) 
开发者ID:sublimelsp,项目名称:LSP,代码行数:8,代码来源:references.py

示例11: navigate

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import TRANSIENT [as 别名]
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) 
开发者ID:sublimelsp,项目名称:LSP,代码行数:13,代码来源:diagnostics.py

示例12: _jump

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import TRANSIENT [as 别名]
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) 
开发者ID:DamnWidget,项目名称:anaconda_go,代码行数:14,代码来源:panels.py


注:本文中的sublime.TRANSIENT属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。