Problem: There is no easy way to translate a string with a key code into a
readable string.
Solution: Add the keytrans() function. (closesvim/vim#11114)
cdc839353f
vim-patch:7b2d87220c6c
Add missing part of patch
7b2d87220c
Problem: There is no way to get the byte index from a virtual column.
Solution: Add virtcol2col(). (Yegappan Lakshmanan, closesvim/vim#10477,
closesvim/vim#10098)
5a6ec10cc8
Cherry-pick tv_check_for_number_arg() from Vim.
Cherry-pick pathshorten() doc change.
The execution of the LspDetach autocommands in the LSP client's on_exit
function are scheduled on the event loop to avoid making API calls in a
fast context; however, this means that by the time the LspDetach
autocommands finally run the client object has already been deleted.
To address this, we also schedule the deletion of the client on the
event loop so that it is guaranteed to occur after all of the LspDetach
autocommands have fired.
Problem: Jsonnet files are not recognized.
Solution: Add a pattern for Jsonnet files. (Cezary Drożak, closesvim/vim#11073,
closesvim/vim#11081)
2a4c885d54
Use the first, not last, query for a language on runtimepath. Typically,
this implies that a user query will override a site plugin query, which
will override a bundled runtime query.
Problem: Treesitter queries for a given language in runtime were merged together,
leading to errors if they targeted different parser versions (e.g., bundled viml queries
and those shipped by nvim-treesitter).
Solution: Runtime queries now work as follows:
* The last query in the rtp without `; extends` in the header will be used as the base query
* All queries (without a specific order) with `; extends` are concatenated with the base query
BREAKING CHANGE: queries need to be updated if they are meant to extend other queries
Doing so on `BufDelete` has issues:
- `BufDelete` is also fired for listed buffers that are made unlisted.
- `BufDelete` is not fired for unlisted buffers that are deleted.
This means that diagnostics will be lost for a buffer that becomes unlisted.
It also means that if an entry exists for an unlisted buffer, deleting that
buffer later will not remove its entry from the cache (and you may see "Invalid
buffer id" errors when using diagnostic functions if it was wiped).
Instead, remove a buffer from the cache if it is wiped out.
This means simply `:bd`ing a buffer will not clear its diagnostics now.
- Added 'spell' option to extmarks:
Extmarks with this set will have the region spellchecked.
- Added 'noplainbuffer' option to 'spelloptions':
This is used to tell Neovim not to spellcheck the buffer. The old
behaviour was to spell check the whole buffer unless :syntax was set.
- Added spelling support to the treesitter highlighter:
@spell captures in highlights.scm are used to define regions which
should be spell checked.
- Added support for navigating spell errors for extmarks:
Works for both ephemeral and static extmarks
- Added '_on_spell_nav' callback for decoration providers:
Since ephemeral callbacks are only drawn for the visible screen,
providers must implement this callback to instruct Neovim which
regions in the buffer need can be spell checked.
The callback takes a start position and an end position.
Note: this callback is subject to change hence the _ prefix.
- Added spell captures for built-in support languages
Co-authored-by: Lewis Russell <lewis6991@gmail.com>
Co-authored-by: Björn Linse <bjorn.linse@gmail.com>
* Add vim.treesitter.start() for starting treesitter highlighting via
ftplugin or autocommand (can be extended later for fold, indent,
matchpairs, ...)
* Add vim.treesitter.stop() for manually stopping treesitter
highlighting
* Enable treesitter highlighting for Lua if
`vim.g.ts_highlight_lua = true` is set in `init.lua`
Problem: Cannot force getting MouseMove events.
Solution: Add the 'mousemoveevent' option with implementaiton for the GUI.
(Ernie Rael, closesvim/vim#10044)
c4cb544cd5
This only ports the docs and the option variable.
The following commits will actually implement it as a UI option.
Problem: filetype detection does not run on piped input
Solution: add `StdinReadPost` to main filetype.lua autocommand
Rationale: legacy filetype detection checked contents by sourcing
`scripts.vim` in separate autocommands, including on `StdinReadPost`.
For Lua filetype detection, this was moved into the main autocommand,
with bundled `scripts.vim` gated behind `g:do_legacy_filetype` (i.e.,
only user `scripts.vim` are sourced for compatibility by default). Adding
`StdinReadPost` to the main autocommand again runs content checks on
piped input without requiring code duplication and low-payoff
refactoring.
Now nvim_parse_cmd and nvim_create_user_command use a "tab" value which
is the same as the number passed before :tab modifier instead of the
number plus 1, and "tab" value is -1 if :tab modifier is not used.
Problem: ":wincmd =" equalizes in two directions.
Solution: Make ":vertical wincmd =" equalize vertically only and
":horizontal wincmd =" equalize horizontally only.
21c3a80a7f
vim-patch:9.0.0341: mapset() does not restore <Nop> mapping properly
Problem: mapset() does not restore <Nop> mapping properly.
Solution: Use an empty string for <Nop>. (closesvim/vim#11022)
92a3d20682
* vim-patch:9.0.0314: VDM files are not recognized
Problem: VDM files are not recognized.
Solution: Add patterns for VDM files. (Alessandro Pezzoni, closesvim/vim#11004)
bf26941f40
* vim-patch:9.0.0319: Godot shader files are not recognized
Problem: Godot shader files are not recognized.
Solution: Add patterns for "gdshader". (Maxim Kim, closesvim/vim#11006)
d5c8f11905
Problem: People are confused about `vim.o` and `vim.opt`
Solution: Clarify that `vim.o` is the default interface, with `vim.opt`
specifically meant for interacting with list-style options.
vim-patch:9.0.0285: it is not easy to change the command line from a plugin
Problem: It is not easy to change the command line from a plugin.
Solution: Add setcmdline(). (Shougo Matsushita, closesvim/vim#10869)
07ea5f1509
Problem: The tiny version has the popup menu but not 'wildmenu'.
Solution: Graduate the wildmenu feature.
5416232707
N/A patches for version.c:
vim-patch:9.0.0281: build failure without the +eval feature
Problem: Build failure without the +eval feature.
Solution: Add #ifdef.
58dcbf1c65
This removes the support for defining links via
vim.treesitter.highlighter.hl_map (never documented, but plugins did
anyway), or the uppercase-only `@FooGroup.Bar` to `FooGroup` rule.
The fallback is now strictly `@foo.bar.lang` to `@foo.bar` to `@foo`,
and casing is irrelevant (as it already was outside of treesitter)
For compatibility, define default links to builting syntax groups
as defined by pre-existing color schemes
The private 'get_node_range' function from the languagetree module has
been renamed and remains private as it serve a purpose that is only
relevant inside the languagetree module.
The 'get_node_range' upstreamed from nvim-treesitter in the treesitter
module has been made public as it is in itself a utlity function.
As part of the upstream of utility functions from nvim-treesitter, this
option when set to false allows to return a table (downstream behavior).
Effectively making the switch from the downstream to the upstream
function much easier.
Problem: bufload() reads a file even if the name is not a file name. (Cyker
Way)
Solution: Do not read the file when the buffer name is not a file name.
(closesvim/vim#10975)
2eddbacd6d
Previously if a highlight group with a name outside the regexp
[a-zA-Z0-9_] was defined, Nvim would emit an "invalid character"
warning message. This was annoying for Lua scripts, as it was very hard
to debug what line of code was triggering this message since it didn't
produce a stack trace.
This has now been promoted to an error with the code E5248.
Additionally the ASCII character period ('.') and at-sign ('@') have
been added to the allowed list of characters of a highlight group name
to support the application of defining hierarchical highlight groups,
e.g. 'TS.keyword'.
Co-authored-by: Christian Clason <christian.clason@uni-due.de>
Problem: Startup test fails.
Solution: Avoid an error for verbose expansion. Fix that the "0verbose"
command modifier doesn't work.
60895f3e36
Most code changes has already been ported.
Problem: Cannot use expand() to get the script name.
Solution: Support expand('<script>'). (closesvim/vim#10121)
6013d0045d
Use `.sn_name` instead of `->sn_name` as v8.2.0154 hasn't been ported.
Cherry-pick builtin.txt expand() doc from latest Vim.
vim-patch:8.1.1915: more functions can be used as methods
Problem: More functions can be used as methods.
Solution: Make various functions usable as a method.
1a3a89168d
Move debugbreak() to the right place.
vim-patch:8.1.1921: more functions can be used as methods
Problem: More functions can be used as methods.
Solution: Make various functions usable as a method.
a4208966fb
vim-patch:8.1.1953: more functions can be used as a method
Problem: More functions can be used as a method.
Solution: Allow more functions to be used as a method.
f9f24ce7a0
Omit test_termcodes.vim: cannot be used and superseded by later patches.
Cherry-pick test_bufline.vim change from patch 8.1.1993.
Problem: 'wildmenu' only shows few matches.
Solution: Add the "pum" option: use a popup menu to show the matches.
(Yegappan Lakshmanan et al., closesvim/vim#9707)
3908ef5017
Omit p_wmnu check in cmdline_pum_active() as it can cause problems.
Omit vim_strchr() flags as that isn't really better than bitmasks.
Omit key translations and document it in vim_diff.txt.
Problem: Cannot use a lambda for 'operatorfunc'.
Solution: Support using a lambda or partial. (Yegappan Lakshmanan,
closesvim/vim#8775)
777175b0df
Omit duplicate docs. It's removed in patch 8.2.3623.
Nvim doesn't seem to need callback_set() as it was omitted when patch 8.1.1437
was first ported.
fix(filetype): only pass first 100 and last lines to contents check
sufficient for current content checks and avoids performance issues for
buffers with a large number of lines
fixes#19817
docs(lua): update vim.{go,bo,wo} documentation
* document indexing by buffer/window handle
* correct wrapper information (`nvim_buf_{g,s}et_value` now)
* make clear what is considered "invalid key" (consistently)
Allows preview callbacks to modify multiple buffers in order to show the
preview. Previously, if multiple buffers were modified, only the current
buffer would have its state restored. After this change, all buffers
have their state restored after preview.
Closes#19103.
This starts a soft phase-out of `buf_request`.
`buf_request` is quite error prone:
- Positional `params` depend on the client because of the
`offset_encoding`. Currently if there is one client using UTF-8 offset
encoding and another using UTF-16, the positions in the request are
wrong for one of the clients. To solve this the params would need to
be created per client instead of once for all of them.
- `handler` is called *per* client but many users of it assume it is
only called once.
This can lead to a "select n + 1"
kind of problem, where the handler makes another call to `buf_request`,
multiplying the amount of requests.
(There are in fact still some places where this happens in core)
Or it leads to erratic behavior if called multiple times (E.g. the
quicklist list flickering & being overwritten)
(See hover or references implementation)
`buf_request_all` returns an aggregate of the responses which is more
sensible as it avoids this problem.
For off-spec extensions it also has the problem that it sends requests to
clients which cannot handle a given request.
Given that `buf_request` is in use by a lot of plugins this starts a
soft-phase out. Planned Steps:
- Remove from docs
- Provide an alternative, either `buf_request_all`, maybe with
extensions (params being a function), or an entirely new method.
- Mark as deprecated in 0.9
- Remove in 0.10
To note:
- `buf_request_all` currently isn't ideal either because it suffers from
the `params` problem as well.
- This implies that the `vim.lsp.with` pattern will die, because the
global handlers as they are don't fit a multi-client model, as most of
the time an aggregate is needed.
Let :wincmd command accept a count like what its documentation suggests.
Previously it could only accept a range, which led to some ambiguity on
which attribute should be used when executing :wincmd using nvim_cmd.
Closes#19662.
Also fix a typo in a related Vim test:
vim-patch:9.0.0223: typo in diffmode test
Problem: Typo in diffmode test.
Solution: Fix the typo. (closesvim/vim#10932)
5fd6ab820b
Problem: The argument list may contain duplicates.
Solution: Add the :argdedeupe command. (Nir Lichtman, closesvim/vim#6235)
73a024209c
Use latest index.txt :argdedupe doc from Vim.
Patch 8.2.4594 (36a5b6867b) added support for sourcing a buffer without a name.
Patch 8.2.4325 (3908ef5017) added support for using a popup menu for wildmode completion.
Problem: When a test fails it's often not easy to see what the call stack
is.
Solution: Add more entries from the call stack in the exception message.
a5d0423fa1
Use docs from latest Vim.
vim-patch:8.2.1536: cannot get the class of a character; emoji widths are wrong
Problem: Cannot get the class of a character; emoji widths are wrong in
some environments.
Solution: Add charclass(). Update some emoji widths. Add script to check
emoji widths.
4e4473c927
Use latest charclass() docs from Vim.
Rewrite DoIt() in emoji_list.vim in Lua.
Omit emoji table updates:
- emoji_width update looks wrong as these added ranges are only double-width when followed by 0xFE0F.
- Other updates are too old.
vim-patch:8.2.1540: the user cannot try out emoji character widths
Problem: The user cannot try out emoji character widths.
Solution: Move the emoji script to the runtime/tools directory.
98945560c1
`server_capabilities` can be nil until the server is initialized.
Reproduced with:
vim.lsp.stop_client(vim.lsp.start_client {
cmd = { vim.v.progpath, '-es', '-u', 'NONE', '--headless' };
})
The change tracking used a single lines/lines_tmp table to track
changes to a buffer.
If multiple clients using incremental sync are connected to a buffer,
they both made changes to the same lines table. That resulted in an
inconsistent state.
This commit changes the didChange handling to group clients by
synchronization scheme and offset encoding.
This avoids computing the diff multiple times for clients using the
same scheme and resolves the lines/lines_tmp conflicts.
Fixes https://github.com/neovim/neovim/issues/19325
based on http://www.vim.org/scripts/script.php?script_id=1291
reformatted to match Nvim documentation style; removed irrelevant sections
Co-authored-by: dundargoc <gocundar@gmail.com>
Co-authored-by: Christian Clason <c.clason@uni-graz.at>
Co-authored-by: Lewis Russell <lewis6991@gmail.com>
Problem: setcellwidths() may make 'listchars' or 'fillchars' invalid.
Solution: Check the value and give an error. (closesvim/vim#9024)
94358a1e6e
Cherry-pick f_setcellwidths() change from patch 9.0.0036.
Cherry-pick 'ambiwidth' docs update from runtime update 079ba76ae7a7.
Problem: It is not possible to specify cell widths of characters.
Solution: Add setcellwidths().
08aac3c619
Co-Authored-By: delphinus <me@delphinus.dev>
The lsp client used to wait up to 500ms for a language server to
shutdown before sending a TERM signal.
The intention behind the 500ms grace period was to ensure the language
server exits to prevent stale processes, but it has the side-effect that
it can interrupt language-servers which are too slow to shutdown within
500ms. Language servers tend to write out index files or project files
on shutdown, and being interrupted during this process can cause
corruption of those files.
This changes the default to not wait at all, at the risk of leaving
stale processes around if the language server isn't well behaved.
An alternative would be to wait indefinitely, but that can cause neovim
to take several seconds to exit.
Problem: Options window still checks for the multi_byte feature.
Solution: Remove the unnecessary check. (Dominique Pelle, closesvim/vim#3990)
76cbe811da
Problem: "delmenu" does not remove autocmmands. Running menu test function
alone fails.
Solution: Delete autocommands Make sure there is at least one menu.
(closesvim/vim#10848)
206fce307b
- Separate preview and callback functions to make the example easier to understand
- Use false instead of 0 for boolean arguments in API function calls
- Remove explicit nil checks for consistency
- Format with stylua
Problem: Buffer menu does not handle special buffers properly.
Solution: Keep a dictionary with buffer names to reliably keep track of
entries.
Also trigger BufFilePre and BufFilePost for command-line and
terminal buffers when the name changes.
5e94a29ebb