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.
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
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.
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.
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/476closes: vim/vim#1570950423ab808
Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com>
Problem: Multiple timestamps in the same line were not highlighted
Solution: Adapt the syntax to support multiple timestamps
fixes: vim/vim#15703closes: vim/vim#15707597aadcf21
Co-authored-by: ObserverOfTime <chronobserver@disroot.org>
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/455closes: vim/vim#1569823079450a8
Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com>
Fixes E872 too many '(' in highlight pattern for `mf` selection
fixup for vim/vim#15551closes: vim/vim#15700c18a9d5835
Co-authored-by: yasuda <yasuda@kyoto-sr.co.jp>
**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.
- Allow function command modifiers.
- Match function bodies starting with empty lines.
Command modifiers reported by @Konfekt.
fixesvim/vim#15671closes: vim/vim#1567435699f1749
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
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
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.
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.
Problem: filetype: salt files are not recognized
Solution: Detect '*.sls' files as filetype salt,
include a syntax script (Gregory Anders)
closes: vim/vim#1568989b9bb4ac8
Co-authored-by: Gregory Anders <greg@gpanders.com>
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>
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.
fixesvim/vim#15237
related vim/vim#15238closes: vim/vim#156645e95c8f637
Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com>
Co-authored-by: Dexter Gaon-Shatford <dexter@gaonshatford.ca>
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#1567259b089c9df
Co-authored-by: Evgeni Chasnovski <evgeni.chasnovski@gmail.com>
Match Vim9 boolean and null literals in expression arguments of :if,
:elseif, :while and :return.
closes: vim/vim#156844d427d4cab
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
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.
**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.
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.
Problem: filetype: swiftinterface files are not recognized
Solution: Detect '*.swiftinterface' files as swift filetype
(LosFarmosCTL)
closes: vim/vim#1565803cac4b70d
Co-authored-by: LosFarmosCTL <80157503+LosFarmosCTL@users.noreply.github.com>