當前位置: 首頁>>代碼示例>>Python>>正文


Python View.buffer_id方法代碼示例

本文整理匯總了Python中sublime.View.buffer_id方法的典型用法代碼示例。如果您正苦於以下問題:Python View.buffer_id方法的具體用法?Python View.buffer_id怎麽用?Python View.buffer_id使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在sublime.View的用法示例。


在下文中一共展示了View.buffer_id方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: notify_did_change

# 需要導入模塊: from sublime import View [as 別名]
# 或者: from sublime.View import buffer_id [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

示例2: queue_did_change

# 需要導入模塊: from sublime import View [as 別名]
# 或者: from sublime.View import buffer_id [as 別名]
def queue_did_change(view: sublime.View):
    buffer_id = view.buffer_id()
    buffer_version = 1
    pending_buffer = None
    if buffer_id in pending_buffer_changes:
        pending_buffer = pending_buffer_changes[buffer_id]
        buffer_version = pending_buffer["version"] + 1
        pending_buffer["version"] = buffer_version
    else:
        pending_buffer_changes[buffer_id] = {
            "view": view,
            "version": buffer_version
        }

    sublime.set_timeout_async(
        lambda: purge_did_change(buffer_id, buffer_version), 500)
開發者ID:Kronuz,項目名稱:SublimeCodeIntel,代碼行數:18,代碼來源:documents.py

示例3: update_diagnostics_phantoms

# 需要導入模塊: from sublime import View [as 別名]
# 或者: from sublime.View import buffer_id [as 別名]
def update_diagnostics_phantoms(view: sublime.View, diagnostics: 'List[Diagnostic]'):
    global phantom_sets_by_buffer

    buffer_id = view.buffer_id()
    if not settings.show_diagnostics_phantoms or view.is_dirty():
        phantoms = None
    else:
        phantoms = list(
            create_phantom(view, diagnostic) for diagnostic in diagnostics)
    if phantoms:
        phantom_set = phantom_sets_by_buffer.get(buffer_id)
        if not phantom_set:
            phantom_set = sublime.PhantomSet(view, "code_intel_diagnostics")
            phantom_sets_by_buffer[buffer_id] = phantom_set
        phantom_set.update(phantoms)
    else:
        phantom_sets_by_buffer.pop(buffer_id, None)
開發者ID:Kronuz,項目名稱:SublimeCodeIntel,代碼行數:19,代碼來源:diagnostics.py


注:本文中的sublime.View.buffer_id方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。