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


Python View.size方法代码示例

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


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

示例1: _session_for_view_and_window

# 需要导入模块: from sublime import View [as 别名]
# 或者: from sublime.View import size [as 别名]
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,代码行数:27,代码来源:clients.py

示例2: last_block_in_region

# 需要导入模块: from sublime import View [as 别名]
# 或者: from sublime.View import size [as 别名]
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,代码行数:28,代码来源:scopes.py

示例3: modified_buffer

# 需要导入模块: from sublime import View [as 别名]
# 或者: from sublime.View import size [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

示例4: enclosing_block

# 需要导入模块: from sublime import View [as 别名]
# 或者: from sublime.View import size [as 别名]
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,代码行数:15,代码来源:scopes.py

示例5: left_enclosing_block

# 需要导入模块: from sublime import View [as 别名]
# 或者: from sublime.View import size [as 别名]
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,代码行数:16,代码来源:scopes.py

示例6: notify_did_change

# 需要导入模块: from sublime import View [as 别名]
# 或者: from sublime.View import size [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

示例7: notify_did_open

# 需要导入模块: from sublime import View [as 别名]
# 或者: from sublime.View import size [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


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