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.
The previous scrolling implementation (#2687) moved the result selection
by one item at a time, which isn't technically scrolling (ie. moving the
view) and feels quite slow.
Let the neovim builtin scrolling do its thing, so using the scroll wheel
feels like scrolling and is functionally scrolling, too. Scrolling does
not move the selection so after scrolling it typically makes sense to
click. Moving the selection with keyboard takes you back to where you
were. This is in line with typical desktop user interfaces.
* feat(scrolling and mouse support): support scrolling and selecting with the mouse
* fix ascending sorting_strategy mouse clicks
---------
Co-authored-by: James Trew <j.trew10@gmail.com>
* 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.
* fix(picker): wrap vim.fn.expand cword in pcall to avoid Vim:E348: No string under cursor
* run stylua
---------
Co-authored-by: James Trew <j.trew10@gmail.com>
There's a limitation with extmark's `right_align` virtual text and how
it handles side scrolling. This causes text entered to be hidden behind
the virtual text rather than begin the side scroll.
An issue is opened upstream https://github.com/neovim/neovim/issues/27540
But this could take a while before it's fixed as it's considered
`complexity:high`.
This PR adds a temporary workaround of just hiding the status text if the
prompt is long enough to interfere with it.
Previous implementation of placing the cursor on the first column of the
highlight failed to take into account that the highlighter can return
more than one data structure.