diff options
author | landerlo <lander.lopez@gmail.com> | 2020-05-14 04:14:52 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-13 23:14:52 -0400 |
commit | 02155f5c102539d5052912956606a452a78ad78c (patch) | |
tree | ee20b0370290de373aa6a5ff57a800b4c91c12ed /runtime/lua/vim/lsp/util.lua | |
parent | 55b62a937c27715f7e6c299ae312c38edf08fa74 (diff) | |
download | rneovim-02155f5c102539d5052912956606a452a78ad78c.tar.gz rneovim-02155f5c102539d5052912956606a452a78ad78c.tar.bz2 rneovim-02155f5c102539d5052912956606a452a78ad78c.zip |
lsp: fix bug when documentEdit version=null for unattached buffer (#12272)
Diffstat (limited to 'runtime/lua/vim/lsp/util.lua')
-rw-r--r-- | runtime/lua/vim/lsp/util.lua | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua index 9efab73c2b..099a77099b 100644 --- a/runtime/lua/vim/lsp/util.lua +++ b/runtime/lua/vim/lsp/util.lua @@ -168,10 +168,12 @@ end function M.apply_text_document_edit(text_document_edit) local text_document = text_document_edit.textDocument local bufnr = vim.uri_to_bufnr(text_document.uri) - -- `VersionedTextDocumentIdentifier`s version may be nil https://microsoft.github.io/language-server-protocol/specification#versionedTextDocumentIdentifier - if text_document.version ~= vim.NIL and M.buf_versions[bufnr] > text_document.version then - print("Buffer ", text_document.uri, " newer than edits.") - return + if text_document.version then + -- `VersionedTextDocumentIdentifier`s version may be null https://microsoft.github.io/language-server-protocol/specification#versionedTextDocumentIdentifier + if text_document.version ~= vim.NIL and M.buf_versions[bufnr] ~= nil and M.buf_versions[bufnr] > text_document.version then + print("Buffer ", text_document.uri, " newer than edits.") + return + end end M.apply_text_edits(text_document_edit.edits, bufnr) end |