-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LSP: Using a virtual filesystem (#524)
* LSP: Using a virtual filesystem Add a primitive notion of a "virtual filesystem" (which is just a `Map<String, String>` for now) to represent abra files that require typechecking but which have not yet been saved to disk. For now, the contents of this map are wholesale replaced upon receipt of a `textDocument/didChange` notification from the LSP client, and removed upon `textDocument/didSave` (since at that point, the file can once again be read from disk to obtain the latest version). In the future, there ought to be a more sophisticated way of representing the file contents in the virtual filesystem, which leverages the Incremental `contentChange` option for `textDocument/didChange` notifications, rather than having to wastefully parse and replace the entire contents of the document each time. In fact, the LSP currently falls over when trying to operate on large files, most likely for this reason. * Postponing virtual filesystem changes Using this current approach, the entire contents of the changed file will be sent in `textDocument/didChange` events (as well as `textDocument/didOpen`, which is less relevant but still wasteful). Until a more performant system is developed to leverage Incremental didChange events, let's only run diagnostics on save and instruct the client to not send didOpen or didChange events. Additionally, we instruct the client to not send the file contents in the didSave event.
- Loading branch information
Showing
4 changed files
with
170 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.