Skip to content

Commit 1a6c639

Browse files
feat(telescope): add mappings for specific symbol types in LSP
This commit introduces new key mappings for Telescope to filter document symbols by specific types such as methods, variables, and classes, enhancing the navigation experience by allowing users to efficiently find and access relevant code structures.
1 parent 9b7605d commit 1a6c639

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

init.lua

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,21 @@ require('lazy').setup({
554554
-- Symbols are things like variables, functions, types, etc.
555555
map('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')
556556

557+
map('<leader>dm', function()
558+
require('telescope.builtin').lsp_document_symbols {
559+
symbols = { 'function', 'method' }, -- Sets the query to 'method'
560+
}
561+
end, '[D]ocument [M]ethods')
562+
map('<leader>dv', function()
563+
require('telescope.builtin').lsp_document_symbols {
564+
symbols = 'variable', -- Sets the query to 'method'
565+
}
566+
end, '[D]ocument [V]ariable')
567+
map('<leader>dc', function()
568+
require('telescope.builtin').lsp_document_symbols {
569+
symbols = 'class', -- Sets the query to 'method'
570+
}
571+
end, '[D]ocument [C]lass')
557572
-- Fuzzy find all the symbols in your current workspace.
558573
-- Similar to document symbols, except searches over your entire project.
559574
map('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')

0 commit comments

Comments
 (0)