-
-
Notifications
You must be signed in to change notification settings - Fork 669
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
LSP: make autocompletion etc work better when the file has changed since the last successful compilation #2766
Comments
Tagging @giacomocavalieri @rawhat @Acepie who I believe are interested in working on the LSP |
So my understanding of this (if I am reading correctly) is that in the short term the goal is to get lower hanging fruit wins by doing things that are possible without going to implementing fault tolerant parsing? So since we have access to the modified src we can do local changes relatively safely (i.e. things like using the src byte_index/cursor pos for certain actions instead of the saved one, things that ultimately amount to line level simple parses, directly fixing edit positions for completions, maybe confirming a definition is still at a location before doing a goto?). I assume anything beyond that and we might as well just implement fault tolerant parsing since we'd have to do partial parses anyway. As for the fault tolerant parsing, I "theoretically" understand the core idea of what needs to change but I'm not entirely sure about how to plan it out into chunks. From my general knowledge on the topic/what I've read so far the strategy at a high level would be something like:
Does that seem generally right? With the idea being that over time we improve how granularly we put error holes/how well we handle those error holes in the lsp/diagnostics |
Aye, it would be good to find ways to improve this in the short term as making every compiler pass fault tolerant is a large amount of work, and we would also need to make it capable of integrating state from previous compilation passes so we have more context in code with errors, which would likely involve changing how various syntaxes (mainly pipes and use) are compiled in order to preserve more information.
This is incidental. Fault tolerant parsing compilation analysis would make this possible, but it's not a requirement.
Yes but I think this is not the majority of the work. Almost always while the programmer is typing Gleam code will parse successfully, it is analysis that will fail. I wager we could not have fault tolerant parsing at all and so long as we are able to use information from previous analysis with the new positional information then we'll have the good experience we want. |
Replacing with the linked issues above |
Currently the language server only gets information about the code after successful compilation, so there is a period of drift between the state of the code in the LS and in the source file while code has errors.
This can result in:
And so on.
Long term we want to make everything fault tolerant, but this needs to be an incremental process.
What can we do to improve the experience in the near future?
I believe this will be a very high value and impactful area of work.
The text was updated successfully, but these errors were encountered: