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).
(cherry picked from commit 0c12735d5a)
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.
(cherry picked from commit ccaeeb5af5)
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).
(cherry picked from commit 52f500110b)
Remove backslash escaping in oldfiles picker, which was needed
before the code was changed to use substring comparison instead of
regex matching. (Commit b3ff5f33)
(cherry picked from commit 02a60a8396)
* 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>
(cherry picked from commit fac83a556e)
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.
(cherry picked from commit 1084d07cf4)
* 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>
(cherry picked from commit d00d9df48c)
Using anonymous function is throwing warning "No name available for
anonymous functions" when `action_generate.which_key` is used as shown
in the docs.
(cherry picked from commit 5a701e9990)
* fix(set_preview_message): check line height of previewer before setting message.
* style: run changed file through stylua and remove unused variable.
* refactor: change lines table instead. check max between line_pos and 0
* style: run changed file through stylua.
(cherry picked from commit c2b8311dfa)
In order to maintain plenary compatibility (for now, and slightly for
other edgecase reasons), avoid converting backslashes to forward
slashes.
(cherry picked from commit 1e59188575)
Previous implementation uses the incorrect lsp result fields for
generating call site locations resulting in incomplete and incorrect
results.
(cherry picked from commit 8cd58c6e81)
Pass `core.quotepath=false` to achieve this.
Could alternatively pass `-z` but that uses `\0` line termination and
complicates things.
Closes#2900
(cherry picked from commit 955e50dfed)
`vim.fn.matchstrpos({expr}, {pat})` doesn't handle all characters well
since the pattern (cwd path in this case) is used as a regex pattern.
(cherry picked from commit b3ff5f3320)
Previously, using `string.find`, certain characters were taken as regex
special characters leading to bad matches.
New approach takes bufname truncated to the length of cwd and compares
the two strings.
(cherry picked from commit 8b56e9bb2d)
closes#2843
Previously, bad partial matches between cwd and target buffer path would
result in non-cwd buffers showing up in the picker despite using
`only_cwd=true`.
eg.
cwd = `/foo/bar`
target buffer = `foo/bar1/baz.txt`
The target buffer starts with the cwd path.
This is fixed by appending a path separator before comparing/matching:
eg.
cwd = `/foo/bar/`
target buffer = `foo/bar1/baz.txt`
(cherry picked from commit c621f71012)
* Add autocmd to make `which_key` window close on prompt exit
Currently `actions.which_key` supports a `close_with_action` option
(default true). When this is set, the `which_key` window will close
after any Telescope action is triggered. This makes sense. However, when
it is false, the `which_key` window remains open even after Telescope
closes. This seems like a bug.
This PR fixes this by setting an autocommand when `close_with_action` is
false to close on prompt exit.
* [docgen] Update doc/telescope.txt
skip-checks: true
* Add autocmd to make `which_key` window close on prompt exit
Currently `actions.which_key` supports a `close_with_action` option
(default true). When this is set, the `which_key` window will close
after any Telescope action is triggered. This makes sense. However, when
it is false, the `which_key` window remains open even after Telescope
closes. This seems like a bug.
This PR fixes this by setting an autocommand when `close_with_action` is
false to close on prompt exit.
---------
Co-authored-by: Github Actions <actions@github>
(cherry picked from commit ae6708a90b)