• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python sublime.View类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: prepare_data_tooltip

    def prepare_data_tooltip(
            self, view: sublime.View, data: Dict[str, Any]) -> Any:
        """Prepare the returned data for tooltips
        """

        merge_doc = get_settings(view, 'merge_signatures_and_doc')
        if (data['success'] and 'No docstring' not
                in data['doc'] and data['doc'] != 'list\n'):
            try:
                i = data['doc'].split('<br>').index("")
            except ValueError:
                self.signature = data['doc']
                self.doc = ''
                if self._signature_excluded(self.signature):
                    return
                return self._show_popup(view)

            if merge_doc:
                self.doc = '<br>'.join(data['doc'].split('<br>')[i:]).replace(
                    "  ", "&nbsp;&nbsp;")

            self.signature = '<br>&nbsp;&nbsp;&nbsp;&nbsp;'.join(
                data['doc'].split('<br>')[0:i])
            if self.signature is not None and self.signature != "":
                if not self._signature_excluded(self.signature):
                    return self._show_popup(view)

        if view.is_popup_visible():
                view.hide_popup()
        view.erase_status('anaconda_doc')
开发者ID:Cesar456,项目名称:Sublime_Text3_Properties-Pacage,代码行数:30,代码来源:signatures.py


示例2: on_modified

    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,代码行数:29,代码来源:signatures.py


示例3: _show_status

    def _show_status(self, view: sublime.View) -> None:
        """Show message in the view status bar
        """

        view.set_status(
            'anaconda_doc', 'Anaconda: {}'.format(self.signature)
        )
开发者ID:Cesar456,项目名称:Sublime_Text3_Properties-Pacage,代码行数:7,代码来源:signatures.py


示例4: is_scope

def is_scope(view: sublime.View, scope: str) -> bool:
    sel = view.sel()
    try:
        return view.match_selector(sel[0].begin(), scope)
    except IndexError:
        # If in doubt, let's return `False`.
        return False
开发者ID:equiva1ence,项目名称:ConTeXtTools,代码行数:7,代码来源:scopes.py


示例5: last_block_in_region

def last_block_in_region(
    view: sublime.View,
    begin: int,
    scope: str,
    end: Optional[int] = None,
    skip: int = SKIP_ANYTHING,
) -> Optional[Tuple[int, int]]:
    skipper = SKIPPERS.get(skip, do_skip_anything)
    stop = view.size() if end is None else end
    empty = True

    while (
        stop > begin and
        not view.match_selector(stop, scope) and
        skipper(view, stop)
    ):
        stop -= 1

    start = stop
    while start > begin and view.match_selector(start, scope):
        start -= 1
        empty = False

    if empty:
        return None
    return start + 1, stop + 1
开发者ID:equiva1ence,项目名称:ConTeXtTools,代码行数:26,代码来源:scopes.py


示例6: _session_for_view_and_window

def _session_for_view_and_window(view: sublime.View, window: 'Optional[sublime.Window]') -> 'Optional[Session]':
    if not window:
        debug("no window for view", view.file_name())
        return None

    if view.size() > 1000000:
        printf("file is too big, ignoring!")
        return False

    config = config_for_scope(view)
    if not config:
        debug("config not available for view", view.file_name())
        return None

    window_config_states = window_configs(window)
    if config.name not in window_config_states:
        debug(config.name, "not available for view",
              view.file_name(), "in window", window.id())
        return None
    else:
        session = window_config_states[config.name]
        if session.state == ClientStates.READY:
            return session
        else:
            return None
开发者ID:Kronuz,项目名称:SublimeCodeIntel,代码行数:25,代码来源:clients.py


示例7: show_enable_config

def show_enable_config(view: sublime.View, config: ClientConfig):
    syntax = str(view.settings().get("syntax", ""))
    message = "SublimeCodeIntel has found a language server for {}. Run \"Setup Language Server\" to start using it".format(
        extract_syntax_name(syntax)
    )
    window = view.window()
    if window:
        window.status_message(message)
开发者ID:Kronuz,项目名称:SublimeCodeIntel,代码行数:8,代码来源:configuration.py


示例8: modified_buffer

    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,代码行数:8,代码来源:doc.py


示例9: get_document_position

def get_document_position(view: sublime.View, point) -> 'Optional[OrderedDict]':
    file_name = view.file_name()
    if file_name:
        if not point:
            point = view.sel()[0].begin()
        d = OrderedDict()  # type: OrderedDict[str, Any]
        d['textDocument'] = {"uri": filename_to_uri(file_name)}
        d['position'] = offset_to_point(view, point).to_lsp()
        return d
    else:
        return None
开发者ID:Kronuz,项目名称:SublimeCodeIntel,代码行数:11,代码来源:documents.py


示例10: notify_did_save

def notify_did_save(view: sublime.View):
    file_name = view.file_name()
    window = view.window()
    if window and file_name:
        if has_document_state(window, file_name):
            client = client_for_view(view)
            if client:
                params = {"textDocument": {"uri": filename_to_uri(file_name)}}
                client.send_notification(Notification.didSave(params))
        else:
            debug('document not tracked', file_name)
开发者ID:Kronuz,项目名称:SublimeCodeIntel,代码行数:11,代码来源:documents.py


示例11: try_jump_to_def_aux

def try_jump_to_def_aux(view: sublime.View, name: str) -> None:
    start_time = time.time()
    while view.is_loading():
        time.sleep(0.01)
        if time.time() - start_time > 1:
            return
    symbols = {strip_prefix(text): pos for (pos, text) in view.symbols()}
    if name in symbols:
        region = symbols[name]
        view.run_command(
            "simple_context_show_selection",
            {"regions": [(region.a, region.b)]},
        )
开发者ID:equiva1ence,项目名称:ConTeXtTools,代码行数:13,代码来源:completions.py


示例12: enclosing_block

def enclosing_block(
    view: sublime.View, point: int, scope: str, end: Optional[int] = None,
) -> Optional[Tuple[int, int]]:
    start = stop = point
    while start > 0 and view.match_selector(start, scope):
        start -= 1
    end_ = view.size() if end is None else end
    while stop < end_ and view.match_selector(stop, scope):
        stop += 1

    if start < stop:
        return start + 1, stop
    return None
开发者ID:equiva1ence,项目名称:ConTeXtTools,代码行数:13,代码来源:scopes.py


示例13: update_diagnostics_regions

def update_diagnostics_regions(view: sublime.View, diagnostics: 'List[Diagnostic]', severity: int):
    region_name = "code_intel_" + format_severity(severity)
    if settings.show_diagnostics_phantoms and not view.is_dirty():
        regions = None
    else:
        regions = list(range_to_region(diagnostic.range, view) for diagnostic in diagnostics
                       if diagnostic.severity == severity)
    if regions:
        scope_name = diagnostic_severity_scopes[severity]
        view.add_regions(
            region_name, regions, scope_name, settings.diagnostics_gutter_marker,
            UNDERLINE_FLAGS if settings.diagnostics_highlight_style == "underline" else BOX_FLAGS)
    else:
        view.erase_regions(region_name)
开发者ID:Kronuz,项目名称:SublimeCodeIntel,代码行数:14,代码来源:diagnostics.py


示例14: left_enclosing_block

def left_enclosing_block(
    view: sublime.View, point: int, scope: str, end: Optional[int] = None,
) -> Optional[Tuple[int, int]]:
    """
    Like `enclosing_block`, but checks that `point` is the right-boundary of
    the eventual block. If not, signal an error with `None`.
    """

    if end is None:
        end = view.size()
    block = enclosing_block(view, point, scope, end=end)
    if block and not view.match_selector(point + 1, scope):
        return block
    return None
开发者ID:equiva1ence,项目名称:ConTeXtTools,代码行数:14,代码来源:scopes.py


示例15: on_pre_close

    def on_pre_close(self, view: sublime.View) -> None:
        """Called when the view is about to be closed
        """

        self._erase_marks(view)
        for severity in ['VIOLATIONS', 'WARNINGS', 'ERRORS']:
            ANACONDA[severity][view.id()] = {}
开发者ID:DamnWidget,项目名称:anaconda,代码行数:7,代码来源:linting.py


示例16: get_window_client_config

def get_window_client_config(view: sublime.View) -> 'Optional[ClientConfig]':
    window = view.window()
    if window:
        configs_for_window = window_client_configs.get(window.id(), [])
        return get_scope_client_config(view, configs_for_window)
    else:
        return None
开发者ID:Kronuz,项目名称:SublimeCodeIntel,代码行数:7,代码来源:configurations.py


示例17: on_query_completions

    def on_query_completions(self, view: sublime.View, prefix: str, locations: List[Tuple[int]]) -> Tuple[List[Tuple[str]], int]:  # noqa
        """Sublime Text autocompletion event handler
        """

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

        if completion_is_disabled(view):
            return

        if not dot_completion(view):
            enable_dot_completion(view)

        global JUST_COMPLETED

        if self.ready_from_defer is True:
            completion_flags = 0

            if get_settings(view, 'suppress_word_completions', False):
                completion_flags = sublime.INHIBIT_WORD_COMPLETIONS

            if get_settings(view, 'suppress_explicit_completions', False):
                completion_flags |= sublime.INHIBIT_EXPLICIT_COMPLETIONS

            cpl = self.completions
            self.completions = []
            self.ready_from_defer = False
            JUST_COMPLETED = True

            return (cpl, completion_flags)

        location = view.rowcol(locations[0])
        data = prepare_send_data(location, 'autocomplete', 'jedi')

        Worker().execute(self._complete, **data)
开发者ID:lpig,项目名称:sublime-backup,代码行数:35,代码来源:completion.py


示例18: _modified_buffer

    def _modified_buffer(self, view: sublime.View, code: str) -> str:
        """Guru needs this to use unsaved buffers instead of files
        """

        return '\n'.join([
            view.file_name(), str(len(code.encode('utf8'))), code
        ])
开发者ID:DamnWidget,项目名称:anaconda_go,代码行数:7,代码来源:implements.py


示例19: is_at_word

def is_at_word(view: sublime.View, event) -> bool:
    pos = get_position(view, event)
    point_classification = view.classify(pos)
    if point_classification & SUBLIME_WORD_MASK:
        return True
    else:
        return False
开发者ID:Kronuz,项目名称:SublimeCodeIntel,代码行数:7,代码来源:documents.py


示例20: update_diagnostics_in_view

def update_diagnostics_in_view(view: sublime.View, diagnostics: 'List[Diagnostic]'):
    if view and view.is_valid():
        update_diagnostics_phantoms(view, diagnostics)
        for severity in range(
                DiagnosticSeverity.Error,
                DiagnosticSeverity.Error + settings.show_diagnostics_severity_level):
            update_diagnostics_regions(view, diagnostics, severity)
开发者ID:Kronuz,项目名称:SublimeCodeIntel,代码行数:7,代码来源:diagnostics.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python path.root_at_packages函数代码示例发布时间:2022-05-27
下一篇:
Python sublime.windows函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap