Commit Graph

138 Commits

Author SHA1 Message Date
Jordan Mandel
78857db9e8 fix(previewer): check bufnr is not nil (#3410) 2025-02-11 21:01:20 +01:00
Cameron Ring
cb3f98d935 fix(highlights): previewer show correct highlight group (#3305)
Fixes a minor bug in the builtin highlights picker where having
`Comment` selected in the picker shows `SpecialComment` in the
previewer. Only happens when the selected highlight is a suffix of
another highlight and the other highlight occurs first.
2024-09-26 00:22:16 +00:00
James Trew
fe999db6e0 fix(previewers): limit git log entries to prevent fork bomb (#3287)
Adds `--max-count=1000` flag to the `git log` command in the
`git_branch_log` previewer. This prevents potential fork bombing
issues with large repositories.
2024-09-11 00:11:39 +00:00
MarcusGrass
5972437de8 fix(term_previewer): ensure terms are closed (#3225) 2024-08-15 01:50:24 +00:00
James Trew
cac2494a6e fix(term_preview): bad bat command generation (#3256)
Using `bat` would result in the command being a nested list.

eg. using `:Telescope plaents` with `bat` installed
```
{
  "bat",
  { "--pager", "less -RS" },
  "--style=plain",
  "--color=always",
  "--paging=always",
  "--",
  "/home/jt/projects/telescope.nvim/data/memes/planets/earth",
}
```

This would cause `vim.fn.termopen` to throw an error as the command is
expected to be a flat list or string.
2024-08-15 01:44:40 +00:00
James Trew
68a6d8e8a0 fix(term_previewer): save state from opt.setup call (#3254)
The merged table return from `vim.tbl_deep_extend` was not being
utilized/assigned.
2024-08-14 02:17:32 +00:00
James Trew
159b8b7966 fix(buffer_previewer): save state from opt.setup call (#3253)
The merged table return from `vim.tbl_deep_extend` was not being
utilized/assigned.
2024-08-14 01:44:42 +00:00
James Trew
10b8a82b04 docs(previewer): term_preview env option (#3226)
* docs(previewer): term_preview `env` option

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

---------

Co-authored-by: Github Actions <actions@github>
2024-07-26 03:29:57 +00:00
MarcusGrass
3264f0ae9d feat(previewer): allow passing env to new_termopen_previewer (#3224)
* Allow passing env through term opts

* Add doc update
2024-07-26 03:25:46 +00:00
xudyang1
349660c0d3 fix(pickers): improve CRLF line splitting support for windows (#3127)
* 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
2024-05-26 14:15:31 +00:00
Christian Clason
bbdbb7593f fix: adapt to Nvim deprecations in 0.10 (#3109) 2024-05-17 14:39:12 +02: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
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
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
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
James Trew
3b8399c273 fix: expand/normalize paths more selectively (#2628) 2024-03-19 22:55:27 +00: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
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
Marco De Donno
236083884c fix: do not alter jumplist when jumping to a line in a file (#2910) 2024-02-04 21:37:33 +00:00
rjooske
e54fbf4ab2 fix(previewer): buffer previews for term not initially scrolled (#2899) 2024-01-29 18:11:46 +00:00
atusy
301505da4b fix(previewer): buffer_previewer_maker now receives all necessary opts everywhere (#2833) 2024-01-23 23:36:00 +01:00
Sebastian Lyng Johansen
b4befa1c2f fix: fallback to filetype for get_lang for treesitter highlighting (#2867) 2024-01-18 11:43:26 +01:00
Dmitriy Kovalenko
0bf09d05ab feat: Support Line Column in file pickers (#2791)
This implements a experimental interface for allowing prompts like this `file.txt:3:4`. It is already enabled on default for `find_files` and `git_files`.

Be wary of breaking changes for the interface if you plan to manually enable it.
2024-01-09 09:35:26 +01:00
Carlos Afonso
b6edf826b4 fix(preview): allow arbitrary horizontal scrolling (#2787) 2023-11-16 01:26:52 +00:00
Garry Filakhtov
4522d7e3ea fix: jumplist picker resume after bwipeout (#2753)
With this change we will check if the provided buffer number is valid,
before querying its `buftype` option. This is necessary, because
currently we would fail with:
```
Error executing vim.schedule lua callback:
...scope.nvim/lua/telescope/previewers/buffer_previewer.lua:473:
Invalid buffer id: X
```
error, if we try to resume a jumplist picker after doing `:bwipeout`.
2023-10-23 14:19:17 +02:00
Frantisek Stanko
a62db885fd fix: do not send data to closed stream (#2746)
This commit fixes the following error:

E5108: Error executing lua: Vim:Can't send data to closed stream
stack traceback:
[C]: in function 'chansend'
/lua/telescope/previewers/term_previewer.lua:224: in function '_send_input'
/lua/telescope/previewers/previewer.lua:85: in function 'send_input'
/lua/telescope/previewers/term_previewer.lua:238: in function '_scroll_fn'
/lua/telescope/previewers/previewer.lua:93: in function 'scroll_fn'
/lua/telescope/actions/set.lua:249: in function 'run_replace_or_original'
/lua/telescope/actions/mt.lua:65: in function 'scroll_previewer'
/lua/telescope/actions/init.lua:222: in function 'run_replace_or_original'

This happens when previewers.new_termopen_previewer()'s get_command()
ends without pagination.
2023-10-23 09:44:27 +02:00
LW
8c69f58427 feat(preview)!: add opts.preview.highlight_limit with default 1MB (#2715) 2023-10-02 17:51:34 +02:00
Munif Tanjim
84d53dfdbe feat(pickers): fully customizable layout (#2572) 2023-09-27 08:34:22 +02:00
Luis
22735947d8 feat: highlight range in grep buffer previewer (#2611) 2023-07-27 09:24:50 +02: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
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
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
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
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
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
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
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
James Trew
40c31fdde9 feat(previewer): add option for ls --short (#2486)
Co-authored-by: Github Actions <actions@github>
2023-05-16 09:02:09 +03:00
KevinSilvester
89c67676a8 fix(preview): update mime-type check for json files (#2221) (#2480) 2023-05-14 22:04:34 +02:00
Zoe Roux
eba418cca7 fix: make git_status diff works with staged files (#2421) 2023-03-21 13:33:08 -04:00
Kalka
65287605c3 fix: wrap nvim_buf_set_option in a protected call (#2346) 2023-01-30 22:06:47 +01:00
vladislav doster
dce1156ca1 docs: telescope.nvim spelling and grammar fixes (#2325)
Corrects the following issues:
- article agreement
- spelling
2023-01-22 10:07:45 +01:00