Commit Graph

1226 Commits

Author SHA1 Message Date
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
Nolan Prochnau
486a6489c4 fix(builtin.commands): don't remap for feedkeys (#3087) 2024-05-03 01:28:13 +00:00
Kevin Traver
2d0d057791 fix(picker): notify on empty quickfix and loclist (#3082) 2024-05-01 02:26:27 +00:00
Michael
35f94f0ef3 feat: expand path_display function return type (#3074)
* feat: support path_style in path_display option

* docs: document second value

* tests: add test

* tests: handle function in assert_path

* docs: more explanation

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

---------

Co-authored-by: James Trew <66286082+jamestrew@users.noreply.github.com>
2024-04-26 00:25:42 +00:00
AoMe · 青目
1084d07cf4 fix(buffer_previewer): no preview showing when set nomodifiable (#3077)
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.
2024-04-26 00:26:17 +02:00
James Trew
7d1698f3d8 fix(utils): transform_path always return styling (#3067)
* fix(utils): transform_path always return styling

* fix docs/type hints

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

---------

Co-authored-by: Github Actions <actions@github>
2024-04-21 02:14:52 +00:00
Anton
ef75145f80 fix(utils): transform_path filename_first composability (#3065)
* Moves filename_first to last position to fix issues with composing other options

* Adds comment
2024-04-20 22:59:36 +00:00
Anton
a4432dfb9b feat(entry_maker): add 'filename_first' option for path_display (#3010)
* 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>
2024-04-20 04:21:35 +00:00
James Trew
d00d9df48c fix(which_key): close window on mouse click action (#3053)
* 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>
2024-04-16 01:03:24 +00:00
Mohamad Sulton Hasanuddin
a3284957d3 fix(which_key): increase zindex for popup window (#3046) 2024-04-15 23:46:49 +00:00
James Trew
4d4ade7f2b build: rework ci tests to include windows (#3011) 2024-04-13 17:27:53 +02:00
James Trew
5a701e9990 fix(actions): set function name for generate.which_key (#3044)
Using anonymous function is throwing warning "No name available for
anonymous functions" when `action_generate.which_key` is used as shown
in the docs.
2024-04-10 01:26:51 +00:00
gzbfgjf2
d26b666b45 fix(marks): preserve uri filenames with path_expand (#3029) 2024-04-05 01:03:48 +00:00
Hannu Hartikainen
4626aaa2bc fix(scrolling): enhance and simplify scrolling (#3028)
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.
2024-04-02 13:36:54 +00:00
Sofronie Cristian
1bb28df3cf feat(actions): support scrolling and selecting with the mouse (#2687)
* 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>
2024-03-30 04:05:03 +00:00
James Trew
b22e6f6896 test(utils): add unit test for transform_path (#3013) 2024-03-28 03:39:14 +00:00
Edwin Tang
c2b8311dfa fix(previewer): preview message out of bounds (#3003)
* 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.
2024-03-24 03:51:21 +00:00
James Trew
1e59188575 fix(utils.path_expand): improve windows support (#2999)
In order to maintain plenary compatibility (for now, and slightly for
other edgecase reasons), avoid converting backslashes to forward
slashes.
2024-03-23 03:56:56 +00:00
James Trew
221778e93b fix(previewer): don't escape paths for fs_stat (#2996)
`vim.loop.fs_stat` takes file paths literally so no escaping special
characters are need (eg spaces, `$`, etc)
2024-03-21 01:19:17 +00:00
JINNOUCHI Yasushi
f06eeb79e1 feat: detect upper case letters with get_substr_matcher (#2950)
* feat: detect upper case letters by substr matcher

* test: add tests for get_substr_matcher
2024-03-20 14:24:31 +09:00
James Trew
3b8399c273 fix: expand/normalize paths more selectively (#2628) 2024-03-19 22:55:27 +00:00
James Trew
c816406bd5 fix(builtin.lsp): bad check for jump_type option (#2991) 2024-03-18 15:39:57 +00:00
James Trew
5730b950d9 fix(builtin.lsp): extra No Name buffer opening with jump_type (#2990) 2024-03-18 13:41:56 +00:00
James Trew
1fa3b801f0 docs(builtin.colorscheme): add colors option desc (#2989)
* docs(builtin.colorscheme): add `colors` option desc

* docgen plz
2024-03-18 02:05:26 +00:00
James Trew
8cd58c6e81 fix(lsp): incoming/outgoing_call range locations (#2985)
Previous implementation uses the incorrect lsp result fields for
generating call site locations resulting in incomplete and incorrect
results.
2024-03-18 01:09:56 +00:00
fcying
04dfe370b0 fix: remove duplicate lazyloaded items in colorscheme (#2951) 2024-03-18 00:28:10 +00:00
0x7a7a
e9e01d6998 fix: select correct results row with sorting_strategy=ascending (#2986) 2024-03-15 20:16:51 +00:00
Vurtune
7472420f87 fix(action.toggle_prompt_position): add fallback old position (#2974)
`action_layout.toggle_prompt_position` old_pos deals with nil value at first declaration when prompt_position is set to top in flex layout_strategy
2024-03-07 22:10:20 +00:00
James Trew
dc1ea28cc2 Revert "fix(picker): actually set prompt win to text wrap (#2930)" (#2967)
This reverts commit 52190bd8f9.
2024-03-04 06:59:31 +01:00
Jan Steinke
13c1436932 feat(previewer): use treesitter for highlights, regex fallback (#2971)
* don't force regex highlighting

* forwards opts
2024-03-03 22:23:28 +00:00
James Trew
aa83606299 fix(config): set default cache_picker.ignore_empty_prompt to false (#2962) 2024-03-01 18:09:04 +00:00
Pou Yan
5f5fc3aa75 fix(picker): wrap vim.fn.expand cword in pcall to avoid Vim:E348 (#2961)
* 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>
2024-02-29 11:59:47 +00:00
James Trew
d5c4d98563 doc(config): fix default for cache_picker.ignore_empty_prompt (#2957) 2024-02-28 01:00:20 +00:00
Liu
2e1e382df4 feat(action): add type into qf entry when calling entry_to_qf function (#2897) 2024-02-24 15:24:24 +01:00
Damjan 9000
6868df51d2 feat(bultin.buffer): add select_current option (#2918) 2024-02-24 15:21:25 +01:00
James Trew
52190bd8f9 fix(picker): actually set prompt win to text wrap (#2930) 2024-02-24 15:12:39 +01:00
Kushashwa Ravi Shrimali
e9fd72bdb8 feat: only cache picker if the prompt is non empty; support last non-empty search instead (#2817) 2024-02-24 15:05:48 +01:00
James Trew
955e50dfed feat(git_files): support emoji/unicode in filenames (#2943)
Pass `core.quotepath=false` to achieve this.

Could alternatively pass `-z` but that uses `\0` line termination and
complicates things.

Closes #2900
2024-02-24 01:28:29 +00:00
James Trew
fa81a4b133 fix(picker): prevent status text from hiding prompt (#2936)
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.
2024-02-24 01:10:33 +00:00
James Trew
12e42a3625 fix(current_buffer_fuzzy_find): error on select (#2942)
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.
2024-02-24 01:08:59 +00:00
James Trew
a5b69afa48 refactor(lsp): consolidate some picker jump logic (#2935) 2024-02-23 03:15:55 +00:00
Pedro Ferrari
b744cf5975 fix(git_branch): previewer commit hash dynamic highlighting (#2921)
* Fix highlight of commit hash in git branches preview

* Update lua/telescope/previewers/buffer_previewer.lua

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

---------

Co-authored-by: James Trew <66286082+jamestrew@users.noreply.github.com>
2024-02-17 01:44:31 +00:00