noisy `-32801` ("Content Modified") errors
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 48/100
Direzione di ricerca
Inizia tracciando il percorso della richiesta textDocument/semanticTokens/full e il modo in cui le notifiche textDocument/didChange influenzano le richieste in corso. Confronta questo comportamento con la specifica LSP responseError.code; il lavoro è completato quando le normali modifiche ai documenti accodate non producono più -32801, mentre le modifiche effettivamente esterne possono ancora produrlo.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
How are you using the lua-language-server?
NeoVim
Which OS are you using?
MacOS
What is the issue affecting?
Other
Expected Behaviour
In the request-completion path, when the server has computed a result against document version V, return that result regardless of whether didChange for V+1 (or later) has since arrived. Only return -32801 if the document
modification was genuinely external / out-of-band — which is rare in normal usage and not what didChange represents.
If pre-empting in-flight requests on didChange is desired as an optimization, the spec-compliant signal is for the client to send $/cancelRequest. The server should not unilaterally short-circuit valid in-flight work with -32801.
Per the spec, the client is supposed to handle staleness via cancellation. With lua-language-server pre-empting that decision and erroring instead:
- Clients that handle
-32801strictly as an error end up logging spurious errors (cf. neovim/neovim#40208). - Clients that could have used the older-version result (perfectly valid per the spec — "even computed on an older state might still be useful") never get the chance.
- Clients that wanted to cancel can no longer rely on
$/cancelRequestsemantics because the server has already aborted on its own initiative.
Actual Behaviour
Sending a fast sequence of didChanges while semantic-tokens requests are in flight causes the server to error every in-flight request with:
{ "code": -32801, "message": "Content modified." }
even though the modification was delivered through normal didChange notifications, not "outside normal conditions."
Reproduction steps
- Open a Lua file in any LSP-capable editor that requests
semanticTokens/full(e.g. Neovim 0.12+). - Start typing across multiple lines, fast enough that successive
didChangenotifications outpace the server's processing. - Observe: every in-flight semantic-tokens request comes back with
-32801 Content modified.instead of a (possibly stale) result.
Additional Notes
lua-language-server returns LSP error -32801 ("Content Modified") in response to textDocument/semanticTokens/full (and likely other requests) whenever a textDocument/didChange notification arrives before the response is sent.
This contradicts the LSP specification, which explicitly forbids using -32801 for content changes detected in unprocessed messages — i.e. for the exact case currently being signaled.
What the spec says:
LSP §responseError.code (specifically the ContentModified = -32801 entry):
The server detected that the content of a document got modified outside normal conditions. A server should NOT send this error code if it detects a content change in its unprocessed messages. The result even computed on an older
state might still be useful for the client.If a client decides that a result is not of any use anymore the client should cancel the request.
So the intended semantics are:
-32801is for "out-of-band" content modification (e.g., the file on disk changed in a way the server can't reconcile with its in-flight state).
Log File
No response
- Lingua principale
- Lua
- Stelle
- 4.4k
- Fork
- 442
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di LuaLS/lua-language-server
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
LuaLS/lua-language-server#1776 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 55/100
LuaLS/lua-language-server#3461 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
LuaLS/lua-language-server#3460 · 1 commento · 1 reazione ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
LuaLS/lua-language-server#3459 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 64/100
LuaLS/lua-language-server#3458 ·
Tutte le issue di LuaLS/lua-language-server
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
api7/lua-resty-saml#62 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 94/100
codymikol/multiverse.nvim#320 ·
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 88/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100