Commit Graph

3372 Commits

Author SHA1 Message Date
Justin M. Keyes
d8ccee30b0
fix(jobwait): always drain process event queues #15970
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

Co-authored-by: Gregory Anders <greg@gpanders.com>
2021-10-08 17:02:37 -07:00
Michael Lingelbach
3f20d8bb09 chore(lsp): fix formatting in vim.lsp.log (#15596) 2021-10-02 17:18:22 -07:00
Michael Lingelbach
9eed756cad feat(lsp): add warning message for large log size 2021-10-02 17:18:11 -07:00
Justin M. Keyes
0159e4daae NVIM v0.5.1
BREAKING CHANGES:
d83df7f7b5 feat(lua)!: register_keystroke_callback => on_key
cd8f6c5fb7 feat(lsp)!: change handler signature #15504

FEATURES:
915dda3f96 feat(jobstart): add parameter to close stdin

FIXES:
f8e0011534 #15732 fix(inccommand): ignore trailing commands only for *previewed* command
2132c063af backport: fix(windowing): positioning of relative floats
51d6b26729 #15495 backport: tests(lua/on_yank): assert conditions that fail correctly
f7002337c0 #15482 backport: fix(lua): verify buffer in highlight.on_yank
6bda2f56eb #15454 backport: fix(window.c): win_close from other tabpage
be58ba250e #15372 backport: fix(autocmd.c): fix conditions in block_autocmds, unblock_autocmds
d0e9a11e39 backport: refactor(sign): include longer sign column option
5c42376c15 backport: fix(sign): reset auto sign column with minimum in float win minimal style
41f761130e backport: fix(decorations): crash when :bdelete (extmark_free_all) after clear_namespace
cf62554e5a #15111 backport: fix(:source): copy curbuf lines to memory before sourcing
6436100b6e #14809 backport: fix(:source, nvim_exec): handle Vimscript line continuations
917f306666 #15043 backport: test/memory_usage_spec: skip on MacOS
a9cca1b050 #14984 backport: fixup(clipboard): Fix error not properly handled
ae89330ec0 #14982 backport: fix(vim.opt): vimL map string values not trimmed
2229e99ef9 #14962 backport: fixup(clipboard): Use case matching
b6b12ea7c3 #15489 fix(man.vim): filetype=man is too eager
6f965f41df build: use RelWithDebInfo build for nightlies, Release for releases
f027c5e1e4 build: update appdata.xml version in release commit
8336488ce1 test(treesitter): skip all parsers tests if parsers aren't installed
008b83f5a2 Rename stdin to stdin_mode (fixes Windows build)

FIXES (LSP):
132053c1d2 #15523 backport: fix(lsp): resolve bufnr in buf_is_attached
a265201307 backport: fix(lsp): Ensure human readable errors are printed
33000bd9cf backport: fix(lsp): Ensure users get feedback on references/symbols errors or empty results
9f73b7c214 #14954 backport: fix(lsp): correctly check for windows in lsp logger
eaa1c47377 #15023 backport: fix(lsp): restore diagnostics extmarks that were moved to the last edit line
989ccb8222 #15011 backport: fix(lsp): restore diagnostics extmarks on buffer changes
2ae4c96d91 backport: fix(lsp): prevent double <text> for cached plaintext markup
7b0ae589f0 feat(lsp): allow root_dir to be nil (#15430) (Mathias Fußenegger)
8ec5bc9126 lsp(start_client): Allow passing custom workspaceFolders to the LSP (#15132) (sim)
959cf5e53c fix(lsp): check if buffer is valid in changetracking (#15505) (Jose Alvarez)
dc15b3a92c fix(lsp): avoid ipairs on non-sequential tables (#15059) (Michael Lingelbach)
18375c6df6 feat(lsp): improve vim.lsp.util.apply_text_edits (#15561) (hrsh7th)
7b1315fe61 feat(lsp): improve logging (#15636) (Michael Lingelbach)
2021-09-26 15:15:30 -07:00
Justin M. Keyes
14cdaca6a8 fix(lsp): fix handler signature, tests
- not necessary on master: got lost in the vim.lsp.diagnostic => vim.diagnostic migration
- fix tests which accidentally depended on previous session
- ref #15504
2021-09-26 15:15:03 -07:00
Mathias Fußenegger
7b0ae589f0 feat(lsp): allow root_dir to be nil (#15430)
According to the protocol definition `rootPath`, `rootUri` and
`workspaceFolders` are allowed to be null.

Some language servers utilize this to provide "single file" support.
If all three are null, they don't attempt to index a directory but
instead only provide capabilities for a single file.
2021-09-26 11:28:28 -07:00
sim
8ec5bc9126 lsp(start_client): Allow passing custom workspaceFolders to the LSP (#15132)
Some language servers *cough*rust-analyzer*cough* need an empty/custom
workspaceFolders for certain usecases. For example, rust-analyzer
needs an empty workspaceFolders table for standalone file support
(See https://github.com/rust-analyzer/rust-analyzer/pull/8955).

This can also be useful for other languages that need to commonly
open a certain directory (like flutter or lua), which would help
prevent spinning up a new language server altogether.

In case no workspaceFolders are passed, we fallback to what we had
before.
2021-09-26 11:28:28 -07:00
Jose Alvarez
959cf5e53c fix(lsp): check if buffer is valid in changetracking (#15505) 2021-09-26 11:28:28 -07:00
Michael Lingelbach
dc15b3a92c fix(lsp): avoid ipairs on non-sequential tables (#15059)
ipairs terminates on the first nil index when iterating over table keys:

for i,k in ipairs( {[1] = 'test', [3] = 'test'} ) do
  print(i, k)
end

prints:
1 test

Instead, use pairs which continues iterating over the entire table:

for i,k in pairs( {[1] = 'test', [3] = 'test'} ) do
  print(i, k)
end

prints:
1 test
3 test
2021-09-26 11:28:28 -07:00
hrsh7th
18375c6df6 feat(lsp): improve vim.lsp.util.apply_text_edits (#15561)
- Fix the cursor position after applying TextEdits
- Support reversed range of TextEdit
- Invoke nvim_buf_set_text one by one
2021-09-26 11:28:28 -07:00
Michael Lingelbach
7b1315fe61 feat(lsp): improve logging (#15636)
* Simplify rpc encode/decode messages to rpc.send/rcp.receive
* Make missing handlers message throw a warning
* Clean up formatting style in log
* Move all non-RPC loop messages to trace instead of debug
* Add format func option to log to allow newlines in per log entry
2021-09-26 11:28:28 -07:00
Mathias Fußenegger
27bac13be6 fix(lsp): update lsp-handler signature in call_hierarchy (#15738)
This fixes the handler signature and also prevents n+1 requests firing
if there are multiple clients.

(The first `prepareCallHierarchy` handler is called once per client,
each invocation used `buf_request` to make more requests using *all*
clients)
2021-09-26 10:25:17 -07:00
Mathias Fußenegger
d26d489e2e fix(lsp): adapt codelens resolve to handler signature change (#15578)
Follow up to https://github.com/neovim/neovim/pull/15504
2021-09-26 10:25:17 -07:00
Jose Alvarez
a6eab6e25e fix(lsp): update workspace/applyEdit handler signature (#15573) 2021-09-26 10:25:17 -07:00
Michael Lingelbach
cd8f6c5fb7 feat(lsp)!: change handler signature #15504 2021-09-26 10:25:17 -07:00
Jose Alvarez
132053c1d2
backport: fix(lsp): resolve bufnr in buf_is_attached (#15523) 2021-09-16 14:53:45 +01:00
notomo
f7002337c0
backport: fix(lua): verify buffer in highlight.on_yank (#15482)
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.
2021-09-16 14:46:27 +01:00
Mathias Fussenegger
a265201307
backport: fix(lsp): Ensure human readable errors are printed
`return err_message(tostring(err))` caused errors to be printed as
`table: 0x123456789` instead of showing the error code and error
message.

This also removes some `if err` blocks that never got called because at
the end of `handlers.lua` all the handlers are wrapped with logic that
adds generic error handling.
2021-09-16 14:37:20 +01:00
Mathias Fussenegger
33000bd9cf
backport: fix(lsp): Ensure users get feedback on references/symbols errors or empty results
Relates to https://github.com/neovim/neovim/issues/15050

Users should get some indication if there was an error or an empty
result.
2021-09-16 14:36:49 +01:00
Oliver Marriott
9f73b7c214
backport: fix(lsp): correctly check for windows in lsp logger (#14954) 2021-09-16 14:31:49 +01:00
Folke Lemaitre
eaa1c47377
backport: fix(lsp): restore diagnostics extmarks that were moved to the last edit line (#15023) 2021-09-16 14:26:05 +01:00
Justin M. Keyes
f809664f89 ci: skip "cancels stale events on channel close" #15278
- ref #14083 #15251
- also: docs: naming conventions
2021-09-14 07:51:01 -07:00
Justin M. Keyes
d83df7f7b5 feat(lua)!: register_keystroke_callback => on_key
Analogous to nodejs's `on('data', …)` interface, here on_key is the "add
listener" interface.

ref 3ccdbc570d #12536

BREAKING_CHANGE: vim.register_keystroke_callback() is now an error.
2021-09-14 07:29:46 -07:00
hrsh7th
64dc7a1b55 fix(lsp): correctly parse LSP snippets #15579
Fixes #15522
2021-09-14 07:11:40 -07:00
Shadman
a9cca1b050
backport: fixup(clipboard): Fix error not properly handled #14984
fixes #14967
2021-09-14 13:15:39 +01:00
Folke Lemaitre
989ccb8222
backport: fix(lsp): restore diagnostics extmarks on buffer changes (#15011) 2021-09-14 13:15:38 +01:00
Folke Lemaitre
2ae4c96d91
backport: fix(lsp): prevent double <text> for cached plaintext markup 2021-09-14 13:15:38 +01:00
jadedpasta
ae89330ec0
backport: fix(vim.opt): vimL map string values not trimmed (#14982)
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>
2021-09-14 13:15:38 +01:00
Shadman
2229e99ef9
backport: fixup(clipboard): Use case matching #14962
Context: https://github.com/neovim/neovim/pull/14848#discussion_r663203173
2021-09-14 13:15:37 +01:00
Gregory Anders
915dda3f96
feat(job): add parameter to close stdin
Some programs behave differently when they detect that stdin is being
piped. This can be problematic when these programs are used with the job
control API where stdin is attached, but not typically used. It is
possible to run the job using a PTY which circumvents this problem, but
that includes a lot of overhead when simply closing the stdin pipe would
suffice.

To enable this behavior, add a new parameter to the jobstart options
dict called "stdin" with two valid values: "pipe" (the default)
implements the existing behavior of opening a channel for stdin and
"null" which disconnects stdin (or, if you prefer, connects it to
/dev/null). This is extensible so that other modes can be added in the
future.
2021-08-26 21:56:45 -04:00
Justin M. Keyes
b6b12ea7c3
fix(man.vim): filetype=man is too eager #15489
Problem:
"set filetype=man" assumes the user wants :Man features, this does extra
stuff like renaming the buffer as "man://".

Solution:
- old entrypoint was ":set filetype=man", but this is too presumptuous #15487
- make the entrypoints more explicit:
  1. when the ":Man" command is run
  2. when a "man://" buffer is opened
- remove the tricky b:man_sect checks in ftplugin/man.vim and syntax/man.vim
- MANPAGER is supported via ":Man!", as documented.

fixes #15487
2021-08-26 02:50:30 -07:00
James McCoy
78482138ae
fix: add 0.5.0 release to appdata
[skip ci]
2021-08-21 14:36:12 -04:00
Dimitri Tcaciuc
8b07653902
doc(options): Fix recommended PowerShell config (#14349)
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
2021-07-02 08:15:40 -04:00
Christian Clason
2dd7828511
runtime/vim: d2ea7cf10a4d026ebd402594d656af7d5c811c24 (#14950)
Port vim syntax file only.
2021-07-01 17:31:30 -04:00
shadmansaleh
21444552c0 BugFix(clipboard): Fix block paste not working properly
Block copy and paste from system-clipboard currently breaks formatting.
This fixes it.

The bug occurs because system-clipboard doesn't contain information
about what mode the copy was made.
Simple solution to this is we keep a cache of copy we last made along
with mode information. If system-clipboard returns the cache we apply
the mode information that we know about that cache.
2021-07-01 15:01:01 +06:00
TJ DeVries
19b7cef0a7 fix(vim.opt): Fix #14828 with empty values being incorrectly inserted 2021-06-29 09:18:59 -04:00
TJ DeVries
6ecec87c09 fix(vim.opt): Fix #14668 Now correctly handles unescaped commas in isfname style 2021-06-29 08:42:07 -04:00
TJ DeVries
9119ea1bec fix(vim.opt): Fix #14669 whichwrap now acts as expected 2021-06-29 08:42:07 -04:00
David Zhang
b02e64c4df fix(vim.opt): Add basic error handling 2021-06-29 08:42:07 -04:00
ckipp01
e6175f6389 fix(vim.opt): Get window options before setting.
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`.
2021-06-29 08:42:07 -04:00
TJ DeVries
1d3ee1c441 fix(vim.opt): #14708 Now lets you put duplicate values in wildmode 2021-06-29 08:42:07 -04:00
Daniel Steinberg
f83c25942d
fix(doc/api): Remove 'border' as unsupported (#14916)
PR #13998 added support for floating window borders.
2021-06-28 20:40:56 -04:00
Matthieu Coudron
3552916cb9
fix(doc): remove reference to vim.lsp.callbacks (#14576)
too old now, can be confusing
2021-06-28 23:02:17 +02:00
John Gehrig
5aaa1a1c04
[RDY] Add buffer information to tabline_update (#12481)
* 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.
2021-06-27 15:30:09 -04:00
jimman2003
bdf3df4027
Fixed +1 -1 in util.lua (#14913)
No point in adding and then subtracting I believe ;)
2021-06-26 13:43:18 -04:00
Jan Edmund Lazo
7a239a8a9a
vim-patch:8.2.2954: short file name extension for Scala not recognized
Problem:    Short file name extension for Scala not recognized.
Solution:   Recognize *.sc. (closes vim/vim#8337)
6db7b6375a
2021-06-26 11:43:35 -04:00
Jan Edmund Lazo
eb7e7ad882
vim-patch:8.2.3049: JSON patch file not recognized
Problem:    JSON patch file not recognized.
Solution:   Recognize json-patch as json. (Kevin Locke, closes vim/vim#8450)
6582e230a0
2021-06-26 11:37:57 -04:00
Jan Edmund Lazo
750ad18845
vim-patch:8.2.3050: cannot recognize elixir files
Problem:    Cannot recognize elixir files.
Solution:   Recognize Elixir-specific files.  Check if an .ex file is Euphoria
            or Elixir. (Austin Gatlin, closes vim/vim#8401, closes vim/vim#8446)
f3caeb63d6
2021-06-26 10:51:29 -04:00
Sean Dewar
c1120ad0e1
fix(doc/usr_41): don't mention 0o prefix for octs (#14906)
v8.2.0886 isn't ported yet.
Also remove mentions of Vim9 and legacy script for now.

[skip ci]
2021-06-25 20:10:58 -04:00
Folke Lemaitre
e680d7d6af
fix(lsp): render the last line in stylize_markdown 2021-06-25 11:45:42 -07:00