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


Python View.substr方法代码示例

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


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

示例1: on_modified

# 需要导入模块: from sublime import View [as 别名]
# 或者: from sublime.View import substr [as 别名]
    def on_modified(self, view: sublime.View) -> None:
        """Called after changes has been made to a view
        """

        if view.command_history(0)[0] in ("expand_tabs", "unexpand_tabs"):
            return

        if not is_python(view) or not get_settings(view, 'display_signatures'):
            return

        try:
            location = view.rowcol(view.sel()[0].begin())
            if view.substr(view.sel()[0].begin()) in ['(', ')']:
                location = (location[0], location[1] - 1)

            data = prepare_send_data(location, 'doc', 'jedi')
            use_tooltips = get_settings(
                view, 'enable_signatures_tooltip', True
            )
            st_version = int(sublime.version())
            if st_version >= 3070:
                data['html'] = use_tooltips

            currying = partial(self.prepare_data_status, view)
            if use_tooltips and st_version >= 3070:
                currying = partial(self.prepare_data_tooltip, view)
            Worker().execute(currying, **data)
        except Exception as error:
            logging.error(error)
开发者ID:Cesar456,项目名称:Sublime_Text3_Properties-Pacage,代码行数:31,代码来源:signatures.py

示例2: modified_buffer

# 需要导入模块: from sublime import View [as 别名]
# 或者: from sublime.View import substr [as 别名]
    def modified_buffer(self, view: sublime.View) -> str:
        """Guru needs this to use unsaved buffers instead of files
        """

        code = view.substr(sublime.Region(0, view.size()))
        return '\n'.join([
            view.file_name(), str(len(code.encode('utf8'))), code
        ])
开发者ID:DamnWidget,项目名称:anaconda_go,代码行数:10,代码来源:doc.py

示例3: on_modified

# 需要导入模块: from sublime import View [as 别名]
# 或者: from sublime.View import substr [as 别名]
    def on_modified(self, view: sublime.View) -> None:
        """Called after changes has been made to a view.
        """

        if not is_python(view, autocomplete_ignore_repl=True):
            return

        global JUST_COMPLETED

        if (view.substr(view.sel()[0].begin() - 1) == '('
                and view.substr(view.sel()[0].begin()) == ')'):
            if JUST_COMPLETED:
                view.run_command('anaconda_complete_funcargs')

            JUST_COMPLETED = False
        elif view.substr(sublime.Region(
                view.sel()[0].begin() - 7, view.sel()[0].end())) == 'import ':
            self._run_auto_complete()
开发者ID:lpig,项目名称:sublime-backup,代码行数:20,代码来源:completion.py

示例4: notify_did_change

# 需要导入模块: from sublime import View [as 别名]
# 或者: from sublime.View import substr [as 别名]
def notify_did_change(view: sublime.View):
    file_name = view.file_name()
    window = view.window()
    if window and file_name:
        if view.buffer_id() in pending_buffer_changes:
            del pending_buffer_changes[view.buffer_id()]
        config = config_for_scope(view)
        client = client_for_view(view)
        if client and config:
            uri = filename_to_uri(file_name)
            languageId = config.get_language_id(view)
            ds = get_document_state(window, file_name)
            if ds.languageId == languageId:
                params = {
                    "textDocument": {
                        "uri": uri,
                        "version": ds.inc_version(),
                    },
                    "contentChanges": [{
                        "text": view.substr(sublime.Region(0, view.size()))
                    }]
                }
                client.send_notification(Notification.didChange(params))
            else:
                # The languageId has changed, reopen file
                ds.languageId = languageId
                params = {"textDocument": {"uri": uri}}
                client.send_notification(Notification.didClose(params))
                params = {
                    "textDocument": {
                        "uri": uri,
                        "languageId": ds.languageId,
                        "text": view.substr(sublime.Region(0, view.size())),
                        "version": ds.inc_version(),
                    }
                }
                client.send_notification(Notification.didOpen(params))
开发者ID:Kronuz,项目名称:SublimeCodeIntel,代码行数:39,代码来源:documents.py

示例5: notify_did_open

# 需要导入模块: from sublime import View [as 别名]
# 或者: from sublime.View import substr [as 别名]
def notify_did_open(view: sublime.View):
    config = config_for_scope(view)
    client = client_for_view(view)
    if client and config:
        view.settings().set("show_definitions", False)
        window = view.window()
        view_file = view.file_name()
        if window and view_file:
            if not has_document_state(window, view_file):
                ds = get_document_state(window, view_file)
                ds.languageId = config.get_language_id(view)
                if settings.show_view_status:
                    view.set_status("code_intel_clients", config.name)
                params = {
                    "textDocument": {
                        "uri": filename_to_uri(view_file),
                        "languageId": ds.languageId,
                        "text": view.substr(sublime.Region(0, view.size())),
                        "version": ds.version
                    }
                }
                client.send_notification(Notification.didOpen(params))
开发者ID:Kronuz,项目名称:SublimeCodeIntel,代码行数:24,代码来源:documents.py

示例6: do_skip_args_and_spaces

# 需要导入模块: from sublime import View [as 别名]
# 或者: from sublime.View import substr [as 别名]
def do_skip_args_and_spaces(view: sublime.View, point: int) -> bool:
    if view.substr(point).isspace() or view.match_selector(point, ARGUMENT):
        return True
    return False
开发者ID:equiva1ence,项目名称:ConTeXtTools,代码行数:6,代码来源:scopes.py


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