Skip to content

Ignore stray textDocument/didSave requests#712

Open
mmyrte wants to merge 1 commit intoREditorSupport:masterfrom
mmyrte:avoid-didSave-foreign-language
Open

Ignore stray textDocument/didSave requests#712
mmyrte wants to merge 1 commit intoREditorSupport:masterfrom
mmyrte:avoid-didSave-foreign-language

Conversation

@mmyrte
Copy link

@mmyrte mmyrte commented Feb 19, 2026

Zed chose to interpret the LSP spec differently from VS Code, sending didSave to any file, not caring what the languageId is - see ocsmit/zed-r#6 - which leads to languagserver trying to parse and lint all over the place. (edit: found #681 also relates to this issue).

Dirk Bäumer tentatively specifies that a server should not respond to a request if the file was not previously opened by it, see microsoft/language-server-protocol#2110, see hudson-trading/slang-server#237 for a sample implementation.

I'm proposing to simply ignore documents that are not yet in the workspace, which fixes the problems on my end. I'm afraid I don't know enough about this package or the protocol to assess whether this is acceptable; I also don't have the time to go into this much further

I am happy to amend this PR, if needed: we could specifically retrieve the document associated with a URI to check for the is_open flag, but that leaves open the question of whether/how to ignore files not yet in the workspace.

@JonGretar
Copy link

Thank you.

Copy link

@rgbkrk rgbkrk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! I'm not a maintainer here obviously but I would love to have this fix.

renkun-ken
renkun-ken previously approved these changes Feb 20, 2026
Copy link
Member

@renkun-ken renkun-ken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thanks!

@renkun-ken
Copy link
Member

Looks like the change breaks most test cases where each test code relies on did_save to open and parse the supplied document.

@renkun-ken renkun-ken dismissed their stale review February 20, 2026 04:15

Testing should be fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Comments