usethesource / rascal-language-servers

An LSP server for Rascal which includes an easy-to-use LSP generator for languages implemented in Rascal, and an interactive terminal REPL.
BSD 2-Clause "Simplified" License
13 stars 7 forks source link

File changes outside of VS Code interrupt the summary calculation but don't restart it #354

Closed DavyLandman closed 6 months ago

DavyLandman commented 7 months ago

Describe the bug

If you have a DSL with a summarizer defined, it gets triggered on every save of the file. However, if the file save happens outside of VS Code (say git pull or someone using vim), the summary calculation is interrupted, but not triggered again. Hiding error messages.

To Reproduce

Steps to reproduce the behavior:

  1. Define a LanguageService with a summarizer (make sure it takes a few seconds to run, it's easier to spot that way)
  2. inside VS Code, trigger a save of a file, observe the summarizer running
  3. Open the same file using vim, and change something and save it, while the summarizer is still running.
  4. The summary calculation is stopped (the message about it is not visible at fixed DEBUG log level)
  5. No new summary is calculated on the new changes.

Expected behavior Summary to be calculated after the new file contents have been parsed.

Desktop (please complete the following information):

Additional context

What is happening? The rascal-lsp gets 2 events, "change" and "save". The change events contains the new contents of a file (that might or might not be saved to disk) and the "save" event that is triggered when a user inside VS Code presses save.

Now the problem is, changes from outside of VS Code do generate a "change" event. but not a "save" event. The code in rascal-lsp wrongfully assumed this relationship between these two events.

Thanks @sungshik for diagnosing this issue.

DavyLandman commented 6 months ago

This has been fixed in the rewrite of this feature in #357 (and released in v0.11.0)