Commit Graph

7664 Commits

Author SHA1 Message Date
Justin M. Keyes
ce7017b850
docs: render @see, @note items in _meta/api.lua #30494 2024-09-25 02:34:13 -07:00
Justin M. Keyes
3f6bc34e66
docs: lua error patterns #30240
Co-authored-by: Mathias Fussenegger <f.mathias@zignar.net>
Co-authored-by: Ananth Bhaskararaman <antsub@gmail.com>
2024-09-24 04:46:50 -07:00
Christian Clason
2276743cb8 vim-patch:a7229c8: runtime(rmd,rrst): 'fex' option not properly restored
Add 'fex' to b:undo_ftplugin variable

closes: vim/vim#15728

a7229c8a99

Co-authored-by: John M Devin <john.m.devin@gmail.com>
2024-09-24 09:55:43 +02:00
zeertzjq
d831392b15
feat(paste): unify cancel and error behavior (#30476)
Before this PR, the behavior of nvim_paste is:
- When vim.paste() returns false, return false to the client, but treat
  following chunks normally (i.e. rely on the client cancelling the
  paste as expected).
- When vim.paste() throws an error, still return true to the client, but
  drain the following chunks in the stream without calling vim.paste().

There are two problems with such behavior:
- When vim.paste() errors, the client is still supposed to send the
  remaining chunks of the stream, even though they do nothing.
- Having different code paths for two uncommon but similar situations
  complicates maintenance.

This PR makes both the cancel case and the error case return false to
the client and drain the remaining chunks of the stream, which, apart
from sharing the same code path, is beneficial whether the client checks
the return value of nvim_paste or not:
- If the client checks the return value, it can avoid sending the
  following chunks needlessly after an error.
- If the client doesn't check the return value, chunks following a
  cancelled chunk won't be pasted on the server regardless, which leads
  to less confusing behavior.
2024-09-24 07:14:14 +08:00
Tristan Knight
032e024f8a
fix(filetype): handle .in files with no filename (#30487)
Problem:
fnamemodify with the :r flag will not strip extensions if the filename
starts with a ".". This means that files named ".in" could cause an
infinite loop.

Solution:
Add early return if the filename was not changed
2024-09-24 06:42:16 +08:00
Justin M. Keyes
34a40d3a50
Merge #30435 refactor: rename "Dictionary" => "Dict" 2024-09-23 07:14:10 -07:00
Justin M. Keyes
47e6b2233f
fix(vim.fs): dirname() returns "." on mingw/msys2 #30480
Problem:
`vim.fs.dirname([[C:\User\XXX\AppData\Local]])` returns "." on
mingw/msys2.

Solution:
- Check for "mingw" when deciding `iswin`.
- Use `has("win32")` where possible, it works in "fast" contexts since
  b02eeb6a72.
2024-09-23 06:05:58 -07:00
Justin M. Keyes
737f58e232 refactor(api)!: rename Dictionary => Dict
In the api_info() output:

    :new|put =map(filter(api_info().functions, '!has_key(v:val,''deprecated_since'')'), 'v:val')
    ...

    {'return_type': 'ArrayOf(Integer, 2)', 'name': 'nvim_win_get_position', 'method': v:true, 'parameters': [['Window', 'window']], 'since': 1}

The `ArrayOf(Integer, 2)` return type didn't break clients when we added
it, which is evidence that clients don't use the `return_type` field,
thus renaming Dictionary => Dict in api_info() is not (in practice)
a breaking change.
2024-09-23 14:42:57 +02:00
zeertzjq
5057753431
fix(runtime): treat b:undo_ftplugin consistently in Lua ftplugins (#30473)
- Don't assume b:undo_ftplugin is set when first modifying it.
- Don't assume b:undo_ftplugin already contains some resetting.
2024-09-23 16:49:34 +08:00
Christian Clason
423176db56 vim-patch:be551da: runtime(netrw): remove extraneous closing bracket
fixes: vim/vim#15717
closes: vim/vim#15718

be551dacb8

Co-authored-by: Peter Aronoff <peter@aronoff.org>
2024-09-23 09:30:49 +02:00
Lewis Russell
511b991e66 feat(fs.lua): add vim.fs.rm()
Analogous to the shell `rm` command.
2024-09-22 15:05:24 +01:00
Evgeni Chasnovski
29bceb4f75
docs(api): nvim_get_runtime_file preserves 'runtimepath' order #30454 2024-09-22 03:51:22 -07:00
zeertzjq
ac65e0f04b vim-patch:a0c14ef: runtime(filetype): tests: Test_filetype_detection() fails
Problem:  tests: Test_filetype_detection() fails (after 9.1.0738)
Solution: Add missing filetype detect patterns for *.SYSx and *.MODx

a0c14ef310

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-09-21 20:25:07 +08:00
zeertzjq
d28be6fe69 vim-patch:9.1.0738: filetype: rapid files are not recognized
Problem:  filetype: rapid files are not recognized
Solution: detect '*.sysx' and '*.modx' as rapid filetype
          (KnoP-01)

closes: vim/vim#15669

fdcb08264d

Co-authored-by: KnoP-01 <knosowski@graeffrobotics.de>
2024-09-21 20:24:06 +08:00
zeertzjq
881a58787d
vim-patch:e6b01cf: runtime(dist): do not output a message if executable is not found (#30451)
closes: vim/vim#15705

e6b01cfe01

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-09-21 12:16:28 +00:00
Christian Clason
059a9e6254 vim-patch:50423ab: runtime(java): Optionally recognise _module_ import declarations
Define "g:java_syntax_previews" and include number 476 in
its list to enable this recognition:
------------------------------------------------------------
        let g:java_syntax_previews = [476]
------------------------------------------------------------

Reference:
https://openjdk.org/jeps/476

closes: vim/vim#15709

50423ab808

Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com>
2024-09-21 11:25:41 +02:00
Christian Clason
cd230be918 vim-patch:597aadc: runtime(lyrics): support multiple timestamps in syntax script
Problem:  Multiple timestamps in the same line were not highlighted
Solution: Adapt the syntax to support multiple timestamps

fixes: vim/vim#15703
closes: vim/vim#15707

597aadcf21

Co-authored-by: ObserverOfTime <chronobserver@disroot.org>
2024-09-21 11:25:41 +02:00
Christian Clason
91b7a421ea vim-patch:87b6565: runtime(modconf): remove erroneous :endif in ftplugin
regression introduced in f86568f91848ece0c5da

closes: vim/vim#15704

87b65652e8

Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2024-09-21 11:25:41 +02:00
Christian Clason
b40b22f426 vim-patch:f86568f: runtime(misc): simplify keywordprg in various ftplugins
closes: vim/vim#15696

f86568f918

Co-authored-by: Konfekt <Konfekt@users.noreply.github.com>
2024-09-21 11:25:41 +02:00
Christian Clason
f5883e0d45 vim-patch:2307945: runtime(java): Optionally recognise all primitive constants in _switch-case_ labels
Define "g:java_syntax_previews" and include number 455 in
its list to enable this recognition:
------------------------------------------------------------
	let g:java_syntax_previews = [455]
------------------------------------------------------------

Reference:
https://openjdk.org/jeps/455

closes: vim/vim#15698

23079450a8

Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com>
2024-09-21 11:25:41 +02:00
Christian Clason
674c1aac11 vim-patch:41c7bba: runtime(zsh,sh): set and unset compiler in ftplugin
closes: vim/vim#15699

41c7bbaf8f

Co-authored-by: Konfekt <Konfekt@users.noreply.github.com>
2024-09-21 11:25:41 +02:00
Christian Clason
82f329a41d vim-patch:c18a9d5: runtime(netrw): using inefficient highlight pattern for 'mf'
Fixes E872 too many '(' in highlight pattern for `mf` selection

fixup for vim/vim#15551
closes: vim/vim#15700

c18a9d5835

Co-authored-by: yasuda <yasuda@kyoto-sr.co.jp>
2024-09-21 11:25:41 +02:00
Riley Bruins
052e048db6 fix(treesitter): lint top-level anonymous nodes
**Problem:** Top-level anonymous nodes are not being checked by the
query linter

**Solution:** Check them by adding them to the top-level query

This commit also moves a table construction out of the match iterator so
it is run less frequently.
2024-09-20 08:44:43 +02:00
zeertzjq
f01c764cc6
vim-patch:35699f1: runtime(vim): Update base-syntax, improve folding function matches (#30427)
- Allow function command modifiers.
- Match function bodies starting with empty lines.

Command modifiers reported by @Konfekt.

fixes vim/vim#15671
closes: vim/vim#15674

35699f1749

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2024-09-20 06:59:46 +08:00
Tristan Knight
adbaaa5225
docs(lsp): hover window controls #30347 2024-09-19 08:00:08 -07:00
Justin M. Keyes
84e85aeb10
fix(health): check more "old" files #30421
Problem:

    Node.js provider (optional) ~
    - ERROR Failed to run healthcheck for "provider.node" plugin. Exception:
      …/runtime/lua/provider/node/health.lua:9: attempt to call field 'provider_disabled' (a nil value)

    Perl provider (optional) ~
    - ERROR Failed to run healthcheck for "provider.perl" plugin. Exception:
      …/runtime/lua/provider/perl/health.lua:8: attempt to call field 'provider_disabled' (a nil value)

    Python 3 provider (optional) ~
    - ERROR Failed to run healthcheck for "provider.python" plugin. Exception:
      …/runtime/lua/provider/python/health.lua:226: attempt to call field 'provider_disabled' (a nil value)

    Ruby provider (optional) ~
    - ERROR Failed to run healthcheck for "provider.ruby" plugin. Exception:
      …/runtime/lua/provider/ruby/health.lua:9: attempt to call field 'provider_disabled' (a nil value)

Solution:
Add these files to the runtime sanity check.

fix #29302
2024-09-19 06:34:23 -07:00
zeertzjq
7dbbaaec3f
refactor!: rename 'jumpoptions' flag "unload" to "clean" (#30418)
Follow-up to #29347
2024-09-19 18:05:27 +08:00
Enno
0ba3888474
vim-patch:5036e69: runtime(systemd): allow for overriding systemd ftplugin settings (vim/vim#13373) (#30414)
closes: vim/vim#13357

5036e69852
2024-09-18 19:20:14 +08:00
Justin M. Keyes
ff85e54939
feat(tui): builtin UI (TUI) sets client info #30397
Problem:
The default builtin UI client does not declare its client info. This
reduces discoverability and makes it difficult for plugins to identify
the UI.

Solution:
- Call nvim_set_client_info after attaching, as recommended by `:help dev-ui`.
- Also set the "pid" field.
- Also change `ui_active()` to return a count. Not directly relevant to
  this commit, but will be useful later.
2024-09-18 04:14:06 -07:00
Justin M. Keyes
22553e1f38
docs: graduate tui.txt to "flow layout" #30413 2024-09-18 01:28:00 -07:00
Justin M. Keyes
44afd07443
docs(tui): rename term.txt, nvim_terminal_emulator.txt #30398
Problem:
It has long been a convention that references to the builtin terminal UI
should mention "tui", not "term", in order to avoid ambiguity vs the
builtin `:terminal` feature. The final step was to rename term.txt;
let's that step.

Solution:
- rename term.txt => tui.txt
- rename nvim_terminal_emulator.txt => terminal.txt
- `gen_help_html.lua`: generate redirects for renamed pages.
2024-09-18 00:26:01 -07:00
Christian Clason
22479ce563 vim-patch:f21d28a: runtime(zathurarc): add double-click-follow to syntax script
closes: vim/vim#15688

f21d28a5c7

Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
2024-09-18 09:05:59 +02:00
Gregory Anders
9a3f74c4c7 vim-patch:9.1.0735: filetype: salt files are not recognized
Problem:  filetype: salt files are not recognized
Solution: Detect '*.sls' files as filetype salt,
          include a syntax script (Gregory Anders)

closes: vim/vim#15689

89b9bb4ac8

Co-authored-by: Gregory Anders <greg@gpanders.com>
2024-09-17 14:18:51 -05:00
Gregory Anders
13d6f6cbb2 vim-patch:9.1.0734: filetype: jinja files are not recognized
Problem:  filetype: jinja files are not recognized
Solution: detect '*.jinja' files a jinja filetype,
          include jinja syntax script (Gregory Anders)

related: vim/vim#15689

202c467bb3

Co-authored-by: Gregory Anders <greg@gpanders.com>
2024-09-17 14:17:33 -05:00
glepnir
a0d8c2b86e
docs(eval): update param types of prompt-buffer functions (#30392) 2024-09-16 18:33:35 +08:00
Matěj Cepl
3f15e57b26 feat(vim.ui): configurable "gx" / vim.ui.open() tool
Problem:
User cannot configure the tool used by `vim.ui.open` (or `gx`). With
netrw this was supported by `g:netrw_browsex_viewer`.

Solution:
Introduce `opts.cmd`. Users that want to set this globally can
monkey-patch `vim.ui.open` in the same way described at `:help vim.paste()`.

Fixes https://github.com/neovim/neovim/issues/29488

Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
2024-09-16 11:58:02 +02:00
Christian Clason
a9031cc4a6 vim-patch:5e95c8f: runtime(java): Highlight javaConceptKind modifiers with StorageClass
Stop assigning by default the NonText highlighting group for
javaConceptKind modifiers since its colour is hardly
distinguishable from a background colour for a range of
colour schemes.

fixes vim/vim#15237
related vim/vim#15238
closes: vim/vim#15664

5e95c8f637

Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com>
Co-authored-by: Dexter Gaon-Shatford <dexter@gaonshatford.ca>
2024-09-16 08:16:32 +02:00
Christian Clason
5e7933693b vim-patch:0f5effb: runtime(netrw): delete confirmation not strict enough
fixes: vim/vim#15680

0f5effbd1f

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-09-16 08:16:20 +02:00
Christian Clason
f408603f4f vim-patch:9.1.0731: inconsistent case sensitive extension matching
Problem:  inconsistent case sensitive extension matching
Solution: unify case sensitive extension matching (Evgeni Chasnovski).

There are different approaches of how extensions are matched with
respect to case sensitivity. In particular, '\c' flag is used in pattern
whereas in most places case sensitive matching is guarded behind
`has("fname_case")` condition.

Replace all instances of '\c' with an explicit case sensitive pattern
variants guarded by `has("fname_case")`. Strictly speaking, this is a
breaking change because only two (most common and prevailingly tested)
variants are now matched: upper first letter and upper all letters.

closes: vim/vim#15672

59b089c9df

Co-authored-by: Evgeni Chasnovski <evgeni.chasnovski@gmail.com>
2024-09-16 08:16:07 +02:00
zeertzjq
78b8510933
vim-patch:4d427d4: runtime(vim): Update base-syntax, match Vim9 bool/null literal args to :if/:while/:return (#30391)
Match Vim9 boolean and null literals in expression arguments of :if,
:elseif, :while and :return.

closes: vim/vim#15684

4d427d4cab

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2024-09-15 22:57:16 +00:00
Jaehwang Jung
f2173b1aa2
fix(defaults): cannot remove "How-to disable mouse" menu item #30375 2024-09-14 02:18:38 -07:00
Mathias Fussenegger
8512f669f0 fix(lsp): handle nil bytes in strings
Problem:

The LSP omnifunc can insert nil bytes, which when read in other places
(like semantic token) could cause an error:

    semantic_tokens.lua:304: Vim:E976: Using a Blob as a String

Solution:

Use `#line` instead of `vim.fn.strlen(line)`. Both return UTF-8 bytes
but the latter can't handle nil bytes.

Completion candidates can currently insert nil bytes, if other parts of
Alternative fix to https://github.com/neovim/neovim/pull/30359

Note that https://github.com/neovim/neovim/pull/30315 will avoid the
insertion of nil bytes from the LSP omnifunc, but the change of this PR
can more easily be backported.
2024-09-13 22:34:49 +02:00
Riley Bruins
b9b408a56c
feat(treesitter): start moving get_parser to return nil #30313
**Problem:** `vim.treesitter.get_parser` will throw an error if no parser
can be found.

- This means the caller is responsible for wrapping it in a `pcall`,
  which is easy to forget
- It also makes it slightly harder to potentially memoize `get_parser`
  in the future
- It's a bit unintuitive since many other `get_*` style functions
  conventionally return `nil` if no object is found (e.g. `get_node`,
  `get_lang`, `query.get`, etc.)

**Solution:** Return `nil` if no parser can be found or created

- This requires a function signature change, and some new assertions in
  places where the parser will always (or should always) be found.
- This commit starts by making this change internally, since it is
  breaking. Eventually it will be rolled out to the public API.
2024-09-13 05:09:11 -07:00
James Trew
8654a97006
fix(lsp): handle empty call hierarchy items #30349
Ensure that the function `pick_call_hierarchy_item` correctly handles
the case where `call_hierarchy_items` is nil or an empty table. This
prevents potential errors when the function is called with no items.
2024-09-13 04:59:49 -07:00
Christian Clason
ae917dbd06 fix(treesitter): sync queries from upstream 2024-09-12 13:41:15 +02:00
zeertzjq
48c14d3544
vim-patch:9.1.0725: filetype: swiftinterface files are not recognized (#30350)
Problem:  filetype: swiftinterface files are not recognized
Solution: Detect '*.swiftinterface' files as swift filetype
          (LosFarmosCTL)

closes: vim/vim#15658

03cac4b70d

Co-authored-by: LosFarmosCTL <80157503+LosFarmosCTL@users.noreply.github.com>
2024-09-12 15:16:58 +08:00
Justin M. Keyes
5931f780e0
feat(log): use "ui" as default name for TUI client #30345
The default "session name" for the builtin TUI is "ui".

before:

    INF 2024-09-10T14:57:35.385 hello.sock os_exit:692: Nvim exit: 1
    INF 2024-09-10T14:57:35.388 ?.4543     os_exit:692: Nvim exit: 1

after:

    INF 2024-09-10T14:59:19.919 hello.sock os_exit:692: Nvim exit: 1
    INF 2024-09-10T14:59:19.922 ui.5684    os_exit:692: Nvim exit: 1
2024-09-11 17:25:00 -07:00
Gregory Anders
98ba65b8be
fix: replace NVIM with Nvim in default titlestring (#30348) 2024-09-11 20:32:08 +00:00
glepnir
f9bf64d746
fix(lsp): check buffer is loaded and valid #30330
Problem: buffer mabye not valid when callback handler invoke.

Soliton: check buffer is valid and loaded in handler.
2024-09-11 08:11:09 -07:00
Justin M. Keyes
a30afeeb85
Merge #30342 :checkhealth completion 2024-09-11 03:01:48 -07:00