Skip to content

LSP diagnosis is not updated after edit #3243

@huww98

Description

@huww98

What happened?

When agent edit a file then invoke LSP diagnosis again, it still see the old content.

What did you expect to happen?

It can see the latest diagnosis.

Client information

Client Information

Run qwen to enter the interactive CLI, then run the /about command.

$ qwen /about
# paste output here

Login information

No response

Anything else we need to know?

Currently, we don't send textDocument/didChange to LSP server. We should send this to refresh the diagnosis (and anything else like hover, etc.)

For implementation, I propose:

  1. implement this in packages/core/src/core/coreToolScheduler.ts, So that we can send notification after hooks, to also consider the changes from hooks. Downside: ACP seems taking a different path, so we may need to implement this again for ACP
  2. implement this in each tool that edit a file.

With this implemented, we still have some limitations on the LSP integration:

  1. Changes from Bash tool is not detected (e.g. git checkout)
  2. Manual changes by user is not detected

protential future works:

  1. Watch every file in the workspace, like what vscode is doing, and send workspace/didChangeWatchedFiles to LSP server. Heavy, but this enable us to send some system-reminder to agent when files are changed on disk.
  2. Only watch the files that was opened.
  3. Compare each file content with last known version on read / turn start. Cheap, but only resolve part of the issue -- files not read by agent maybe still stall.

Metadata

Metadata

Assignees

Labels

type/bugSomething isn't working as expected

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions