Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should we turn on textDocument/didChange for the language server #26896

Open
jabraham17 opened this issue Mar 11, 2025 · 1 comment
Open

Should we turn on textDocument/didChange for the language server #26896

jabraham17 opened this issue Mar 11, 2025 · 1 comment

Comments

@jabraham17
Copy link
Member

jabraham17 commented Mar 11, 2025

Currently, the language server updates its cache of diagnostics and visual aids only on a fresh document open or when the document is saved. This means that a user only gets updates when the file in buffer is saved.

For most editing practices, this is sufficient. You don't want your tool to constantly be updating, as this can be annoying or cause some diagnostics to break. But there are other ways a files buffer may change without a save event, where you want the diagnostics to update. For example, git operations routinely change the underlying file, but the language server doesn't count that as a save event. It does count it as a change event. Similarly, something like chplcheck --fixit will cause the file to change without the language server updating.

This can result in diagnostic artifacts like this, where the lint no longer applies because the file has changed.

Image

I am inclined to just update the language server to update on textDocument/didChange (which is a small code change to support it). But in the past, I recall some opposition to this (namely @DanilaFe?) for specific reasons I don't recall, hence this issue

Note this effects both chpl-language-server and chplcheck

@DanilaFe
Copy link
Contributor

I suspect my concerns were cache effects, the lack of partial parsing, and triggering query system bugs. If you feel the LS is stable without them, a (on by default, but toggleable) flag to respond to didChange events might be fine.

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

No branches or pull requests

2 participants