Added functionality to view and navigate loclist (#17)
This commit is contained in:
10
README.md
10
README.md
@@ -37,6 +37,9 @@ require('telescope.builtin').lsp_references()
|
||||
|
||||
-- Convert currently quickfixlist to telescope
|
||||
require('telescope.builtin').quickfix()
|
||||
|
||||
-- Convert currently loclist to telescope
|
||||
require('telescope.builtin').loclist()
|
||||
```
|
||||
|
||||
### Example
|
||||
@@ -91,6 +94,13 @@ require'telescope.builtin'.quickfix{
|
||||
}
|
||||
```
|
||||
|
||||
```lua
|
||||
require'telescope.builtin'.loclist{
|
||||
-- See Picker for additional options
|
||||
prompt = 'Loclist'
|
||||
}
|
||||
```
|
||||
|
||||
```lua
|
||||
require'telescope.builtin'.grep_string{
|
||||
-- See Picker for additional options
|
||||
|
||||
@@ -133,6 +133,28 @@ builtin.quickfix = function(opts)
|
||||
}):find()
|
||||
end
|
||||
|
||||
builtin.loclist = function(opts)
|
||||
local locations = vim.fn.getloclist(0)
|
||||
local filename = vim.api.nvim_buf_get_name(0)
|
||||
|
||||
for _, value in pairs(locations) do
|
||||
value.filename = filename
|
||||
end
|
||||
|
||||
local results = utils.quickfix_items_to_entries(locations)
|
||||
|
||||
if vim.tbl_isempty(results) then
|
||||
return
|
||||
end
|
||||
|
||||
pickers.new(opts, {
|
||||
prompt = 'Loclist',
|
||||
finder = finders.new_table(results),
|
||||
previewer = previewers.qflist,
|
||||
sorter = sorters.get_norcalli_sorter(),
|
||||
}):find()
|
||||
end
|
||||
|
||||
builtin.grep_string = function(opts)
|
||||
opts = opts or {}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user