Commit Graph

1212 Commits

Author SHA1 Message Date
Cameron Ring
f8985648e0 fix(picker): delete selection in disjointed finder results (#3266)
ipairs won't find find all results if entry_maker happens to return
nil for a line.
2024-09-12 00:32:38 +00:00
James Trew
fe999db6e0 fix(previewers): limit git log entries to prevent fork bomb (#3287)
Adds `--max-count=1000` flag to the `git log` command in the
`git_branch_log` previewer. This prevents potential fork bombing
issues with large repositories.
2024-09-11 00:11:39 +00:00
MarcusGrass
5972437de8 fix(term_previewer): ensure terms are closed (#3225) 2024-08-15 01:50:24 +00:00
James Trew
cac2494a6e fix(term_preview): bad bat command generation (#3256)
Using `bat` would result in the command being a nested list.

eg. using `:Telescope plaents` with `bat` installed
```
{
  "bat",
  { "--pager", "less -RS" },
  "--style=plain",
  "--color=always",
  "--paging=always",
  "--",
  "/home/jt/projects/telescope.nvim/data/memes/planets/earth",
}
```

This would cause `vim.fn.termopen` to throw an error as the command is
expected to be a flat list or string.
2024-08-15 01:44:40 +00:00
James Trew
68a6d8e8a0 fix(term_previewer): save state from opt.setup call (#3254)
The merged table return from `vim.tbl_deep_extend` was not being
utilized/assigned.
2024-08-14 02:17:32 +00:00
James Trew
159b8b7966 fix(buffer_previewer): save state from opt.setup call (#3253)
The merged table return from `vim.tbl_deep_extend` was not being
utilized/assigned.
2024-08-14 01:44:42 +00:00
James Trew
43c47ebc49 fix(lsp): support multiple servers for dynamic symbols (#3248) 2024-08-13 01:33:53 +00:00
Ronan Dalton
3bb24bb6a9 fix(builtin.colorscheme): improve enable_preview behavior (#3244)
* fix(builtin.colorscheme): don't preview colors when enable_preview=false

* fix(builtin.colorscheme): update preview on mouse click
2024-08-13 01:30:48 +00:00
Enric Lluelles
3b1600d0fd feat(lsp): support requests to many servers for some pickers (#3211)
* Implement list_or_jump_all and use it

* Update lua/telescope/builtin/__lsp.lua

Co-authored-by: James Trew <66286082+jamestrew@users.noreply.github.com>

* Make list_or_jump listen to multiple lsps at once

* Don't fail early if an lsp errors

---------

Co-authored-by: James Trew <66286082+jamestrew@users.noreply.github.com>
2024-08-02 01:12:41 +00:00
James Trew
10b8a82b04 docs(previewer): term_preview env option (#3226)
* docs(previewer): term_preview `env` option

* [docgen] Update doc/telescope.txt
skip-checks: true

---------

Co-authored-by: Github Actions <actions@github>
2024-07-26 03:29:57 +00:00
MarcusGrass
3264f0ae9d feat(previewer): allow passing env to new_termopen_previewer (#3224)
* Allow passing env through term opts

* Add doc update
2024-07-26 03:25:46 +00:00
James Trew
47ab113de5 fix(builtin.builtin): schedule opening next picker (#3222)
Without scheduling, lots of vim state will be related to the builtin
picker when the new picker is opened despite closing the builtin picker
first and then opening a new picker.

This impacts state like `vim.fn.mode()`. If the builtin picker was
closed in insert mode, the closing action _should_ put you back in
normal mode. But without scheduling, the next picker is opened before it
does. So doing `vim.fn.mode()` in the subsequent picker will tell you,
you're still in insert mode. Typically, when chaining pickers, you want
the pre-telescope state, making the transitions between pickers
seemless.
2024-07-25 01:43:14 +00:00
Dhananjay
d39ad2acde fix(edit action): update jumplist when moving in same file (#3205)
C-o behaves unintuitively when same file is selected at different
position.
2024-07-25 01:11:02 +00:00
James Trew
bc4e7e4503 fix(current_buffer_fuzzy_find): push cursor on edit (#3219)
Setting `push_cursor_on_edit = true` wasn't actually doing anything as
the picker replaces `select_default`.

Instead, call `normal! m'` manually in the replacement `select_default`.
2024-07-24 03:22:00 +00:00
James Trew
d54578395a fix(actions.insert_symbol): schedule to insert at correct position (#3218) 2024-07-24 01:23:46 +00:00
OKURA Masafumi
79552ef848 docs: mention default value of follow option for find_files (#3209)
https://github.com/nvim-telescope/telescope.nvim/blob/master/lua/telescope/builtin/__files.lua#L298

It seems the default value is `false`, and unlike other options, the default value of `follow` option is not mentioned.
2024-07-20 14:11:14 +00:00
James Trew
bfcc7d5c6f fix(action.delete_buffer): improve behavior with splits (#3194)
Previously, when having window splits, with deleting a buffer involving
deleting a window, getting the jumplist for said deleted window would
result in an invalid jumplist. Trying to iterate over this invalid
jumplist would error out.

When there are split, there's no need to find a valid buffer to switch
the current window to (as the window is deleted). Instead, what's needed
is the updating of telescope's `picker.original_win_id` state. This is
important for when chaining buffer deletes (ie. closing many splits).

Also improve behavior when the "current" buffer is the only valid buffer
-> it will now open an empty buffer (same as when doing `:bdelete`).
2024-07-01 19:06:50 +00:00
Aaron
816dff9bbf feat(layout_config): add anchor_padding option (#3035) 2024-06-27 00:47:23 +00:00
James Trew
61a4a61536 fix(lsp): if_nil <0.10 compat (#3184) 2024-06-25 10:30:33 -04:00
James Trew
58ec6eca1c fix(builtin.lsp): respect file_ignore_patterns opt for direct jumps (#3173) 2024-06-25 03:15:17 +00:00
ash
af78ba3b7d fix(builtin): grep/treesitter push cursor on edit (#3175)
* fix(builtin.live_grep, builtin.treesitter): not adding jumps to jumplist

Whenever a picker, that can jump to a different location in the same buffer does so it should have `push_cursor_on_edit` otherwise the jump won't be recorded.

Maybe this affects other pickers too, but I only noticed it on grep and treesitter since I use those two a lot.

* fix(builtin.grep_string): not adding jumps to jumplist
2024-06-25 03:13:53 +00:00
James Trew
c392f1b78e fix(builtin.buffers): missing return in attach_mappings (#3172) 2024-06-15 18:40:26 +00:00
James Trew
979bfa2c44 feat(builtin.buffers): enhance and bind delete_buffer action (#3145)
* feat(builtin.buffers): enhance and bind `delete_buffer` action

* change default bind and add docs

* [docgen] Update doc/telescope.txt
skip-checks: true

---------

Co-authored-by: Github Actions <actions@github>
2024-06-15 14:24:18 +00:00
Chris Grieser
77cab9ad63 feat(builtin.colorscheme): add option ignore_builtins (#3155) 2024-06-15 15:29:34 +02:00
Ronan Dalton
19584e666f fix(layout_strategies): odd flex layout default behavior, previewer hidden at certain widths (#3148) 2024-06-15 15:25:51 +02:00
Simon Hauser
ae4420758e chore: don't construct add offset every time merge_styles is called (#3169) 2024-06-15 15:13:06 +02:00
Anton
25f04509f7 feat: refactors transform_path and allow smart to be used in conjunction with filename_first (#3152) 2024-06-15 14:57:24 +02:00
Axel Dahlberg
f12b15e1b3 feat(lsp): notify list_or_jump when no results (#3158) 2024-06-09 14:10:46 +00:00
Yeri Pratama
7231b52276 fix(buffers): select_current not selecting current buffer index (#3147)
Co-authored-by: Yeri <yeri@accelbyte.net>
2024-06-09 14:09:00 +00:00
Lonzo_ghf
3a743491e5 fix(lsp.reference): only filter the current line of the current filname (#3154)
* fix(lsp.reference): Only filter the current line of the current filname

fix(lsp.reference): Only filter the current line of the current filname when include_current_line=false

* fix(lsp.reference): Only filter the current line of the current filname

* run stylua

---------

Co-authored-by: James Trew <j.trew10@gmail.com>
2024-06-08 02:32:45 +00:00
Lawrence Ho
dfa230be84 fix(lsp): handle URI in item_to_location (#3144) 2024-05-29 19:24:09 +02:00
James Trew
127159a52f fix(lsp.reference): single reference direct jump (#3137)
* fix(lsp.reference): single reference direct jump

* [docgen] Update doc/telescope.txt
skip-checks: true

---------

Co-authored-by: Github Actions <actions@github>
2024-05-29 01:34:22 +00:00
Xavier Young
2df52609a1 feat(picker): allow appending original window <cWORD>, <cfile> and cursor line to prompt (#3134) 2024-05-27 23:02:25 +02:00
James Trew
4c96370cf9 fix(make_entry): improve filename_first support (#3140)
Few pickers with entry makers that relied on `entry_display.create` were
not properly passing the highlight table returned by `transform_path`.
This made the `filename_first` `path_display` option not work as
expected for these pickers.
2024-05-27 01:50:31 +00:00
xudyang1
349660c0d3 fix(pickers): improve CRLF line splitting support for windows (#3127)
* fix(help_tags): show help tags on windows (#3126)

On Windows, `builtin.help_tags` picker does not show any help tags.

To fix this, the following changes are needed:

1. `util.path_tail` checks unix separator `/` on Windows and leave the
original implementation intact on unix systems.

2. Line endings should be taken carefully on Windows. `vim.split` with
   only newline `\n` character as separator may result in unexpected
   crash when parsing large files. When splits on lines are needed, call
   it with `\r?\n`, or even set up a wrapper function in utils is more
   prefered.

Fixes #3126

* fix: handle cross platform line splits
2024-05-26 14:15:31 +00:00
Tristan Knight
5665d93988 fix(builtin.spell_suggest): ciw into black hole register (#3124) 2024-05-23 02:41:23 +00:00
Max Jendruk
05f4d6f0a9 feat(builtin.treesitter): add symbol_width opt (#3105)
* 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
2024-05-23 01:50:14 +00:00
Christian Clason
0c12735d5a fixup: adapt to deprecations in Nvim 0.10 (#3113)
vim.iter.flatten() is not a full replacement (does not support arrays
with `nil`); a fix may be backported but for now only use it on nightly
(0.10 has no warnings yet).
2024-05-17 20:02:19 +02:00
Christian Clason
33f04c3a86 fixup: adapt to deprecations in Nvim 0.10 (#3112) 2024-05-17 18:10:21 +02:00
Christian Clason
bbdbb7593f fix: adapt to Nvim deprecations in 0.10 (#3109) 2024-05-17 14:39:12 +02:00
DevFortunato
96610122a4 fix(builtin.colorscheme): preview colorscheme without previewer (#3097)
* fix: enable_preview true

* fix: remove buflisted check and colorscheme command in the buffer previewer

---------

Co-authored-by: nobrain <moviemaker@alfonso>
2024-05-17 03:08:28 +00:00
James Trew
ccaeeb5af5 fix(builtin.buffers): previews with specified cwd option (#3111)
Currently, the buffer name is normalized to the `cwd` option value.
This buffer name is then used as the filename, which is used as the file
path for the previewer. But if the `cwd` value is not the actual cwd,
the buffer path can no longer be found by the previewer (relative to the
true cwd).

This is fixed by adding a `path` value to the entry that's the full path
of the buffer. The previewer will then use this full path to find the
file to preview.
2024-05-17 02:55:28 +00:00
James Trew
52f500110b fix(picker): set current_line state earlier (#3052)
Sets the `current_line` global state earlier in the event loop rather
than in `get_results_completor`. This makes it safer to access
`current_line` earlier (eg. for building an entry).
2024-05-16 01:09:10 +00:00
James Trew
6f6bb80655 Revert "refactor(lsp): simplify list_to_jump (#3099)" (#3101)
This reverts commit e9be6bb7a7.
2024-05-14 14:34:00 +00:00
James Trew
e9be6bb7a7 refactor(lsp): simplify list_to_jump (#3099)
* refactor(lsp): simplify `list_to_jump`

* [docgen] Update doc/telescope.txt
skip-checks: true

---------

Co-authored-by: Github Actions <actions@github>
2024-05-14 04:10:11 +00:00
Kira Kawai
29fddf76bc fix(checkhealth): windows binary existence check (#3093)
* 🐛 Windows: allow binary without extension

* show `(unknown version)` if parse failed

Co-authored-by: James Trew <66286082+jamestrew@users.noreply.github.com>

---------

Co-authored-by: ras0q <ras0q@users.noreply.github.com>
Co-authored-by: James Trew <66286082+jamestrew@users.noreply.github.com>
2024-05-14 04:04:26 +00:00
James Trew
c8b69caae5 fix(lsp): add missing offset_encoding param (#3098) 2024-05-14 02:54:56 +00:00
Adrian Göransson
df4dd3089d fix(lsp.references): include_current_line option regression (#3091)
* Fix jump regression in LSP references action handler

This change restores the possibility to exclude the current line when
invoking the lsp_references picker.

- opts.include_current_line is by default unset, so the previous
  equality check would fail unless the option was set explicitly.
- vim.api.nvim_win_get_cursor() returns both line and column, so it
  can't be directly compared with the returned line number.
- The actual comparison was expecting quickfix-like items, when in
  actuality, we were dealing with raw LSP location objects.

* lsp: Pass offset_encoding to action_handlers

* LSP: Action handlers take both locations and items

* LSP: Rename (flattened_)results → locations

* LSP: Early return in list_or_jump
2024-05-14 02:27:57 +00:00
Christoph Bier
02a60a8396 fix(builtin.oldfiles): fix cwd_only for windows (#3096)
Remove backslash escaping in oldfiles picker, which was needed
before the code was changed to use substring comparison instead of
regex matching. (Commit b3ff5f33)
2024-05-12 18:30:53 +00:00
James Trew
fac83a556e fix(previewer): improve binary mime type check (#3083)
* fix(previewer): improve binary mime type check

Problem: mime type for a ts/js file can either return `text/plain` or
`application/javascript` based on the contents of the file.
Previously, this meant `application/javascript` would be considered
"possibly binary". This, in conjunction with how `vim.filetype.match`
does not give a result for a filename that ends in `.ts`, would lead to
a typescript file taking the path of `check_mime_type` and eventually
`mime_hook`.

Solution: Include `application/javascript` as a non-binary file type
during mime type check.

* [docgen] Update doc/telescope.txt
skip-checks: true

---------

Co-authored-by: Github Actions <actions@github>
2024-05-03 01:34:49 +00:00