Implement clangd.shutdown to manually deactivate the extension (complement to clangd.activate; first half of clangd.restart). Addresses #512 #524
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This change is a proof of concept that builds the fix roughly as described in #512 and works to disable and enable clangd language server on command with clangd.shutdown and clangd.activate. clangd.shutdown is implemented with the "dispose" action used for clangd.restart, as proposed in the issue.
Draft notes (TODO remove):
This still needs work to add some state checking of whether the language server is already shutdown, unregistration of commands that won't work if the language server is not running, or early-exit from said commands such that they don't display scary errors.
Certain commands may imply activation of the language server. Depending on the use case, this may or may not make sense versus asking the user to restart the server manually (with command
>clangd: Manually activate extension
) because it was previously manually shutdown by the user. Reactivating the language server via besign actions like going to another C++ file would defeat the benefit, but running clangd extension commands is enough of a signal that it might be reasonable to "do the right thing" by reactivating the language server.