feat: added trim option to make_entry.gen_from_quickfix (#1838)
This commit is contained in:
@@ -1110,6 +1110,7 @@ builtin.quickfix({opts}) *telescope.builtin.quickfix()*
|
|||||||
|
|
||||||
Options: ~
|
Options: ~
|
||||||
{ignore_filename} (boolean) dont show filenames (default: true)
|
{ignore_filename} (boolean) dont show filenames (default: true)
|
||||||
|
{trim_text} (boolean) trim results text (default: false)
|
||||||
|
|
||||||
|
|
||||||
builtin.loclist({opts}) *telescope.builtin.loclist()*
|
builtin.loclist({opts}) *telescope.builtin.loclist()*
|
||||||
@@ -1122,6 +1123,7 @@ builtin.loclist({opts}) *telescope.builtin.loclist()*
|
|||||||
|
|
||||||
Options: ~
|
Options: ~
|
||||||
{ignore_filename} (boolean) dont show filenames (default: true)
|
{ignore_filename} (boolean) dont show filenames (default: true)
|
||||||
|
{trim_text} (boolean) trim results text (default: false)
|
||||||
|
|
||||||
|
|
||||||
builtin.oldfiles({opts}) *telescope.builtin.oldfiles()*
|
builtin.oldfiles({opts}) *telescope.builtin.oldfiles()*
|
||||||
@@ -1321,6 +1323,7 @@ builtin.tagstack({opts}) *telescope.builtin.tagstack()*
|
|||||||
|
|
||||||
Options: ~
|
Options: ~
|
||||||
{ignore_filename} (boolean) dont show filenames (default: true)
|
{ignore_filename} (boolean) dont show filenames (default: true)
|
||||||
|
{trim_text} (boolean) trim results text (default: false)
|
||||||
|
|
||||||
|
|
||||||
builtin.jumplist({opts}) *telescope.builtin.jumplist()*
|
builtin.jumplist({opts}) *telescope.builtin.jumplist()*
|
||||||
@@ -1332,6 +1335,7 @@ builtin.jumplist({opts}) *telescope.builtin.jumplist()*
|
|||||||
|
|
||||||
Options: ~
|
Options: ~
|
||||||
{ignore_filename} (boolean) dont show filenames (default: true)
|
{ignore_filename} (boolean) dont show filenames (default: true)
|
||||||
|
{trim_text} (boolean) trim results text (default: false)
|
||||||
|
|
||||||
|
|
||||||
builtin.lsp_references({opts}) *telescope.builtin.lsp_references()*
|
builtin.lsp_references({opts}) *telescope.builtin.lsp_references()*
|
||||||
@@ -1347,6 +1351,7 @@ builtin.lsp_references({opts}) *telescope.builtin.lsp_references()*
|
|||||||
lsp references (default: true)
|
lsp references (default: true)
|
||||||
{include_current_line} (boolean) include current line (default:
|
{include_current_line} (boolean) include current line (default:
|
||||||
false)
|
false)
|
||||||
|
{trim_text} (boolean) trim results text (default: false)
|
||||||
|
|
||||||
|
|
||||||
builtin.lsp_definitions({opts}) *telescope.builtin.lsp_definitions()*
|
builtin.lsp_definitions({opts}) *telescope.builtin.lsp_definitions()*
|
||||||
@@ -1362,6 +1367,7 @@ builtin.lsp_definitions({opts}) *telescope.builtin.lsp_definitions()*
|
|||||||
one, values: "tab", "split", "vsplit",
|
one, values: "tab", "split", "vsplit",
|
||||||
"never"
|
"never"
|
||||||
{ignore_filename} (boolean) dont show filenames (default: true)
|
{ignore_filename} (boolean) dont show filenames (default: true)
|
||||||
|
{trim_text} (boolean) trim results text (default: false)
|
||||||
|
|
||||||
|
|
||||||
builtin.lsp_type_definitions({opts}) *telescope.builtin.lsp_type_definitions()*
|
builtin.lsp_type_definitions({opts}) *telescope.builtin.lsp_type_definitions()*
|
||||||
@@ -1377,6 +1383,7 @@ builtin.lsp_type_definitions({opts}) *telescope.builtin.lsp_type_definitions()*
|
|||||||
one, values: "tab", "split", "vsplit",
|
one, values: "tab", "split", "vsplit",
|
||||||
"never"
|
"never"
|
||||||
{ignore_filename} (boolean) dont show filenames (default: true)
|
{ignore_filename} (boolean) dont show filenames (default: true)
|
||||||
|
{trim_text} (boolean) trim results text (default: false)
|
||||||
|
|
||||||
|
|
||||||
builtin.lsp_implementations({opts}) *telescope.builtin.lsp_implementations()*
|
builtin.lsp_implementations({opts}) *telescope.builtin.lsp_implementations()*
|
||||||
@@ -1392,6 +1399,7 @@ builtin.lsp_implementations({opts}) *telescope.builtin.lsp_implementations()*
|
|||||||
only one, values: "tab", "split",
|
only one, values: "tab", "split",
|
||||||
"vsplit", "never"
|
"vsplit", "never"
|
||||||
{ignore_filename} (boolean) dont show filenames (default: true)
|
{ignore_filename} (boolean) dont show filenames (default: true)
|
||||||
|
{trim_text} (boolean) trim results text (default: false)
|
||||||
|
|
||||||
|
|
||||||
builtin.lsp_code_actions({opts}) *telescope.builtin.lsp_code_actions()*
|
builtin.lsp_code_actions({opts}) *telescope.builtin.lsp_code_actions()*
|
||||||
|
|||||||
@@ -240,11 +240,13 @@ builtin.commands = require_on_exported_call("telescope.builtin.internal").comman
|
|||||||
--- Lists items in the quickfix list, jumps to location on `<cr>`
|
--- Lists items in the quickfix list, jumps to location on `<cr>`
|
||||||
---@param opts table: options to pass to the picker
|
---@param opts table: options to pass to the picker
|
||||||
---@field ignore_filename boolean: dont show filenames (default: true)
|
---@field ignore_filename boolean: dont show filenames (default: true)
|
||||||
|
---@field trim_text boolean: trim results text (default: false)
|
||||||
builtin.quickfix = require_on_exported_call("telescope.builtin.internal").quickfix
|
builtin.quickfix = require_on_exported_call("telescope.builtin.internal").quickfix
|
||||||
|
|
||||||
--- Lists items from the current window's location list, jumps to location on `<cr>`
|
--- Lists items from the current window's location list, jumps to location on `<cr>`
|
||||||
---@param opts table: options to pass to the picker
|
---@param opts table: options to pass to the picker
|
||||||
---@field ignore_filename boolean: dont show filenames (default: true)
|
---@field ignore_filename boolean: dont show filenames (default: true)
|
||||||
|
---@field trim_text boolean: trim results text (default: false)
|
||||||
builtin.loclist = require_on_exported_call("telescope.builtin.internal").loclist
|
builtin.loclist = require_on_exported_call("telescope.builtin.internal").loclist
|
||||||
|
|
||||||
--- Lists previously open files, opens on `<cr>`
|
--- Lists previously open files, opens on `<cr>`
|
||||||
@@ -337,11 +339,13 @@ builtin.spell_suggest = require_on_exported_call("telescope.builtin.internal").s
|
|||||||
--- Lists the tag stack for the current window, jumps to tag on `<cr>`
|
--- Lists the tag stack for the current window, jumps to tag on `<cr>`
|
||||||
---@param opts table: options to pass to the picker
|
---@param opts table: options to pass to the picker
|
||||||
---@field ignore_filename boolean: dont show filenames (default: true)
|
---@field ignore_filename boolean: dont show filenames (default: true)
|
||||||
|
---@field trim_text boolean: trim results text (default: false)
|
||||||
builtin.tagstack = require_on_exported_call("telescope.builtin.internal").tagstack
|
builtin.tagstack = require_on_exported_call("telescope.builtin.internal").tagstack
|
||||||
|
|
||||||
--- Lists items from Vim's jumplist, jumps to location on `<cr>`
|
--- Lists items from Vim's jumplist, jumps to location on `<cr>`
|
||||||
---@param opts table: options to pass to the picker
|
---@param opts table: options to pass to the picker
|
||||||
---@field ignore_filename boolean: dont show filenames (default: true)
|
---@field ignore_filename boolean: dont show filenames (default: true)
|
||||||
|
---@field trim_text boolean: trim results text (default: false)
|
||||||
builtin.jumplist = require_on_exported_call("telescope.builtin.internal").jumplist
|
builtin.jumplist = require_on_exported_call("telescope.builtin.internal").jumplist
|
||||||
|
|
||||||
--
|
--
|
||||||
@@ -354,12 +358,14 @@ builtin.jumplist = require_on_exported_call("telescope.builtin.internal").jumpli
|
|||||||
---@param opts table: options to pass to the picker
|
---@param opts table: options to pass to the picker
|
||||||
---@field include_declaration boolean: include symbol declaration in the lsp references (default: true)
|
---@field include_declaration boolean: include symbol declaration in the lsp references (default: true)
|
||||||
---@field include_current_line boolean: include current line (default: false)
|
---@field include_current_line boolean: include current line (default: false)
|
||||||
|
---@field trim_text boolean: trim results text (default: false)
|
||||||
builtin.lsp_references = require_on_exported_call("telescope.builtin.lsp").references
|
builtin.lsp_references = require_on_exported_call("telescope.builtin.lsp").references
|
||||||
|
|
||||||
--- Goto the definition of the word under the cursor, if there's only one, otherwise show all options in Telescope
|
--- Goto the definition of the word under the cursor, if there's only one, otherwise show all options in Telescope
|
||||||
---@param opts table: options to pass to the picker
|
---@param opts table: options to pass to the picker
|
||||||
---@field jump_type string: how to goto definition if there is only one, values: "tab", "split", "vsplit", "never"
|
---@field jump_type string: how to goto definition if there is only one, values: "tab", "split", "vsplit", "never"
|
||||||
---@field ignore_filename boolean: dont show filenames (default: true)
|
---@field ignore_filename boolean: dont show filenames (default: true)
|
||||||
|
---@field trim_text boolean: trim results text (default: false)
|
||||||
builtin.lsp_definitions = require_on_exported_call("telescope.builtin.lsp").definitions
|
builtin.lsp_definitions = require_on_exported_call("telescope.builtin.lsp").definitions
|
||||||
|
|
||||||
--- Goto the definition of the type of the word under the cursor, if there's only one,
|
--- Goto the definition of the type of the word under the cursor, if there's only one,
|
||||||
@@ -367,12 +373,14 @@ builtin.lsp_definitions = require_on_exported_call("telescope.builtin.lsp").defi
|
|||||||
---@param opts table: options to pass to the picker
|
---@param opts table: options to pass to the picker
|
||||||
---@field jump_type string: how to goto definition if there is only one, values: "tab", "split", "vsplit", "never"
|
---@field jump_type string: how to goto definition if there is only one, values: "tab", "split", "vsplit", "never"
|
||||||
---@field ignore_filename boolean: dont show filenames (default: true)
|
---@field ignore_filename boolean: dont show filenames (default: true)
|
||||||
|
---@field trim_text boolean: trim results text (default: false)
|
||||||
builtin.lsp_type_definitions = require("telescope.builtin.lsp").type_definitions
|
builtin.lsp_type_definitions = require("telescope.builtin.lsp").type_definitions
|
||||||
|
|
||||||
--- Goto the implementation of the word under the cursor if there's only one, otherwise show all options in Telescope
|
--- Goto the implementation of the word under the cursor if there's only one, otherwise show all options in Telescope
|
||||||
---@param opts table: options to pass to the picker
|
---@param opts table: options to pass to the picker
|
||||||
---@field jump_type string: how to goto implementation if there is only one, values: "tab", "split", "vsplit", "never"
|
---@field jump_type string: how to goto implementation if there is only one, values: "tab", "split", "vsplit", "never"
|
||||||
---@field ignore_filename boolean: dont show filenames (default: true)
|
---@field ignore_filename boolean: dont show filenames (default: true)
|
||||||
|
---@field trim_text boolean: trim results text (default: false)
|
||||||
builtin.lsp_implementations = require_on_exported_call("telescope.builtin.lsp").implementations
|
builtin.lsp_implementations = require_on_exported_call("telescope.builtin.lsp").implementations
|
||||||
|
|
||||||
--- Lists any LSP actions for the word under the cursor which can be triggered with `<cr>`
|
--- Lists any LSP actions for the word under the cursor which can be triggered with `<cr>`
|
||||||
|
|||||||
@@ -324,6 +324,10 @@ function make_entry.gen_from_quickfix(opts)
|
|||||||
|
|
||||||
local line_info = { table.concat({ entry.lnum, entry.col }, ":"), "TelescopeResultsLineNr" }
|
local line_info = { table.concat({ entry.lnum, entry.col }, ":"), "TelescopeResultsLineNr" }
|
||||||
|
|
||||||
|
if opts.trim_text then
|
||||||
|
entry.text = entry.text:gsub("^%s*(.-)%s*$", "%1")
|
||||||
|
end
|
||||||
|
|
||||||
return displayer {
|
return displayer {
|
||||||
line_info,
|
line_info,
|
||||||
entry.text:gsub(".* | ", ""),
|
entry.text:gsub(".* | ", ""),
|
||||||
|
|||||||
Reference in New Issue
Block a user