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


Python View.file_name方法代码示例

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


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

示例1: _session_for_view_and_window

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

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

示例3: modified_buffer

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

# 需要导入模块: from sublime import View [as 别名]
# 或者: from sublime.View import file_name [as 别名]
def notify_did_close(view: sublime.View):
    file_name = view.file_name()
    window = sublime.active_window()
    if window and file_name:
        if has_document_state(window, file_name):
            clear_document_state(window, file_name)
            client = client_for_closed_view(view)
            if client:
                params = {"textDocument": {"uri": filename_to_uri(file_name)}}
                client.send_notification(Notification.didClose(params))
开发者ID:Kronuz,项目名称:SublimeCodeIntel,代码行数:12,代码来源:documents.py

示例5: get_document_position

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

示例6: notify_did_save

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

示例7: _client_for_view_and_window

# 需要导入模块: from sublime import View [as 别名]
# 或者: from sublime.View import file_name [as 别名]
def _client_for_view_and_window(view: sublime.View, window: 'Optional[sublime.Window]') -> 'Optional[Client]':
    session = _session_for_view_and_window(view, window)

    if session:
        if session.client:
            return session.client
        else:
            debug(session.config.name, "in state", session.state, " for view",
                  view.file_name())
            return None
    else:
        debug('no session found')
        return None
开发者ID:Kronuz,项目名称:SublimeCodeIntel,代码行数:15,代码来源:clients.py

示例8: initialize_on_open

# 需要导入模块: from sublime import View [as 别名]
# 或者: from sublime.View import file_name [as 别名]
def initialize_on_open(view: sublime.View):
    window = view.window()

    if not window:
        return

    debug("initialize on open", window.id(), view.file_name())

    if window_configs(window):
        unload_old_clients(window)

    window_id = window.id()
    global didopen_after_initialize
    config = config_for_scope(view)
    if config:
        if config.enabled:
            if not is_ready_window_config(window, config.name):
                open_after_initialize_by_window.setdefault(window_id, []).append(view)
                start_window_client(view, window, config)
        else:
            debug(config.name, 'is not enabled')
开发者ID:Kronuz,项目名称:SublimeCodeIntel,代码行数:23,代码来源:main.py

示例9: notify_did_open

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

示例10: notify_did_change

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


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