This is not possible at the moment because the quick panel is hardcoded in the run
method of these commands.
Could you explain why or how exactly you would use this? I’m asking because many servers need to read and index all the relevant files in the workspace in the background after starting (in the case of Pyright, LSP-json on the other hand probably doesn’t need that because JSON files are typically standalone files). So there would likely be significant overhead / performance drawbacks from starting and stopping servers often.
Some features (code lenses, inlay hints and hover popups) can already be toggled dynamically per window from the View
main menu or command palette and there are corresponding commands that can be bound to a key. If the same would be useful for other features too, we could think about adding more such toggle options.
If you really still need a key binding for enabling/disabling the language servers, could you please open an issue in the LSP repo on GitHub? It shouldn’t be too difficult to modifiy the commands to use InputHandlers instead of show_quick_panel
, which would then allow to pass a config name as an argument directly (personally I perfer using InputHandlers anyway).