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


Python sublime_plugin.TextCommand方法代码示例

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


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

示例1: __init__

# 需要导入模块: import sublime_plugin [as 别名]
# 或者: from sublime_plugin import TextCommand [as 别名]
def __init__(self, *args, **kwargs):
        self.settings = sublime.load_settings('Glue.sublime-settings')
        self.stdout = ""
        self.stderr = ""
        self.exitcode = 1
        self.userpath = self.settings.get('glue_userpath')
        self.shellpath = self.settings.get('glue_shellpath')
        self.original_env_path = os.environ['PATH']
        self.ps1 = self.settings.get('glue_ps1')
        self.start_dirpath = ""
        self.current_dirpath = self.settings.get('glue_working_directory')
        self.current_filepath = ""
        self.attr_lock = threading.Lock() # thread lock for attribute reads/writes
        sublime_plugin.TextCommand.__init__(self, *args, **kwargs)

    #------------------------------------------------------------------------------
    # [ run method ] - plugin start method
    #------------------------------------------------------------------------------ 
开发者ID:chrissimpkins,项目名称:glue,代码行数:20,代码来源:Glue.py

示例2: run

# 需要导入模块: import sublime_plugin [as 别名]
# 或者: from sublime_plugin import TextCommand [as 别名]
def run(self, edit):
        """Sublime Text executes this when you trigger the TextCommand."""
        with Yapf(self.view) as yapf:
            # no selection?
            no_selection = all(s.empty() for s in self.view.sel())
            if no_selection:
                if not yapf.get_setting("use_entire_file_if_no_selection"):
                    sublime.error_message('A selection is required')
                    return

                # format entire document
                with PreserveSelectionAndView(self.view):
                    yapf.format(edit)
                return

            # otherwise format all (non-empty) ones
            with PreserveSelectionAndView(self.view) as pv:
                pv.sel = []
                for s in self.view.sel():
                    if not s.empty():
                        new_s = yapf.format(edit, s)
                        pv.sel.append(new_s if new_s else s) 
开发者ID:jason-kane,项目名称:PyYapf,代码行数:24,代码来源:PyYapf.py

示例3: __init__

# 需要导入模块: import sublime_plugin [as 别名]
# 或者: from sublime_plugin import TextCommand [as 别名]
def __init__(self, param):
        # no super() call! this would get the references confused
        if isinstance(param, sublime.Window):
            self.window = param
            self._window_command = True  # probably called from build system
            self.typ = WindowCommand
        elif isinstance(param, sublime.View):
            self.view   = param
            self._window_command = False
            self.typ = TextCommand
        else:
            raise TypeError("Something really bad happened and you are responsible")

        self._update_members() 
开发者ID:typeintandem,项目名称:tandem,代码行数:16,代码来源:__init__.py

示例4: __init__

# 需要导入模块: import sublime_plugin [as 别名]
# 或者: from sublime_plugin import TextCommand [as 别名]
def __init__(self, view):
        sublime_plugin.TextCommand.__init__(self, view)
        self.settings = load_settings() 
开发者ID:adael,项目名称:SublimePhpCsFixer,代码行数:5,代码来源:SublimePhpCsFixer.py


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