feat(config): make kind filter configurable for telescope/aerial/...
This commit is contained in:
@ -84,6 +84,26 @@ local defaults = {
|
||||
Variable = " ",
|
||||
},
|
||||
},
|
||||
---@type table<string, string[]>?
|
||||
kind_filter = {
|
||||
default = {
|
||||
"Class",
|
||||
"Constructor",
|
||||
"Enum",
|
||||
"Field",
|
||||
"Function",
|
||||
"Interface",
|
||||
"Method",
|
||||
"Module",
|
||||
"Property",
|
||||
"Struct",
|
||||
"Trait",
|
||||
},
|
||||
-- you can specify a different filter for each filetype
|
||||
-- lua = {
|
||||
-- "Function",
|
||||
-- },
|
||||
},
|
||||
}
|
||||
|
||||
M.json = {
|
||||
@ -167,6 +187,17 @@ function M.setup(opts)
|
||||
Util.track()
|
||||
end
|
||||
|
||||
---@param buf? number
|
||||
---@return string[]?
|
||||
function M.get_kind_filter(buf)
|
||||
buf = (buf == nil or buf == 0) and vim.api.nvim_get_current_buf() or buf
|
||||
local ft = vim.bo[buf].filetype
|
||||
if M.kind_filter == false then
|
||||
return
|
||||
end
|
||||
return M.kind_filter[ft] or M.kind_filter.default
|
||||
end
|
||||
|
||||
---@param name "autocmds" | "options" | "keymaps"
|
||||
function M.load(name)
|
||||
local function _load(mod)
|
||||
|
@ -150,42 +150,20 @@ return {
|
||||
{ "<leader>uC", Util.telescope("colorscheme", { enable_preview = true }), desc = "Colorscheme with preview" },
|
||||
{
|
||||
"<leader>ss",
|
||||
Util.telescope("lsp_document_symbols", {
|
||||
symbols = {
|
||||
"Class",
|
||||
"Function",
|
||||
"Method",
|
||||
"Constructor",
|
||||
"Interface",
|
||||
"Module",
|
||||
"Struct",
|
||||
"Trait",
|
||||
"Field",
|
||||
"Property",
|
||||
"Enum",
|
||||
"Constant",
|
||||
},
|
||||
}),
|
||||
function()
|
||||
require("telescope.builtin").lsp_document_symbols({
|
||||
symbols = require("lazyvim.config").get_kind_filter(),
|
||||
})
|
||||
end,
|
||||
desc = "Goto Symbol",
|
||||
},
|
||||
{
|
||||
"<leader>sS",
|
||||
Util.telescope("lsp_dynamic_workspace_symbols", {
|
||||
symbols = {
|
||||
"Class",
|
||||
"Function",
|
||||
"Method",
|
||||
"Constructor",
|
||||
"Interface",
|
||||
"Module",
|
||||
"Struct",
|
||||
"Trait",
|
||||
"Field",
|
||||
"Property",
|
||||
"Enum",
|
||||
"Constant",
|
||||
},
|
||||
}),
|
||||
function()
|
||||
require("telescope.builtin").lsp_dynamic_workspace_symbols({
|
||||
symbols = require("lazyvim.config").get_kind_filter(),
|
||||
})
|
||||
end,
|
||||
desc = "Goto Symbol (Workspace)",
|
||||
},
|
||||
},
|
||||
|
Reference in New Issue
Block a user