-
Notifications
You must be signed in to change notification settings - Fork 28
Code action? #75
Comments
Hello. The two main actions applicable to code documents would be code refactorings and problem quickfixes. In LSP both can be represented using the RefactoringsSome actions would be globally available regardless of which errors/warnings are in the file. The process for gathering the list of those available code actions would be something like:
The second part could be accomplished using part of the RefactoringActionHandler in the IntelliJ SDK. It could be used for determining which code actions to add and how to calculate the result of the corresponding LSP command associated with the action. QuickfixesThe quickfix menu in IntelliJ seems to use a separate mechanism for applying fixes. A single problem can have multiple quickfixes, and the code actions available for a region depend on specific instances of diagnostics being available in that region. If a code action for one of the diagnostics is selected, the server would have to correlate which IntelliJ problem it is associated with, then return actions associated with the quickfixes for that problem. Also, the problems would have to be retrieved later if the quickfix code action is selected, so a caching or synchronization mechanism might be needed. There is support for the Here is where IntelliJ's quickfixes seem to be held. You would be able to call There are a lot of subtleties and synchronization that would be needed to interface with IntelliJ's mechanisms for both refactoring and the quickfix feature, but it's probably doable with enough time. Also, it may be necessary to add support for certain features to clients nto completely compatible with the spec. I added some amount of extra code to the Emacs client for running certain commands and showing executable tests or Hopefully this is somewhat informative. Although I'm sort of occupied by other projects at the moment, if something isn't clear, please ask. |
This is all great information, thanks! Going to start poking around... |
Hi there! Thanks for this very promising project, I love anything that gets me out of an IDE and back into Emacs! Your critique of eclim is spot on; it is both slow and finicky about project setup. The biggest differentiator to me at least is the ability to fix issues automatically. In eclim it is clunky and takes a crazy amount of time to apply the change, but it's still faster than checking the flycheck error and manually applying a fix. I would be happy to take a shot at implementing the functionality but all of this lsp stuff is so new to me I'm not sure how to begin. Any pointers? Thanks again!
The text was updated successfully, but these errors were encountered: