VSpaceCode / VSpaceCode

Spacemacs like keybindings for Visual Studio Code
https://vspacecode.github.io/
MIT License
1.43k stars 134 forks source link

Add major mode action key bindings #181

Open MarcoIeni opened 3 years ago

MarcoIeni commented 3 years ago

Problem

It would be nice to use spc m a for "actions" as the LSP layer in spacemacs.

Solution

Add the following key bindings to all the major modes:

SPC m a a | Execute code action | editor.action.codeAction SPC m a f | Execute fix action | editor.action.quickFix SPC m a r | Execute refactor action | editor.action.refactor SPC m a s | Execute source action | editor.action.sourceAction

Additional context

Opened this from this discussion

stevenguh commented 3 years ago

Should we unify SPC m r . as well? Keep it? Remove it?

My take is probably okay to have it in both places SPC m r . and SPC m a since editor.action.quickFix which usually binds to SPC m r . includes both Quick Fixes and refactorings.

@macintacos added SPC m r . in the go lang, any thoughts?

macintacos commented 3 years ago

I'm not gunna lie, I've had Spacemacs uninstalled long enough at this point because of this extension that I really don't know off the top of my head what would be the "Spacemacs way" πŸ˜…. I'm okay with removing it so that things stay consistent, but I'll leave that up to y'all.

stevenguh commented 3 years ago

That's good to hear😁

I sampled some major modes in spacemacs. There isn't really a consensus. It seems like each major mode is doing their thing. Majority of them don't offer refactoring at point.

C# uses SPC m r r: https://develop.spacemacs.org/layers/+lang/csharp/README.html#refactoring C++ uses SPC m r .: https://develop.spacemacs.org/layers/+lang/c-c++/README.html#refactor go seems to spell out all the available refactoring options: https://develop.spacemacs.org/layers/+lang/go/README.html#refactoring

I can see quick fix in the refactoring menu because it includes all the refactoring option available at point; however, there are going to be quite a bit of duplicate of quick fix SPC m r ., SPC x ., SPC m a a.

MarcoIeni commented 3 years ago

We could use SPC m a a as default for everything, and add the others in order to follow spacemacs conventions for each specific language, i.e. SPC m r r for C# and SPC m r for C++ for example

stevenguh commented 3 years ago

That sounds great! 😁