I'm messing around with adding an enhancement to clojure-lsp to extract multiple sexpresssions for extract-function. For now, I've created a new clojure-lsp refactoring called extract-function-2. It works from the tests. 🙂 But I can't get it to be invoked from Calva. When I select it from the popup, I get an error message saying command 'extract-function-2' not found. Do I also need to register this command in Calva's lsp-commands.ts like
{
command: 'extract-function-2',
afterCommandFn: renameAfterRefactor,
defaultName: 'new-fn',
category: 'clojureLsp.refactor',
},
Eventually extract-function-2 will take the begin and end of a selection, so I imagine I'll need to modify Calva to handle that for extract-function-2 as well?I think there is some place in calva you need to register that, but would be nice to get those from clojure-lsp autoamtically in the future
It's in the context menu popup, so at least part of it is coming from clojure-lsp. I think that once I select the menu item it goes back into the Calva code registering things to be done later (?) before invoking clojure-lsp. But yeah, making it fully data driven would be nice.
@ericdallo Is it more fully data driven in emacs? Or is there a way to run clojure-lsp refactor from the command line? (I wouldn't mind only changing one system at a time when testing.)
I don’t quite remember the reasons for the hardcoding. It may be possible to avoid it. Did it work if you added it to clojureLspCommands?
(working on it, but from trying to follow the code, now I'm guessing that it will)