-
Notifications
You must be signed in to change notification settings - Fork 24
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
Remove unnecessary code lens refresh #309
Conversation
11efd1f
to
3cc888d
Compare
3cc888d
to
e3db847
Compare
Put this as a draft because I'm not totally sure if it is necessary to refresh code lenses at all considering that we are restarting the language server every time that the emulator state changes. (i.e. the code lenses refresh anyways because we restart the language server). I'm assuming we can probably just ditch this functionality altogether. |
The first thing is to remove the file changes to trigger codeless refresh, this was now done every time you opened a file, and it resulted in a weird behavior asking you whether you want to save a file or not even though you just opened it to view it. The other part is, do we need to keep manual codelens refresh, I believe we had reasons to do that in the past (and since it's a while since I worked on this codebase I forgot what all the reasons were), but you can try disabling this and see if it behaves correctly. I would test couple of cases:
In short, try out how it works with removing automatic file edits and not calling the refresh. Be careful on imports, autocompletions, and codelensses when you do changes (like adding another argument to a script). |
I've just tested everything and it all performs the same when I remove the CodeLens refresh. To be sure that we didn't need it I looked into the history of the function and it was created back in 2021 at a time when emulator state changes did not necessarily imply a reload of the language server. When it was created, there were times that the emulator would turn on/off, but the language server would never be restarted. It just looks like unnecessary grandfathered code that we can get rid of. |
@@ -155,7 +156,7 @@ export class LanguageServerAPI { | |||
} | |||
|
|||
async #sendRequest (cmd: string, args: any[] = []): Promise<any> { | |||
return await this.client?.sendRequest('workspace/executeCommand', { | |||
return await this.client?.sendRequest(ExecuteCommandRequest.type, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just changed this to a typed request handler since it's probably better practice
Nice, good job. |
@jribbink can you look at why the test fails? |
For Ubuntu - looks like flaky tests... ran it again twice and it passed, can see similar results in CI for other PRs. For Windows - looks like the tests are just broken and have been for the last few commits to master. |
I think this is worth investigating and fixing as a separate PR and issue. |
The codelens was being tricked into refreshing using document modification every time the emulator state changed. This is ultimately unnecessary, grandfathered behaviour as the language server is restarted every time the emulator state changes (so code lens & other changes will be reflected automatically)
Closes #218
For contributor use:
master
branchFiles changed
in the Github PR explorer