Commit Graph

19527 Commits

Author SHA1 Message Date
Michael Lingelbach
3451121a4e
fix(lsp): send textDocument/didChange for each buffer (#16431)
Co-authored-by: Mathias Fussenegger <f.mathias@zignar.net>
2021-11-26 10:54:58 +01:00
Michael Lingelbach
102e7e7929
fix(lsp): require bufnr for apply_text_edits (#16444) 2021-11-26 10:36:37 +01:00
Mathias Fußenegger
72d62aa6aa
chore(docs): clarify vim.notify log_level parameter (#16436) 2021-11-25 20:06:42 +01:00
Gregory Anders
150a5922aa
feat(diagnostic)!: make DiagnosticChanged a first class autocmd (#16098)
This allows users to hook into diagnostic events with finer granularity
(e.g. per-buffer or file).

BREAKING CHANGE: DiagnosticsChanged and LspDiagnosticsChanged user
autocommands are removed.
2021-11-25 11:55:11 -07:00
Michael Lingelbach
1a60580925
feat(lsp): use uv_spawn to check if server executable (#16430)
Previously, the built-in language server client checked if the first
argument of cmd was executable via vim.fn.executable. This ignores PATH
injected via cmd_env. Instead, we now start the client via uv.spawn, and
handle the failure mode, reporting the error back to the user.

Co-authored-by: Mathias Fußenegger <mfussenegger@users.noreply.github.com>
2021-11-25 07:54:45 -05:00
Michael Lingelbach
6ea5e80393
Merge pull request #16434 from gpanders/diagnostic-clampage
fix(diagnostic): line clamping fixes
2021-11-25 07:28:46 -05:00
Gregory Anders
b5b025f6a3
fix(diagnostic): do not focus floats in goto functions (#16433)
Floating windows opened by `goto_next` and `goto_prev` should not be
focused when repeating the `goto_` function. The float can still be
focused by calling `open_float` with `scope = "cursor"`.
2021-11-24 21:45:42 -07:00
Gregory Anders
0341c687a3 fix(diagnostic): don't clamp line numbers in setqflist
Reverts 5b0d8f85fd.

Diagnostic producers can send diagnostics for buffers that are not
loaded, for which we cannot retrieve the line count to clamp line
numbers. This means that some diagnostics in the quickfix list could be
line-clamped and others not. The quickfix list can already handle line
numbers past the end of the buffer (i.e. it *already* clamps line
numbers) so just use the "raw" diagnostic positions sent from the
producer.
2021-11-24 20:03:48 -07:00
Gregory Anders
25ab7c6c0a test(diagnostic): uncomment equality check 2021-11-24 20:03:38 -07:00
Gregory Anders
c59f2008e0 fix(diagnostic): get line count per buffer when clamping
Fixes a bug when `get_diagnostics` is called with a nil `bufnr`.
Diagnostics should be clamped for the buffer they reside in, not the
current buffer.
2021-11-24 20:03:36 -07:00
Mathias Fußenegger
f2722884a8
perf(lsp)!: use faster line retrieval for utf-16 to byte idx conversion (#16360) 2021-11-24 20:49:34 -05:00
ii14
c132144d24
fix(ui): use nowait for q mapping in floating window (#16427) 2021-11-24 15:57:33 -07:00
Javier Lopez
a2e5c2f7c8
fix(fileio): replace characters over INT_MAX with U+FFFD (#16354)
fixes #11877
credit: @zubairabid https://github.com/neovim/neovim/pull/12010
2021-11-23 21:07:47 -07:00
Christian Clason
dd8a4e2c22
Merge pull request #16402 from clason/treesitter-bump
build(deps): bump tree-sitter,treesitter-c to v0.20.1 and adapt tests
2021-11-23 20:13:51 +01:00
Christian Clason
5676edb86d fix(tests): adapt parser_spec test to tree-sitter bump
Change query to include anonymous nodes (`(_)` -> `[_]`) and
use new syntax (`{vim,lua}.match?`->`#{vim,lua}.match?`)
2021-11-23 18:38:22 +01:00
Gregory Anders
fd6df7481a
fix(diagnostic): resolve buffer number in get() (#16407) 2021-11-22 09:22:08 -07:00
Gregory Anders
e02d4732f2
fix(diagnostics): don't allow 0 bufnr for metatable index (#16405)
04bfd20bb introduced a subtle bug where using 0 as the buffer number in
the diagnostic cache resets the cache for the current buffer. This
happens because we were not checking to see if the _resolved_ buffer
number already existed in the cache; rather, when the __index metamethod
was called we assumed the index did not exist so we set its value to an
empty table. The fix for this is to check `rawget()` for the resolved
buffer number to see if the index already exists.

However, the reason this bug was introduced in the first place was
because we are simply being too clever by allowing a 0 buffer number as
the index which is automatically resolved to a real buffer number.
In the interest of minimizing metatable magic, remove this "feature" by
requiring the buffer number index to always be a valid buffer. This
ensures that the __index metamethod is only ever called for non-existing
buffers (which is what we wanted originally) as well as reduces some of
the cognitive overhead for understanding how the diagnostic cache works.
The tradeoff is that all public API functions must now resolve 0 buffer
numbers to the current buffer number.
2021-11-22 08:47:30 -07:00
Michael Lingelbach
33ce02ee4d
fix(lsp): avoid indexing vim.NIL for null workspaceFolders (#16404)
* internally represent no workspaceFolders as nil instead of vim.NIL
* rename workspaceFolders -> workspace_folders for consistency
2021-11-22 09:52:24 -05:00
Christian Clason
cfa5d06801
docs(man): omit misleading mention of environment for -u NORC (#16379)
The phrase referred specifically to `$VIMINIT` and `$EXRC`, which
are parsed (and available with, e.g., `echo $VIMINIT` if set) but
of course not loaded since _any_ initialization is skipped. Hence
this is redundant and can be misleading.
2021-11-22 12:00:04 +01:00
Christian Clason
faae47eddb build(deps): also bump treesitter-c to v0.20.1 2021-11-22 11:05:24 +01:00
Christian Clason
e6c46bac3f
vim-patch:88a4205f1cfb (#16399)
Update runtime files
88a4205f1c
2021-11-22 10:53:57 +01:00
Christian Clason
e1cea4b38d build(deps): bump tree-sitter to 0.20.1 2021-11-22 10:26:17 +01:00
Jan Edmund Lazo
64abd7be79
Merge pull request #16341 from zeertzjq/vim-8.2.2518
vim-patch:8.2.{2518,2520,3572,3588}: 'listchars' (and 'fillchars'?) fixes
2021-11-21 22:21:32 -05:00
zeertzjq
e05db65d2a
vim-patch:8.2.3627: difficult to know where the text starts in a window (#16377)
vim-patch:8.2.3627: difficult to know where the text starts in a window

Problem:    difficult to know where the text starts in a window. (Sergey
            Vlasov)
Solution:   Add the "textoff" entry in the result of getwininfo().
            (closes vim/vim#9163)
cdf5fdb294

Fix indent in Test_getbufwintabinfo().
2021-11-21 21:10:03 -05:00
Jan Edmund Lazo
f45b2f313e
Merge pull request #16386 from VVKot/vim-8.2.2922
vim-patch:8.2.2922,8.2.3639
2021-11-21 20:41:56 -05:00
smolck
04bfd20bb8
fix(diagnostic): remove invalid buffers from cache (#16397)
Errors were being caused by invalid buffers being kept around in
diagnostic_cache, so add a metatable to diagnostic_cache which attaches
to new buffers in the cache, removing them after they are invalidated.

Closes #16391.

Co-authored-by: Gregory Anders <8965202+gpanders@users.noreply.github.com>
2021-11-21 18:40:06 -07:00
Jan Edmund Lazo
0d967f0298
Merge pull request #16362 from zeertzjq/vim-8.2.3617
vim-patch:8.2.{3468,3617,3618,3622}: some other CWD related patches
2021-11-21 17:47:09 -05:00
Gregory Anders
d99d4af7b1
Merge pull request #16370 from gpanders/diagnostic-column-clamp 2021-11-21 12:06:44 -07:00
Michal Liszcz
85707a3395
vim-patch:8.2.3255: ci" finds following string but ci< and others don't (#16324)
Problem:    ci" finds following string but ci< and others don't.
Solution:   When not inside an object find the start. (Connor Lane Smit,
            closes vim/vim#8670)
b9115da4be
2021-11-21 14:00:50 -05:00
Volodymyr Kot
9d0726f6d8
vim-patch:8.1.1606: on a narrow screen ":hi" output is confusing (#16388)
Problem:    On a narrow screen ":hi" output is confusing.
Solution:   Insert a space between highlight group name and "xxx". (Masato
            Nishihaga, closes vim/vim#4599)
548be7f126
2021-11-21 13:10:24 -05:00
ii14
9d868317f9
vim-patch:8.2.3638: getcompletion() always passes zero as position (#16387)
Problem:    getcompletion() always passes zero as position to custom
            completion function.
Solution:   Pass the pattern length. (closes vim/vim#9173)
4785fe02bb

Co-authored-by: ii14 <ii14@users.noreply.github.com>
2021-11-21 13:00:51 -05:00
Dmytro Meleshko
134a6385e2
fix(lsp): send buffer contents joined on fileformat-specific linebreak (#16334) 2021-11-21 12:03:45 -05:00
Michael Lingelbach
a2749482d9
chore(lsp): clean up initialization process (#16369)
* send vim.NIL instead of not sending workspaceFolders
* read fallback rootPath and rootUri from workspaceFolders
* update documentation
2021-11-21 11:39:30 -05:00
VVKot
ad71ecb49b vim-patch:8.2.3639: line commented out accidentally
Problem:    Line commented out accidentally.
Solution:   Uncomment. (Volodymyr Kot, closes vim/vim#9172)
7f0c4b418e
2021-11-21 13:53:50 +00:00
VVKot
ddc401a91c vim-patch:8.2.2922: computing array length is done in various ways
Problem:    Computing array length is done in various ways.
Solution:   Use ARRAY_LENGTH everywhere. (Ken Takata, closes vim/vim#8305)
eeec254878
2021-11-21 08:20:38 +00:00
Jan Edmund Lazo
120a881630
Merge pull request #14540 from Shougo/fix_vim8.1.1378
[RFC] Improve tests
2021-11-20 22:46:34 -05:00
Volodymyr Kot
2bd8f2fb5e
vim-patch:8.1.0753: printf format not checked for semsg() (#16378)
Problem:    printf format not checked for semsg().
Solution:   Add GNUC attribute and fix reported problems. (Dominique Pelle,
            closes vim/vim#3805)
b5443cc46d

(Most of the changes do not apply because Neovim already uses PRId64 and other spelling mistakes were already fixed.)
2021-11-20 13:26:16 +01:00
dundargoc
725cbe7d41
refactor: saner options for uncrustify (#16204)
* sp_enum_after_assign = force
* sp_brace_typedef = force
* nl_do_brace = remove
* sp_do_brace_open = force
* sp_brace_close_while = force
* sp_before_semi = remove
* sp_before_semi_for = remove
* sp_before_semi_for_empty = remove
* sp_between_semi_for_empty = remove
* sp_after_semi_for_empty = remove
* sp_before_square = remove
* sp_before_squares = remove
* sp_inside_square = remove
* sp_inside_fparens = remove
* sp_inside_fparen = remove
* sp_inside_tparen = remove
* sp_after_tparen_close = remove
* sp_return_paren = force
* pos_bool = lead
* sp_pp_concat = remove
* sp_pp_stringify = remove
* fixup: disable formatting for the INIT section
2021-11-19 14:21:53 -05:00
Gregory Anders
5b0d8f85fd fix(diagnostic): clamp line numbers in setqflist and setloclist 2021-11-19 11:49:44 -07:00
Gregory Anders
34bb5fa5a9 fix(diagnostic): fix navigation with diagnostics placed past end of line 2021-11-19 11:37:45 -07:00
Gregory Anders
2abc799ffd fix(diagnostic): deepcopy diagnostics before clamping line numbers
The current 'clamp_line_numbers' implementation modifies diagnostics in
place, which can have adverse downstream side effects. Before clamping
line numbers, make a copy of the diagnostic. This commit also merges the
'clamp_line_numbers' method into a new 'get_diagnostics' local function
which also implements the more general "get" method. The public
'vim.diagnostic.get()' API now just uses this function (without
clamping). This has the added benefit that other internal API functions
that need to use get() no longer have to go through vim.validate.

Finally, reorganize the source code a bit by grouping all of the data
structures together near the top of the file.
2021-11-19 11:37:45 -07:00
James McCoy
9ec4417afc
Merge pull request #16066 from neovim/marvim/ci-version-update
version.c: update [skip ci]
2021-11-19 11:54:24 -05:00
James McCoy
7942fb7074
Merge pull request #16091 from neovim/marvim/api-doc-update/master
docs: regenerate
2021-11-19 11:53:53 -05:00
Christian Clason
a7ad509902
fix(eval): fixup for empty modifier in fnamemodify (#16368)
* fix(eval): fixup for empty modifier in fnamemodify

1dbbaf89bf
erroneously removed a check for empty modifier and a PVS fix. 
Restore that check and fix.

Fixes #16367

Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2021-11-19 16:13:49 +01:00
zeertzjq
349b9ce9df vim-patch:8.2.3622: "verbose pwd" shows confusing info
Problem:    "verbose pwd" shows confusing info when :lcd does not change
            directory.
Solution:   Clear last_chdir_reason also when the directory does not change.
            (closes vim/vim#9160)
64be6aa3a5

This only ports the tests, as this is already Nvim's behavior.
2021-11-19 20:07:04 +08:00
zeertzjq
3d504f27a0 vim-patch:8.2.3618: getcwd() is unclear about how 'autochdir' is used
Problem:    getcwd() is unclear about how 'autochdir' is used.
Solution:   Update the help for getcwd().  Without any arguments always return
            the actual current directory. (closes vim/vim#9142)
851c7a699a
2021-11-19 20:07:04 +08:00
zeertzjq
54e9cce612 revert: partially revert #9894
Vim has a solution to #9892 with fewer side-effects in patch 8.2.3618
2021-11-19 20:07:04 +08:00
zeertzjq
4785cad8ee vim-patch:8.2.3617: ":verbose pwd" does not mention 'autochdir' was applied
Problem:    ":verbose pwd" does not mention 'autochdir' was applied.
Solution:   Remember the last chdir was done by 'autochdir'.  (issue vim/vim#9142)
0526815c15
2021-11-19 20:07:04 +08:00
zeertzjq
0f58ba10e2 vim-patch:8.2.3468: problem with :cd when editing file in non-existent directory
Problem:    Problem with :cd when editing file in non-existent directory. (Yee
            Cheng Chin)
Solution:   Prepend the current directory to get the full path. (closes vim/vim#8903)
c6376c7984
2021-11-19 20:07:04 +08:00
Shougo Matsushita
2c431943d6 fix: remove unneeded gzip check 2021-11-19 13:45:41 +09:00