3 ms·
Ok, so you're not pointing to an implementation of the feature that I asked about. Instead, you're asking me to implement it as a special case. That's backwards
by gmueckl 5y ago
Ok, so you're not pointing to an implementation of the feature that I asked about. Instead, you're asking me to implement it as a special case. That's backwards.
You're effectively confirming that there needs to be feature-specific integration code for each and every navigation/refactoring/... feature in the editor. Once you have that, you again have tight coupling.
- omnicognate 5y agoNot at all. The server allows for discovery of code actions and their parameters and the UI is displayed in response, by code that knows nothing about particular actions. It goes something like this (won't be accurate in the details, check the lsp spec [1] under Code Action Request if you want chapter and verse): User to emacs: I want to perform a code action. Emacs to server: The selection is this. What code actions can you perform? Server to emacs: I can perform actions called "Extract Method", "Extract Base Class", etc. Emacs to user: Choose an action from this list User to emacs: I'll do "Extract method" Emacs to server: We're going with "Extract Method", what info do you need. Server to emacs: I need an item called "method name" which is a string and an item called "visibility", which is one of the following: "public", "private", "protected". Emacs to user: Enter method name... Select visibility... Emacs to server: Here are the parameter values. Server: Here are the edits necessary to perform the code action Emacs: Updates code. No special per-action code is required. If you want to see an implementation have a look at lsp-mode[2]. I hope that makes it clear. I've spent more of my day explaining this than I should have now, so I'll leave it there. [1] https://microsoft.github.io/language-server-protocol/specifications/specification-current/ https://microsoft.github.io/language-server-protocol/specifi... [2] https://emacs-lsp.github.io/lsp-mode/ https://emacs-lsp.github.io/lsp-mode/
- gmueckl 5y agoPlease forget "Extract Method" as an example. It's simply far too trivial. Imaging extracting a new superclass or interface from a class with 100 methods and you need to pick the set of methods to extract. You can't do that with 100 y/n choices.