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`).
* 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
* 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>
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.
* 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
* 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
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).
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.
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).
* 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
Remove backslash escaping in oldfiles picker, which was needed
before the code was changed to use substring comparison instead of
regex matching. (Commit b3ff5f33)
* 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>
Not showing a preview with the new changes in the latest changes of
[plenary.nvim PR
#575](https://github.com/nvim-lua/plenary.nvim/pull/575).
The error occurs when changing from `nomodifiable` to `modifiable`.
Telescope itself works, but the previews don't render.
* Initial commit
* Fixes issue with find_files where devicons where disabled
* Fixes issue with vimgrep where devicons where disabled
* Fixes trailing space for path with only a file name
* Adds test for reverse path_display
* Refactors reverse to filename_first
* Adds tests
* Fixes highlighting
* Fixes linting issues
* Uses trim function
* Fixes issue with highlighting
* Moves local function to utils
* Removes redundant code
* Adds highlighting for gen_from_buffer
* fix formatting
---------
Co-authored-by: alycklama <>
Co-authored-by: James Trew <j.trew10@gmail.com>
* fix(which_key): close window on mouse click action
`nvim_buf_delete` is not allowed during text change or window change.
Window switching with left mouse click was leading to race
condition/error.
* [docgen] Update doc/telescope.txt
skip-checks: true
---------
Co-authored-by: Github Actions <actions@github>
Using anonymous function is throwing warning "No name available for
anonymous functions" when `action_generate.which_key` is used as shown
in the docs.