noisy `-32801` ("Content Modified") errors
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 48/100
Piste de recherche
Commencez par suivre le chemin de la requête textDocument/semanticTokens/full et la manière dont les notifications textDocument/didChange affectent les requêtes en cours. Comparez ce comportement avec la spécification LSP responseError.code ; le travail est terminé lorsque les changements de document normalement mis en file d’attente ne produisent plus -32801, tandis que les modifications véritablement externes peuvent toujours le produire.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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
- Langage dominant
- Lua
- Étoiles
- 4.4k
- Forks
- 442
- Merge moyen
- 8 j 9 h
- PR mergées (30 j)
- 1
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de LuaLS/lua-language-server
-
enhancement
Difficulté 2/5 1-3 heures Accessibilité débutants 62/100
LuaLS/lua-language-server#1776 ·
-
泛型for迭代器的类型推导漏掉了带__call的类 Ouverte
Difficulté 3/5 1-2 jours Accessibilité débutants 65/100
LuaLS/lua-language-server#3463 · 5 commentaires ·
-
Difficulté 4/5 3-5 jours Accessibilité débutants 55/100
LuaLS/lua-language-server#3461 ·
-
Difficulté 3/5 1-2 jours Accessibilité débutants 68/100
LuaLS/lua-language-server#3460 · 1 commentaire · 1 réaction ·
-
Difficulté 3/5 1-2 jours Accessibilité débutants 68/100
LuaLS/lua-language-server#3459 · 1 réaction ·
Toutes les issues de LuaLS/lua-language-server
Issues similaires
-
Nmap
Difficulté 1/5 Moins d'une heure Accessibilité débutants 85/100
-
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
-
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
LandSandBoat/server#11579 ·
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 90/100