Skip to content

Commit

Permalink
fix: log mismatch between virtual document versions instead of notifying
Browse files Browse the repository at this point in the history
  • Loading branch information
neubaner committed Nov 11, 2024
1 parent 32cec8c commit edc5c95
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
12 changes: 12 additions & 0 deletions lua/rzls/documentstore.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
local razor = require("rzls.razor")
local utils = require("rzls.utils")
local VirtualDocument = require("rzls.virtual_document")
local Log = require("rzls.log")

---@class rzls.ProjectedDocuments
---@field virtual_html rzls.ProjectedDocument
Expand Down Expand Up @@ -117,6 +118,17 @@ function M.get_virtual_document(uri, type, version)

dispose_handler()

-- The client might be ahead of requested version due to other document
-- changes while we were synchronizing
if virtual_document.host_document_version ~= version then
Log.rzlsnvim = string.format(
'Mismatch between virtual document version. Uri: "%s". Server: %d. Client: %d',
virtual_document.path,
version,
virtual_document.host_document_version
)
end

return virtual_document
end

Expand Down
11 changes: 0 additions & 11 deletions lua/rzls/handlers/completion.lua
Original file line number Diff line number Diff line change
Expand Up @@ -111,17 +111,6 @@ return function(err, result, _ctx, _config)
assert(virtual_document, "No virtual document found")

if result.identifier.version ~= virtual_document.host_document_version then
vim.schedule(function()
vim.notify(
string.format(
"Mismatched between document versions. Server: %d. Client: %d",
result.identifier.version,
virtual_document.host_document_version
),
vim.log.levels.WARN,
{ title = "rzls.nvim" }
)
end)
return {
items = {},
isIncomplete = false,
Expand Down

0 comments on commit edc5c95

Please sign in to comment.