Skip to content

Аfter file create/delete - request workspace/diagnostic with updated diagnostics are ignored by client #1647

Open

Description

Hi,

My language server (written on go, transport through stdio) implements the workspace/diagnostic request and returns a full set of diagnostics for all files in the workspace. This works correctly in most cases.

However, when a file is created or deleted (via LSP methods like codeAction/resolve, not a side effect), the editor does not seem to update diagnostics accordingly - it keeps showing outdated diagnostics. Despite my server responding with updated diagnostics for all files, the client seems to ignore them.

Steps

  1. Implement workspace/diagnostic with response like IF file B.txt NOT exist THEN return one error ELSE return zero errors
  2. Open file A.txt - it should have one diagnostic error
  3. With Quick fix choose some action that should trigger codeAction/resolve
  4. On codeAction/resolve send response with
{edit: {
  documentChanges: [
    {kind: "create", uri: "file:///B.txt"},
    {
      textDocument: {uri: "file:///B.txt"},
      edits: [
        {
          range: {start: {line: 0, character: 0}, end: {line: 0, character: 0}},
          newText: "test"
        }
      ],
    },
  ]
}}
  1. workspace/diagnostic triggered and returned zero errors for A.txt
  2. File A.txt still has visible one error instead of zero errors
  3. Any edit of A.txt or B.txt clears errors form file A.txt

Versions

"vscode-languageclient": "^10.0.0-next.16"

VSCode

Version: 1.101.1
Commit: 18e3a1ec544e6907be1e944a94c496e302073435
Date: 2025-06-18T13:35:12.605Z
Electron: 35.5.1
ElectronBuildId: 11727614
Chromium: 134.0.6998.205
Node.js: 22.15.1
V8: 13.4.114.21-electron.0
OS: Linux x64 6.8.0-60-generic snap

Activity

  1. dbaeumer commented on Jun 26, 2025

    @dbaeumer
    Member

    Do you see the same behavior when creating the file B.txt using the explorer inside VS Code?

  2. redexp commented on Jun 27, 2025

    @redexp
    Author

    Dirk Bäumer (@dbaeumer) I wrote the condition IF file B.txt does NOT exist ... just to give a simple example. Actually, in my case, it's more like: IF some text exists in file B.txt THEN return zero errors ELSE return one error.

    That’s why, in step 4, I didn’t just return "create" for the file but also specified "newText" for this new file. If I add the text manually anywhere in the workspace (including files created by the code action), then the response from workspace/diagnostic is handled correctly.

  3. added
    bugIssue identified by VS Code Team member as probable bug
    and removed
    info-neededIssue requires more information from poster
    on Dec 9, 2025
  4. dbaeumer commented on Dec 18, 2025

    @dbaeumer
    Member

    Sergii Kliuchnyk (@redexp) I assume you have A.txt open in the editor. If so the server should receive a pull diagnostic for the file. For open files the client always pulls for the file and the result overlays the one from workspace/diagnostics. This is to be able to show errors quicker in the UI.

    And what is the value of interFileDependencies when you register for pull diagnostics.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue identified by VS Code Team member as probable bug

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions