Add "Restart Phan Language Server" command#103
Add "Restart Phan Language Server" command#103blm768 wants to merge 1 commit intoTysonAndre:masterfrom
Conversation
src/extension.ts
Outdated
| const languageClients = analyzedProjectDirectories.map(createClient); | ||
|
|
||
| async function restartLanguageClients(): Promise<void> { | ||
| for (const client of languageClients) { |
There was a problem hiding this comment.
await Promise.all(languageClients.map(client => client.restart())) seems better, it would restart clients in parallel and restart faster
https://github.com/microsoft/vscode-languageserver-node/blob/292dd0d88b6465337e42ba40ad986fdfdeb42d4d/client/src/node/main.ts#L189-L201 as long as the languageserver dependency is new enough.
There was a problem hiding this comment.
Unfortunately, restart doesn't seem to be in the latest version of vscode-languageserver-types. Restarting in parallel seems reasonable, though.
5912f7c to
ee96b30
Compare
|
I don't think this is 100% perfect yet; once or twice, I've gotten an error about something having been disposed when I run the command. I haven't seen that in about a month, though, so this seems like it's probably at least good enough to be useful in its current state. |
ee96b30 to
2427193
Compare
This is handy when the language server crashes.
2427193 to
2fef6f0
Compare
On my Windows machine, the language server seems to run into issues regularly. Rather than implement a proper solution, I went ahead and added a command to restart the LSP server in the time-honored tradition of, "It's Windows; just restart it".
I haven't fully tested this out yet, but it seems to at least kinda work.