-
-
Notifications
You must be signed in to change notification settings - Fork 54
Tips & Tricks
Srinesh Nisala edited this page Oct 22, 2024
·
10 revisions
Caution
Telescope doesn't seem to work stably for symbol search. We highly recommend using Fzf-lua instead!
Solution
- Using Fzf-lua
:FzfLua lsp_live_workspace_symbols
- Using telescope
:Telescope lsp_dynamic_workspace_symbols
Warning
We are still working on some of the code actions. If a code actions is missing you really want, request the feature here. This helps us to prioritize the most requested features first.
Solution
Code actions can be run using the vim.lsp.buf.code_action()
but if you want to perform a specific code action, you can use following.
vim.lsp.buf.code_action({
context = { only = { "<code_action>" } },
-- ^^^^^^^^^^^^^ Replace the actual code action you want to perform
apply = true,
-- ^^ if there is only one action, directly apply it without selection prompt
})
quickassist
refactor.assign.field
refactor.assign.variable
refactor.change.signature
refactor.extract.constant
refactor.extract.field
refactor.extract.function
refactor.extract.interface
refactor.extract.variable
refactor.introduce.parameter
refactor.move
source.generate
source.generate.accessors
source.generate.constructors
source.generate.delegateMethods
source.generate.finalModifiers
source.generate.hashCodeEquals
source.generate.toString
source.organizeImports
source.overrideMethods
source.sortMembers
Following will set leader + c + o.
By registering the keymap on jdtls
on_attach
event, we can make sure it's only added within Java projects.
vim.keymap.set('n', '<leader>co', function()
vim.lsp.buf.code_action({
context = { only = { 'source.organizeImports' } },
apply = true,
})
end)