Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LazyVim "Source Action" binding doesn't work #254

Open
audishos opened this issue Mar 25, 2024 · 4 comments
Open

LazyVim "Source Action" binding doesn't work #254

audishos opened this issue Mar 25, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@audishos
Copy link

When I use the predefined "Source Action" option with LazyVim, I get the message "No code actions available".

image

Normally, this binding will surface code actions that can be applied to the entire file/buffer. This includes actions like adding missing imports, sorting imports, removing unused imports, removing unused variables, etc. The default binding for this is "<leader>cA" and it implements a custom function. I'm assuming that I need to modify this binding, but I'm not sure to what exactly. Any help is appreciated and thank you in advance!

@rubiin
Copy link

rubiin commented Apr 3, 2024

@audishos you can check my files https://github.com/rubiin/init.lua

@audishos
Copy link
Author

@rubiin thank you for sharing! Just to confirm, does your config map these actions to separate key bindings? I was hoping to restore the same behavior as using the language server where it shows a window allowing you to select from a list of these actions. This way, you only need a single binding. Do you know if this is possible?

@audishos
Copy link
Author

audishos commented May 2, 2024

I added the following to my config and now the actions show up with the other line specific actions.

    -- array of strings("fix_all"|"add_missing_imports"|"remove_unused"|
    -- "remove_unused_imports"|"organize_imports") -- or string "all"
    -- to include all supported code actions
    -- specify commands exposed as code_actions
    expose_as_code_action = "all",

It's not exactly what I want (separate dialogues for file vs. line actions), but at least I can access these actions now.

@kieran-osgood
Copy link

I was going to make a similar post around lazy vims source action and where the suggestions show up - hope its okay to add this here!

Running Source Action, I don't typically see any options from typescript-tools, is there a way to include the user commands here?
Specifically I'm thinking ones like TSToolsRemoveUnusedImports

image

@KostkaBrukowa KostkaBrukowa added the enhancement New feature or request label Jun 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants