feat: lsp diagnostics and prefiltering by entry attribute (#543)
prefiltering for lsp_document_symbols and lsp_workspace_symbols. example: type `:var:` to show all vars
This commit is contained in:
@@ -64,6 +64,7 @@ builtin.spell_suggest = require('telescope.builtin.internal').spell_suggest
|
||||
builtin.lsp_references = require('telescope.builtin.lsp').references
|
||||
builtin.lsp_document_symbols = require('telescope.builtin.lsp').document_symbols
|
||||
builtin.lsp_code_actions = require('telescope.builtin.lsp').code_actions
|
||||
builtin.lsp_diagnostics = require('telescope.builtin.lsp').diagnostics
|
||||
builtin.lsp_range_code_actions = require('telescope.builtin.lsp').range_code_actions
|
||||
builtin.lsp_workspace_symbols = require('telescope.builtin.lsp').workspace_symbols
|
||||
|
||||
|
||||
@@ -64,7 +64,10 @@ lsp.document_symbols = function(opts)
|
||||
entry_maker = opts.entry_maker or make_entry.gen_from_lsp_symbols(opts)
|
||||
},
|
||||
previewer = conf.qflist_previewer(opts),
|
||||
sorter = conf.generic_sorter(opts),
|
||||
sorter = conf.prefilter_sorter{
|
||||
tag = "symbol_type",
|
||||
sorter = conf.generic_sorter(opts)
|
||||
}
|
||||
}):find()
|
||||
end
|
||||
|
||||
@@ -180,7 +183,32 @@ lsp.workspace_symbols = function(opts)
|
||||
entry_maker = opts.entry_maker or make_entry.gen_from_lsp_symbols(opts)
|
||||
},
|
||||
previewer = conf.qflist_previewer(opts),
|
||||
sorter = conf.generic_sorter(opts),
|
||||
sorter = conf.prefilter_sorter{
|
||||
tag = "symbol_type",
|
||||
sorter = conf.generic_sorter(opts)
|
||||
}
|
||||
}):find()
|
||||
end
|
||||
|
||||
lsp.diagnostics = function(opts)
|
||||
local locations = utils.diagnostics_to_tbl(opts)
|
||||
|
||||
if vim.tbl_isempty(locations) then
|
||||
print('No diagnostics found')
|
||||
return
|
||||
end
|
||||
|
||||
pickers.new(opts, {
|
||||
prompt_title = 'LSP Diagnostics',
|
||||
finder = finders.new_table {
|
||||
results = locations,
|
||||
entry_maker = opts.entry_maker or make_entry.gen_from_lsp_diagnostics(opts)
|
||||
},
|
||||
previewer = conf.qflist_previewer(opts),
|
||||
sorter = conf.prefilter_sorter{
|
||||
tag = "type",
|
||||
sorter = conf.generic_sorter(opts)
|
||||
}
|
||||
}):find()
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user