Commit Graph

1137 Commits

Author SHA1 Message Date
Michael Henry
f78d956901 fix: preserve queued keys at picker launch (#2274) (#2618)
Ensure that any keystrokes that are queued at picker launch are processed only
after the picker's mode (`insert` or `normal`) has been chosen, preserving
their intended meaning.

Previously the picker's mode was set by simulating keystrokes via `feedkeys()`.
In the absence of queued keystrokes, this works fine; but if the user is able
to queue keystrokes before the call to `feedkeys()`, those queued keystrokes
are processed before the simulated keystrokes that change the picker's mode.
Because of this unexpected ordering, the user's queued keystrokes may appear to
be ignored or may cause the picker to start in the wrong mode.

For example, consider the below normal-mode mapping:
```vim
:nnoremap <space>ff :Telescope find_files<CR>
```

Upon launching the picker via `<space>ff`, Neovim is already in normal mode.
To switch to insert mode in the picker, Telescope previously used a call to
`feedkeys("A")`, simulating a keypress of `A` to enter insert mode at the end
of the current line.  This `A` will not be processed until all previously
queued user keystrokes have been processed, causing issues.

In real-world use, problems occur when the user types `<space>ff` followed
quickly by characters intended as fuzzy match text.  This can be demonstrated
using `feedkeys()` as shown below.

```vim
:call feedkeys("\<space>ff" . "apple")
```

The user intended to search for `apple`, but the `a` is mis-interpreted as a
request to enter insert mode at end of line, after which `pple` is inserted;
subsequently, Telescope's simulated `A` is then appended, resulting in a search
string of `ppleA`.

Using `:startinsert!` (to enter insert mode as if by `A`) or `:normal! $` (to
enter normal mode and move to end-of-line) avoids interfering with the user's
queued keys.

Fixes #2274.
2023-07-22 21:27:22 +00:00
James Trew
7bb2fcecdc Revert "expand paths more smartly (#2599)" (#2615)
This reverts commit f52ea4061d.
2023-07-21 21:50:44 -04:00
James Trew
f52ea4061d expand paths more smartly (#2599) 2023-07-21 22:12:29 +00:00
Andrii Berezhynskyi
597a3cc889 fix: do not ignore mappings from setup() when attach_mappings provided (#2613) 2023-07-21 09:28:26 -04:00
TJ DeVries
47c755d737 fix: handle non-file uris for lsp (#2604) 2023-07-17 13:20:09 -04:00
James Trew
2ea8dcd17b feat(git): support detached working trees (#2597)
* feat(git): support detached working trees

closes #2595

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

* fix: use_file_path

---------

Co-authored-by: Github Actions <actions@github>
2023-07-14 17:12:03 +00:00
Folke Lemaitre
276362a802 feat(lsp): added support for dynamic capabilities (#2594) 2023-07-06 18:30:43 -04:00
Stanislav Asunkin
0e0600908d fix: fix builtins lazy loading (#2590) 2023-07-02 21:51:55 +02:00
James Trew
b14de80d1c refactor(previewer): clean up file_maker (#2585)
- split apart functions
- replace magic numbers with named constants
- reorganize functions for better grouping
2023-07-01 17:57:00 +00:00
Oscar
6074847b6e Fix tagrelative option not considered in builtin.tags (#2583)
* Fix tagrelative option not considered in builtin.tags

* Fix wrong notify name

* ctags filtering with grep or rg and normalize path

* pass stylua check

---------

Co-authored-by: James Trew <j.trew10@gmail.com>
2023-06-25 19:16:15 +00:00
Nghia Le Minh
219584a6ef fix(lsp_dynamic_workspace_symbols): add prefilter as per documentation (after to_fuzzy_refine) (#2584)
* fix(lsp_dynamic_workspace_symbols): add prefilter as per documentation (after to_fuzzy_refine)

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

* docs grammar

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

---------

Co-authored-by: Github Actions <actions@github>
Co-authored-by: James Trew <j.trew10@gmail.com>
2023-06-24 22:11:35 +00:00
Lucía Andrea Illanes Albornoz
5fff2a138b Implements horizontal scrolling in previewer & results. (#2437)
* Implements horizontal scrolling in previewer & results.

* docs: update wrt. horizontal scrolling in previewer &  results
2023-06-24 19:17:55 +00:00
James Trew
ffe35cb433 fix(live_grep/grep_string): support non-utf8 patterns (#2570) 2023-06-21 21:25:35 +00:00
Simon Hauser
00cf15074a fix(previewer): dont treat unknown filetypes as binary file (#2567) 2023-06-13 02:09:13 +00:00
Liam Jarvis
37c5268578 fix(previewer): Cast filepath to string before matching for filetype (#2565) 2023-06-11 08:31:19 +02:00
Simon Hauser
89ca726572 refactor(previewer): remove with_preview_window (#2563) 2023-06-10 21:01:23 +02:00
Simon Hauser
116dbea580 fix(previewer): call fthook after we determined the filetype (#2560) 2023-06-10 15:55:43 +02:00
Simon Hauser
69e8715786 fix(previewer): only run ftdetect for files (#2559) 2023-06-09 18:51:17 +02:00
Simon Hauser
8c998877f1 fix(previewer): ft detect for filetypes defined as functions (#2557) 2023-06-09 12:42:21 +02:00
Simon Hauser
66b03e7740 feat!(previewer): replace plenary.filetype with vim.filetype.match (#2529) 2023-06-09 11:24:52 +02:00
Simon Hauser
42267407ae fix(actions): which_key after mappings rework (#2556) 2023-06-08 23:10:26 +02:00
Simon Hauser
991d5db624 refactor(mappings): use vim.keymap and remove __TelescopeKeymapStore (#2551) 2023-06-08 20:28:10 +02:00
Munif Tanjim
9a82b5b73e fix: use :botright modifier for quickfix window open (#2554) 2023-06-07 23:54:23 +00:00
Kalmander
be49680937 fix(registers): add small delete remove black hole (#2553)
Co-authored-by: Tryggvi Kalman <tryggvikalman@protonmail.com>
2023-06-07 14:59:50 +02:00
Simon Hauser
9e3922f628 fix(mappings): expr for insert mode (#2458) 2023-06-07 11:29:57 +02:00
Zhanibek Adilbekov
333966610c fix(bcommits): wrong selection field is used (#2550) 2023-06-07 11:17:57 +02:00
Simon Hauser
6d3fbffe42 Revert "feat!: allow full height, width by resolving 1 as a percentage rather than absolute val (#2525)"
This reverts commit 066bda8ea4.
2023-05-25 07:44:39 +02:00
Simon Hauser
9cb9648a39 Revert "fix: entry_display width 1, followup to #2508 (#2530)"
This reverts commit 9609686a8c.
2023-05-25 07:44:39 +02:00
Simon Hauser
eb95a31836 Revert "fix: correctly restore cursor position in original window (#2336)" (#2538)
This reverts commit 3f1b57908b.
2023-05-25 07:43:19 +02:00
Simon Hauser
ff8ed2351f fix: make sure that prompt_win is valid bevore closing it (#2533) 2023-05-24 22:15:59 +02:00
Pijus Navickas
109a183045 fix: prevent pfiletype from failing when bufname is nil (#2531)
* Prevent pfiletype from failing when bufname is nil

* Fix code style
2023-05-24 21:42:29 +02:00
Simon Hauser
e943f93a6a fix: make sure buf is valid before updating highlighting (#2524) 2023-05-24 20:28:55 +02:00
Simon Hauser
9609686a8c fix: entry_display width 1, followup to #2508 (#2530) 2023-05-24 17:01:02 +02:00
Simon Hauser
dda9a3965b fix(actions): send_to_* and smart_send_to_* now append to history (#2527) 2023-05-24 15:25:24 +02:00
bn-peters
5b7cedd7f2 feat(builtin): implement filter for keymaps (#2462) 2023-05-24 14:23:08 +02:00
Simon Hauser
19e8a8ae8b fix(finder): followup to #2442, make sure entry is not nil (#2526) 2023-05-24 14:13:50 +02:00
cristiansofronie
3f1b57908b fix: correctly restore cursor position in original window (#2336) 2023-05-24 14:04:27 +02:00
Simon Hauser
066bda8ea4 feat!: allow full height, width by resolving 1 as a percentage rather than absolute val (#2525)
this is technically a breaking change but i doubt anyone uses height/width 1 (absolute value). It makes more sense to treat 1 as 100%
2023-05-24 12:27:19 +02:00
Akin
80eefd8ff0 feat(buffer_previewer): pass file details in TelescopePreviewLoaded autocmd (#2429) 2023-05-24 11:56:49 +02:00
James Trew
c8b65238e8 fix: previewers & entry maker file encoding (#2430) 2023-05-24 11:49:38 +02:00
Andrii Berezhynskyi
18b7479542 feat: add user autocmd TelescopeResumePost (#2433) 2023-05-24 11:41:59 +02:00
William Henrotin
9f501680e5 feat: find git root from current buffer (#2435) 2023-05-24 11:36:37 +02:00
Stef
0b891ec934 fix: always add index to entry (#2442)
59497d6 introduced `sorters.fuzzy_with_index_bias`, which gives a
scoring boost to earlier entries.

However, this sorter relies on an `index` key existing for the entry, which is
only populated by the static finder currently. We should set it from the
other finders, too.

This will allow us to use said sorter everywhere. It will also let us
replicate the behaviour of `fzf --tiebreak=index`:

```
  return pickers.new(opts, {
    finder = finders.new_oneshot_job(...)
    sorter = telescope.extensions.fzf.native_fzf_sorter(),
    tiebreak = function(current_entry, existing_entry, _)
      return current_entry.index < existing_entry.index
    end
  }):find()
```

This gives me better results for my "recently opened files" picker.
Other builtin pickers might benefit from this, too.
2023-05-24 11:29:36 +02:00
暮晨
6dec8cf723 feat(lsp): add 'reuse_win' for reuse window options (#2454) 2023-05-24 11:21:16 +02:00
YAMAMOTO Yuji
a709dbb5d5 feat: open buffers in various directions (#2463)
Fix the problem I reported in <https://github.com/nvim-telescope/telescope.nvim/issues/1725#issuecomment-1502548033>.
Supporting the abbreviations of the commands to specify the direction makes too
many combinations, so I added only their unabbreviated names.

In addition, make the error message more detailed for users that passes
unsupported command.
2023-05-24 11:14:03 +02:00
James Trew
106662e056 feat(diagnotics): add disable_coordinates option (#2477) 2023-05-24 11:05:10 +02:00
Juan Barrios
8dd1cb2771 feat: sorting popup autocomplete items and initial builtin items (#2518) 2023-05-24 11:03:07 +02:00
Azad
233cd6ad0d fix(lsp.definitions): compare file uri with targetUri (#2514) 2023-05-24 10:48:24 +02:00
Christian Clason
d8c5ed4e40 feat(ts)!: use upstream treesitter implementation (#2499)
bumps minimum required neovim version to 0.9, see `help telescope.changelog-2499`
2023-05-24 10:43:04 +02:00
Folke Lemaitre
057ee0f878 fix: icon highlights (broken on nightly) (#2522) 2023-05-23 14:31:04 +02:00