Previously, the handler signature was:
function(err, method, params, client_id, bufnr, config)
In order to better support external plugins that wish to extend the
protocol, there is other information which would be advantageous to
forward to the client, such as the original params of the request that
generated the callback.
In order to do this, we would need to break symmetry of the handlers, to
add an additional "params" as the 7th argument.
Instead, this PR changes the signature of the handlers to:
function(err, result, ctx, config)
where ctx (the context) includes params, client_id, and bufnr. This also leaves
flexibility for future use-cases.
BREAKING_CHANGE: changes the signature of the built-in client handlers, requiring
updating handler calls
Problem:
jobwait() returns early if the job was stopped, but the job might have
pending callbacks on its event queue which are required to complete its
teardown. State such as term->closed might not be updated yet (by the
pending callbacks), so codepaths such as :bdelete think the job is still
running.
Solution:
Always flush the job's event queue before returning from jobwait().
ref #15349
Copy the behavior of 'undodir' and create the last specified directory
in the 'backupdir' option if it doesn't exist.
Use trailing slashes for 'backupdir' as well as 'viewdir' and 'undodir'
by default. Note that 'undodir' always behaves as though it has the
trailing slashes, regardless of whether or not they are present. They
are added to the default option value to minimize surprise.
The '.' value in 'backupdir' is kept because the default behavior for
backups is solely to have a backup if the save of the main file to disk
fails. As soon as that save is completed the backup file is removed, so
generally there is no need to put them in a central location.
Co-authored by: murphy66 <murphy66@gmail.com>
Resolve an issue with deferred clearing of highlight failing if the
buffer is deleted before the timeout by checking whether the
buffer is valid first.
The official developer documentation in in :h dev-lua-doc specifies to
use "--@" for special/magic tokens. However, this format is not
consistent with EmmyLua notation (used by some Lua language servers) nor
with the C version of the magic docstring tokens which use three comment
characters.
Further, the code base is currently split between usage of "--@",
"---@", and "--- @". In an effort to remain consistent, change all Lua
magic tokens to use "---@" and update the developer documentation
accordingly.
* feat(api): add lua C bindings for xdiff
* chore: opt.hunk_lines -> opt.result_type
opt.on_hunk now takes precedence over opt.result_type
* chore: fix indents
Fix indents
* chore: change how priv is managed
Assign priv NULL and unconditionally apply XFREE_CLEAR to it when
finished.
Problem: 'cursorline' should not apply to 'breakindent'.
Solution: Make 'cursorline' apply to 'breakindent' and 'showbreak'
consistently. (closesvim/vim#8684)
4f33bc20d7
v:lua expressions are represented using vvlua_partial. As v:lua isn't
intended to be called directly, it's given an empty pt_name.
Because of this, calling v:lua directly like "v:lua()" will cause "E117:
Unknown function: ", with an empty name.
Instead, have call_func() show the name "v:lua" in the emsg.
Problem: Only some assert functions can be used as a method.
Solution: Allow using most assert functions as a method.
24278d2407
Port tests to assert_spec.lua.
v8.1.0736 made some changes for making some emsgs more specific.
Includes the change for Test_lambda_fails() in test_lambda.vim.
Adjust relevant functionaltests to expect the new emsgs.
This patch has been fully ported in my Blob port PR, but it hasn't been
merged yet, so just use what we need from it for now.
Required for v8.1.1821.
Problem: No error when using :complete for :command without -nargs.
Solution: Give an error. (Martin Tournoij, closesvim/vim#8544, closesvim/vim#8541)
de69a7353e
N/A patches for version.c:
vim-patch:8.1.1801: cannot build without the +eval feature
Problem: Cannot build without the +eval feature.
Solution: Always define funcexe_T.
505e43a20e
vim-patch:8.1.1818: unused variable
Problem: Unused variable.
Solution: Remove the variable. (Mike Williams)
b4a88a0441
vim-patch:8.2.1464: Vim9: build warning for unused variable
Problem: Vim9: build warning for unused variable.
Solution: Delete the variable declaration.
829ac868b7
vim-patch:8.2.2639: build failure when fsync() is not available
Problem: Build failure when fsync() is not available.
Solution: Add #ifdef.
5ea79a2599
vim-patch:8.2.2814: Vim9: unused variable
Problem: Vim9: unused variable. (John Marriott)
Solution: Adjust #ifdef.
b06b50dfa0
vim-patch:8.2.2947: build failure without the channel feature
Problem: Build failure without the channel feature.
Solution: Add back #ifdef. (John Marriott)
f5bfa8faa7
vim-patch:8.2.2976: build failure without the +eval feature
Problem: Build failure without the +eval feature.
Solution: Add #ifdefs.
8de901e1f1
vim-patch:8.2.2986: build failure without the profile feature
Problem: Build failure without the profile feature.
Solution: Add #ifdef.
d9f31c13d2
vim-patch:8.2.3114: Amiga-like systems: build error using stat()
Problem: Amiga-like systems: build error using stat().
Solution: Only build swapfile_process_running() on systems where it is
actually used. (Ola Söder, closesvim/vim#8519)
599a6e5b36
Add two new methods to allow diagnostics to be disabled (and re-enabled)
in the current buffer. When diagnostics are disabled they are simply not
displayed to the user, but they are still sent by the server and
processed by the client.
Disabling diagnostics can be helpful in a number of scenarios. For
example, if one is working on a buffer with an overwhelming amount of
diagnostic warnings it can be helpful to simply disable diagnostics
without disabling the LSP client entirely. This also allows users more
flexibility on when and how they may want diagnostic information to be
displayed. For example, some users may not want to display diagnostic
information until after the buffer is first written.
An empty table was previously always treated as a list, which means that
while merging tables, whenever an empty table was encountered it would
always truncate any table on the left.
`vim.tbl_deep_extend("force", { b = { a = 1 } }, { b = {} })`
Before: `{ b = {} }`
After: `{ b = { a = 1 } }`
Problem: When 'hidden' is set session creates extra buffers.
Solution: Move :badd commands to the end. (Jason Franklin)
d39e275b57
Adjust some tests in ex_cmds/mksession_spec.lua:
- 'restores same :terminal buf in splits': Buffers aren't always :badded
in the same order as they're :edited, :balted, etc, so the order of
buffers in the buffer list may change slightly now that :badd happens
afterwards.
- 'restores buffers with tab-local CWD': This is explained in a comment.
Options formatted as a list of comma-separated key-value pairs may have
values that contain leading and trailing whitespace characters. For
example, the `listchars` option has a default value of
`"tab:> ,trail:-,nbsp:+"`. When converting this value to a lua table,
leading and trailing whitespace should not be trimmed.
Co-authored-by: Robert Hrusecky <robert.hrusecky@utexas.edu>
This release represents ~4000 commits since v0.4.4, the previous
non-maintenance release. Highlights include builtin support for LSP, new APIs
for extended marks (with byte resolution tracking of changes) and buffer
decorations, as well as vast improvements to lua as a plugin and configuration
language. Experimental support for tree-sitter as a syntax engine is also
included, building on the new core APIs for byte tracking and decorations.
FEATURES:
New API functions:
nvim_exec: execute multiline vim script blocks
nvim_get_hl_id_by_name: Gets a highight definition by name
nvim_exec_lua: new name for nvim_execute_lua
nvim_notify: Notify the user with a message
nvim_get_runtime_file: Find files in runtime directories
nvim_get_all_options_info: Get option information for all options
nvim_get_option_info: Get option information for one option
nvim_echo: Echo a message with highlights
nvim_open_term: Open a virtual terminal in a buffer
nvim_chan_send: send data to a channel. (like chansend() but supports lua strings)
nvim_set_decoration_provider: callback driven decoration API for a namespace
nvim_buf_set_text: Set/replace a character range in a buffer
nvim_buf_delete: Delete the buffer. |:bwipeout|
nvim_buf_get_extmark_by_id: Returns position for a given extmark id.
nvim_buf_get_extmarks: get extmarks in traversal order.
nvim_buf_set_extmark: Creates or updates an extmark.
nvim_buf_del_extmark: Removes an extmark.
nvim_buf_call: call a function with buffer as temporary current buffer
nvim_win_hide: Closes the window and hide the buffer it contains |:hide|
nvim_win_call: Calls a function with window as temporary current window.
New UI events:
redraw.screenshot
redraw.win_viewport
Lua:
767cd8b17#12235 startup: add init.lua as an alternative user config
687eb0b39#14686 feat(startup): Source runtime/plugin/**/*.lua at startup
#14686 runtime: allow lua in various runtime search paths such as
syntax/ ftdetect/ indent/ ftplugin/ compiler/ colors/
43956dea5#13479 lua: Add vim.opt and fix scopes of vim.o
1407899c3#12268 lua: Add buffer, window and tab accessors
be662fe5c lua: vim.wait implementation
2b663c061#14213 viml: embed Lua syntax highlighting
901dd79f6 feat: add completion to ':lua'
82688973 lua: complete methods in metatables
342148525 runtime: propagate lua parsing errors while using "require"
aaca2c1c4#13276 feat(lua): improve error message to make it actionable
c60c7375f startup: handle autoload and lua packages during startup
3ccdbc570#12536 lua: add vim.register_keystroke_callback
971a191c4 lua: Add ability to pass lua functions directly to vimL
91e41c857#12401 lua: add vim.highlight.range
f2894bffb#12279 lua: Add highlight.on_yank
ae5bd0454#11969 lua: add tbl_deep_extend
ea4127e9a lua: metatable for empty dict value
dab40f43b Add v:lua.func() vimL syntax for calling lua
678a51b1d Lua: vim.validate()
474d0bcbf lua: vim.rpcrequest, vim.rpcnotify, vim.NIL
8ee7c94a9 lua: add vim.fn.{func} for direct access to vimL function
d0d38fc36#11442 Lua: vim.env, vim.{g,v,w,bo,wo}
Tree-sitter:
Note: tree-sitter is considered experimental for 0.5. There's remaining
bugs for buffer parsing, as well as known performance issues for
large files and injected (nested) languages.
e93342629#10124 Tree-sitter API for lua
440695c29 tree-sitter: implement query functionality and highlighting prototype
8bea39f37 feat(treesitter): allow injections to be configured through directives
929f19414 feat(treesitter): add offset predicate for language injection
cd75d3289#14200 feat: treesitter checkhealth
1a631026a feat(treesitter): add language tree
d3f544002 treesitter: runtime queries
3c5141d2c#13008 treesitter: add string parser
9437327d5 treesitter: use new on_bytes interface
e4b5efa51 treesitter: use decoration provider API
d6209a7b8 fix: Add a test and it is so pretty
836c31032 feat(ts): bump tree-sitter to v0.20.0
LSP client:
00dc12c5d#11336 lua LSP client: initial implementation
d5aaad14e#11430 Followup improvements to LSP
ee7ac469c#11578 LSP: Use async completion for omnifunc.
070bd3ea2#11604 LSP: shrink API, improve docs
25afa10f9#11669 Merge 'LSP: differentiate diagnostic underline by severity'
e956ea767#11777 LSP: show diagnostic in qf/loclist
dd8b29cfe#11838 LSP: set InitializeParams.rootPath value
0c5d2ffeb#11837 Merge 'LSP: fixes, improve test visibility'
ca8699378#11638 LSP: implement documentHighlight
220a2b05c LSP/references: Add context to locations returned by server
ccb038dc6 LSP/completion: add textEdit support
da6f38ab3#12313 LSP: Add workspace.applyEdit client capabilities
f559e5249#11607 LSP: Add textDocument/codeAction support
0d83a1c43#12638 LSP: Feature/add workspace folders
fd507e278#13641 LSP: window/showMessageRequest
e467d2939 LSP: Move workspace/configuration handler from nvim-lspconfig to core
2bdd553c9 feat(lsp): Add codelens support
UI:
f8134f2fd screen.c: remove fold_line special case
c146eddc8 experimental support for per-window color schemes
a1508c9f6 nvim__screenshot (dump TUI state to file)
08fe10010 terminal: enable pass through indexed colors to TUI in rgb mode
5a8569942 tests/ui: make screen.lua use "linegrid" representation internally
8fe19d9d8 screen: make ui_compositor aware of the intended size of a float
54ce1010e extmark: add new flexible "decorations" abstraction
4781333a7 decorations: allow virt_text overlay at any column
bdebe8516 decorations: use extmark column adjustments for buffer highlights
7b488314d decorations: Allow highlights beyond end of line hl_eol
425bc438a decorations: add additional styling of virt_text overlays
edb5864a2 floats: z-index
243820ebd floats: add borders (MS-DOS MODE)
5b6edc852 feat(float): add rounded borders preset
4a36ec6da#14310 float: add "solid" border style
vim patches:
around ~1000 vim patches and runtime updates got merged. Hooray!
Changes include improvements to quickfix, prompt buffers, incsearch,
display of search counts, and much much more.
various features and changes:
858c05613#12809 Support for :perl, :perlfile, :perldo and perleval()
bc86f76c0 api/buffer: add "on_bytes" callback to nvim_buf_attach
19b623708 jobstart now supports env/clear_env
ef7c6b972 Support specifying "env" option for termopen()
7c4f34966#13287 switch from travis to github actions
24db59ca8 feat: implement BufModified autocmd
b83d8223f implement Scroll autocommand
8caf84130 Lower "closed by the client" message level to INFO
7de276b87 bump libvterm to 0.1.4
097ec71bd#14096 aarch64/linux: fix build by updating LuaJIT
bd5f0e969#12531 support autoread using tui focus tracking
8a1276005#12382 Add v:event.visual during `TextYankPost`
802f8429d api(nvim_open_win): add "noautocmd" option
FIXES:
21444552c BugFix(clipboard): Fix block paste not working properly
01493e799#14413 api: fix nvim_exec() silencing behaviour
9699f3be1 fix(doc): Add '/site' to stdpath('data') example in `:help 'rtp'`
581b2bcde screen: fix problem with p_ch
eae4b1e5c luaref: fix leaks for global luarefs
409b2711f fix: segfault when pasting in term with empty buffer
cf6c23fb0#14273 fix plenty of errors discovered by clang
21035cff9#14500 fix plenty of errors discovered by coverity
bca19138b#13987 tui: fix possibility of evaluating uninitialized variables
9f2335937 fix_cursor: do not change line number when edit will not impact cursor row
33f92fe02 fix(pty): Always use $TERM from the job's env dict
6249059d4 checkhealth: fix terminfo problems on Windows
397be5d38#12811 UI: fix cursor not displayed after hiding and un-hiding
87afc9031 screen.c: fix an issue with wrap and folds
b419e39a2 screen.c: fix last character on foldtext
2ea312769#13688 screen.c: fix display of signcolumn=auto in diffs
c2d288e29 Fix screen terminal family issues
314b222c2#14127 Fix click on foldcolumn with vsplit
e65d0e53b vim.fn: throw error when trying to use API function
Ensure that
* Shell uses UTF8 input/output mode
* Stderr output is captured, in UTF8
* Program exit codes are correctly captured
Update functional test harness and add tests
for :make command.
Closes#13713
Problem: The wininfo list may contain stale entries.
Solution: When closing a window remove any other entry where the window
pointer is NULL.
4882d98339
This closes#14677, but I also am a little unsure if there are times
where this may not be correct. However, this just changes the behavior
that even if `was_set` was false, we still get for
`nvim_win_get_option`.
* Add buffer information to tabline_update
Most terminal implementations of the tabline display buffer and tab
information. Many neovim-qt users disable GuiTabline because it lacks
functionality provided in the terminal implementation.
The tabline_update event should include buffer information too, so client GUIs
can display rich useful tabs.
It's happening because do_source is only expected to return FAIL when it
was unable to open file . But `nlua_exec_file` returns fail for parsing
and execution error too . Those errors are emitted through `nlua_error`.
So now return value of nlua_exec_file is ignored like do_cmdline. It now
only returns fail when it was unable to open file that check is done
before calling nlua_exec_file or do_cmdline. Errors in nlua_exec_file
are still directly emitted through nlua_error like before.
Problem: Spell suggestions insufficiently tested.
Solution: Add spell suggestion tests. (Dominique Pelle, closesvim/vim#5398)
e9a8d1f9ad
Requires latest en.utf-8.spl from
https://ftp.nluug.nl/pub/vim/runtime/spell/.
Include the following patch because patch v8.2.0946 was merged:
vim-patch:8.2.0948: spell test fails
Problem: Spell test fails.
Solution: Adjust expected text of the prompt.
d281b7c227
This option, when set, stops nvim_open_win() from potentially firing
buffer-related autocmd events
(BufEnter, BufLeave and BufWinEnter in the case of nvim_open_win()).
Iterating over PARAM_COUNT is wrong as PARAM_COUNT also counts the last
element of the options array, which has a NULL fullname in order to
signal the end of the array.
Problem: Problem restoring 'packpath' in session.
Solution: Let "skiprtp" also apply to 'packpath'.
d23b714d8b
Port Test_mksession_skiprtp() to lua functional test.
For the case of Clojure and other Lisp syntax highlighting, it is
necessary to create huge regexps consisting of hundreds of symbols with
the pipe (|) character. To make things more difficult, these Lisp
symbols sometimes consists of special characters that are themselves
part of special regexp characters like '*'. In addition to being
difficult to maintain, it's performance is suboptimal.
This patch introduces a new predicate to perform 'source' matching in
amortized constant time. This is accomplished by compiling a hash table
on the first use.
Problem: Delete() can not handle a file name that looks like a pattern.
Solution: Use readdir() instead of appending "/*" and expanding wildcards.
(Ken Takata, closesvim/vim#4424, closesvim/vim#696)
701ff0a3e5
Since the providers are ordered by ns_id, inserting a new provider may
require shifting existing providers around to maintain this ordering.
When this happens, we need to allocate a new element at the end of the
vector and then shift the larger elements to the right. Rather than
iterating (incorrectly) with a loop and copying each item, use memmove
to copy the entire block.
This commit prevents two things regarding the tagstack and jumping to
locations:
- Pushing the same item twice in a row
- Pushing an item where the destination is the same as the source
Both prevent having to press CTRL-T additional times just to pop items
that don't make the cursor move.
There were a couple of reports of "Buffer X newer than edits" problems.
We first assumed that it is incorrect for a server to send 0 as a
version - and stated that they should send a `null` instead, given that
in the specification the `textDocument` of a `TextDocumentEdit` is a
`OptionalVersionedTextDocumentIdentifier`.
But it turns out that this was a change in 3.16, and in 3.15 and earlier
versions of the specification it was a `VersionedTextDocumentIdentifier`
and language servers didn't have a better option than sending `0` if
they don't keep track of the version numbers.
So this changes the version check to always accept `0` values.
See
- https://github.com/neovim/neovim/issues/12970
- https://github.com/neovim/neovim/issues/14256
- https://github.com/haskell/haskell-language-server/pull/1727
It looks solid with the default `FloatBorder` group.
If you set the bgcolor of FloatBorder to the same color as for FloatNormal, you
effectively get an "1-cell padding".
Replacement for Vim's test_null_string().
Vim uses it to verify that its codebase handles null strings.
Preparation for the Test_null_list() in patch v8.2.1822.
Use v:_null_string, not non-existent env var, for null string tests.
Mention v:_null_string in id() because id(v:_null_string) returns (nil).
Problem: Highlighting for :s wrong when using different separator.
Solution: Use separat argument for search direction and separator. (Rob
Pilling, closesvim/vim#5665)
c036e87bd7
Problem: Status line is not updated when going to cmdline mode.
Solution: Redraw status lines if 'statusline' is set and going to status
line mode. (based on patch from Justin M. Keyes et al.,
closesvim/vim#8044)
ce0b75711a