Skip to content

Commit

Permalink
feat(builtin.treesitter): add symbol_width opt (#3105)
Browse files Browse the repository at this point in the history
* Add options to customize length of symbols and line numbers for gen_from_treesitter

* Revert adding symbol_type_width option

* Add docs and type hint
  • Loading branch information
mjendruk committed May 23, 2024
1 parent 4aed639 commit 05f4d6f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions doc/telescope.txt
Original file line number Diff line number Diff line change
Expand Up @@ -970,6 +970,8 @@ builtin.treesitter() *telescope.builtin.treesitter()*
{bufnr} (number) specify the buffer number where
treesitter should run. (default:
current buffer)
{symbol_width} (number) defines the width of the symbol
section (default: 25)
{symbols} (string|table) filter results by symbol kind(s)
{ignore_symbols} (string|table) list of symbols to ignore
{symbol_highlights} (table) string -> string. Matches symbol
Expand Down
1 change: 1 addition & 0 deletions lua/telescope/builtin/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ builtin.fd = builtin.find_files
--- - `<C-l>`: show autocompletion menu to prefilter your query by kind of ts node you want to see (i.e. `:var:`)
---@field show_line boolean: if true, shows the row:column that the result is found at (default: true)
---@field bufnr number: specify the buffer number where treesitter should run. (default: current buffer)
---@field symbol_width number: defines the width of the symbol section (default: 25)
---@field symbols string|table: filter results by symbol kind(s)
---@field ignore_symbols string|table: list of symbols to ignore
---@field symbol_highlights table: string -> string. Matches symbol with hl_group
Expand Down
2 changes: 1 addition & 1 deletion lua/telescope/make_entry.lua
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ function make_entry.gen_from_treesitter(opts)
local bufnr = opts.bufnr or vim.api.nvim_get_current_buf()

local display_items = {
{ width = 25 },
{ width = opts.symbol_width or 25 },
{ width = 10 },
{ remaining = true },
}
Expand Down

0 comments on commit 05f4d6f

Please sign in to comment.