Commit Graph

3843 Commits

Author SHA1 Message Date
Michael Lingelbach
c5525f265b
fix(lsp): avoid duplicates in client attached buffers (#16099)
closes https://github.com/neovim/neovim/issues/16058

* add client.attached_buffers
* only update client.attached_buffers in on_attach
* use table instead of list for attached_buffers to avoid duplication
2021-10-20 09:33:09 -07:00
Mathias Fußenegger
dc6c9fe442
fix(lsp): adjust legacy show diagnostic functions to use correct scope (#16106)
* `where` was renamed to `scope`
2021-10-20 08:27:55 -07:00
Gregory Anders
427bac6877
fix(diagnostic): allow floats to be focusable (#16093)
Setting focus_id allows the float to be focused by calling the function
a second time (a feature of open_floating_preview).
2021-10-19 16:29:52 -06:00
Gregory Anders
a2994c82e3
fix(diagnostic): handle diagnostics placed past the end of line (#16095) 2021-10-19 16:27:49 -06:00
Björn Linse
208d259e83
Merge pull request #15767 from lewis6991/lua_var_index
feat(lua): allow passing handles to `vim.b/w/t`
2021-10-19 22:21:31 +02:00
Gregory Anders
dfef90a518
fix(gen_vimdoc.py): spacing around inline elements #16092
The spacing fix drew attention to a couple of places that were using
incorrect formatting such as the key listing for `nvim_open_win`, so
those were fixed too.
2021-10-19 12:55:22 -07:00
Lewis Russell
6c5e7bde9a feat(lua): allow passing handles to vim.b/w/t
vim.bo can target a specific buffer by indexing with a number, e.g:
`vim.bo[2].filetype` can get/set the filetype for buffer 2. This change
replicates that behaviour for the variable namespace.
2021-10-19 19:47:33 +01:00
Gregory Anders
064411ea7f
refactor(diagnostic)!: replace 'show_*' functions with 'open_float' (#16057)
'show_line_diagnostics()' and 'show_position_diagnostics()' are
almost identical; they differ only in the fact that the latter also
accepts a column to form a full position, rather than just a line. This
is not enough to justify two separate interfaces for this common
functionality.

Renaming this to simply 'show_diagnostics()' is one step forward, but
that is also not a good name as the '_diagnostics()' suffix is
redundant. However, we cannot name it simply 'show()' since that
function already exists with entirely different semantics.

Instead, combine these two into a single 'open_float()' function that
handles all of the cases of showing diagnostics in a floating window.
Also add a "float" key to 'vim.diagnostic.config()' to provide global
values of configuration options that can be overridden ephemerally.
This makes the float API consistent with the rest of the diagnostic API.

BREAKING CHANGE
2021-10-19 11:45:51 -06:00
sim
aa4f0879e3
feat(lsp): set codelens virtual text hl_mode to combine (#16048)
It looks a bit off with the extmark going over the cursorline.

(With hl_mode combine it keeps the background of the cursorline under the codelens virtualtext)
2021-10-19 18:41:57 +02:00
zeertzjq
bdd180b5d2
docs: clarify chdir/CWD behaviors #16083 2021-10-19 07:37:11 -07:00
William Chargin
9fb0f12357
feat(man.vim): convert spaces to underscores #16068
PostgreSQL ships with man pages for SQL statements like `CREATE TABLE`,
which are provided with underscores as `man 7 CREATE_TABLE`. This patch
updates `man#open_page` (as used by `:Man`) such that visually selecting
the words `CREATE TABLE` in SQL code and pressing `K` properly opens the
desired man page.

Writing `:Man CREATE TABLE` still does not work, since `CREATE` is
interpreted as a section name. (Similarly, `:Man CREATE TABLE AS` fails
because there are too many arguments to `:Man`.) But this is okay,
because if you're typing it anyway then you can just enter underscores
and also tab-completion properly suggests `:Man CREATE_TABLE(7)`.

This is a bit bespoke, but my box has over 9000 man pages (as reported
by `man -k '' | wc -l`), and not one of them has a space in the man page
name, whereas the Postgres manuals do exist and are actually useful.

Test Plan:
On a machine with Postgres manual pages, running

    nvim -u NORC +'exe "norm iCREATE TABLE foo(x int);" | norm 0veeK'

should open the appropriate man page.

wchargin-branch: man-spaces-to-underscores
2021-10-19 07:24:43 -07:00
github-actions[bot]
29b718d04c
docs: regenerate (#15986)
Co-authored-by: marvim <marvim@users.noreply.github.com>
2021-10-19 06:03:20 -07:00
Josa Gesell
e7ea54a3df
feat(lsp): use vim.ui.select() in codelenses (#16004)
Co-authored-by: Michael Lingelbach <m.j.lbach@gmail.com> Mathias Fußenegger <mfussenegger@users.noreply.github.com>
2021-10-18 11:52:22 -07:00
hrsh7th
bd2f61c6c4
fix(lsp): fix cursor row after textEdits (#16038) 2021-10-18 11:49:33 -07:00
Gregory Anders
bcc9ba51fa
fix(lsp): persist diagnostic config for clients
Persist configuration settings set with `vim.lsp.with` and
`vim.lsp.diagnostic.on_publish_diagnostics` by setting the config for
the namespace associated with the client.
2021-10-18 10:01:41 -06:00
Jakub Łuczyński
6b0a2e6996 build(install): rescan GLOB files on rebuild 2021-10-18 11:44:15 +02:00
Jan Edmund Lazo
a1e8199fff
Merge pull request #15952 from zeertzjq/vim-8.1.1291
vim-patch:8.0.{1459,1460,1461,1463},8.1.{0602,0604,1291},8.2.{0189,0876,0909,1411}: chdir and DirChanged related patches
2021-10-17 10:26:11 -04:00
Gregory Anders
d2d30dfabd
fix(diagnostic): do not override existing config settings #16043
When using `true` as the value of a configuration option, the option is
configured to use default values. For example, if a user configures
virtual text to include the source globally (using
vim.diagnostic.config) and a specific namespace or producer configures
virtual text with `virt_text = true`, the user's global configuration is
overriden.

Instead, interpret a value of `true` to mean "use existing settings if
defined, otherwise use defaults".
2021-10-17 07:18:35 -07:00
zeertzjq
6004f9137a refactor(dirchanged): tab -> tabpage
Match Vim's behavior.
2021-10-17 22:04:53 +08:00
zeertzjq
34cfe74568 vim-patch:8.2.0876: :pwd does not give a hint about the scope of the directory
Problem:    :pwd does not give a hint about the scope of the directory
Solution:   Make ":verbose pwd" show the scope. (Takuya Fujiwara, closes vim/vim#5469)
950587242c
2021-10-17 22:04:53 +08:00
zeertzjq
8727d38012 vim-patch:8.1.1291: not easy to change directory and restore
Problem:    Not easy to change directory and restore.
Solution:   Add the chdir() function. (Yegappan Lakshmanan, closes vim/vim#4358)
1063f3d200

Also includes some documentation changes from patch 8.1.1218.
2021-10-17 22:04:53 +08:00
zeertzjq
920473d2f2 vim-patch:8.0.1459: cannot handle change of directory
Problem:    Cannot handle change of directory.
Solution:   Add the DirChanged autocommand event. (Andy Massimino,
            closes vim/vim#888)  Avoid changing directory for 'autochdir' too often.
b7407d3fc9

Only add "auto" pattern. "window" and "global" are already implemented.
Skip `Test_dirchanged_auto` using `CheckFunction test_autochdir`.
Part of PR #15952. More information can be found there.

N/A patches for version.c:

vim-patch:8.0.1460: missing file in patch

Problem:    Missing file in patch.
Solution:   Add changes to missing file.
b5cb65ba2b

vim-patch:8.0.1461: missing another file in patch

Problem:    Missing another file in patch.
Solution:   Add changes to missing file.
15833239a4
2021-10-17 22:04:53 +08:00
dundargoc
f19dc06081
vim-patch:8.2.3519: TOML files are not recognized (#16045)
Problem:    TOML files are not recognized.
Solution:   Add filetype patterns for TOML. (Aman Verma, closes vim/vim#8984)
28b6a3bef6
2021-10-16 23:38:05 +02:00
Christian Clason
0ba77f2f31 vim-patch:2286304cdbba
Update runtime files
2286304cdb
2021-10-16 18:03:51 +02:00
dundargoc
1ced6cf08c
vim-patch:8.2.3501: tmux filetype dection is incomplete (#16021)
Problem:    tmux filetype dection is incomplete
Solution:   Also use tmux for files having text after .conf. (Eric Pruitt,
            closes vim/vim#8971)
e519eb41c1
2021-10-15 20:01:36 -04:00
Michael Lingelbach
68b2a9e569
fix: correctly capture uri scheme on windows (#16027)
closes https://github.com/neovim/neovim/issues/15261

* normalize uri path to forward slashes on windows
* use a capture group on windows that avoids mistaking drive letters as uri scheme
2021-10-15 12:03:41 -07:00
Javier Lopez
5365f24168
fix(heath/provider.vim): using list as string #16007
Fixes #15988
2021-10-12 20:06:19 -07:00
Jose Alvarez
ee342d3cef
fix(lsp): maintain client_ids table structure when filtering (#15991) 2021-10-11 08:52:11 -07:00
Michael Lingelbach
d288daac2b
fix(lsp): do not invoke handlers for unsupported methods (#15926)
Closes https://github.com/neovim/neovim/issues/15174

Instead of invoking handlers with unsupported methods, pre-compute which
clients support a given method and only notify the user if no clients
support the given method.
2021-10-10 22:32:50 -07:00
Jan Edmund Lazo
b3e0d6708e
Merge pull request #15502 from seandewar/vim-8.1.1921
Add method call support for more built-ins: vim-patch:8.1.{1336,1952,1961,1984}
2021-10-10 16:48:24 -04:00
jdrouhard
45fa70adcb
fix(lsp): add done flag to messages returned in util.get_progress_messages() (#15985) 2021-10-10 11:41:16 -07:00
zeertzjq
f4359b5dbd
vim-patch:8.2.3461: distinguish Normal and Terminal-Normal mode #15878
Problem:    Cannot distinguish Normal and Terminal-Normal mode.
Solution:   Make mode() return "nt" for Terminal-Normal mode. (issue vim/vim#8856)
72406a4bd2
2021-10-09 18:15:46 -07:00
Jakub Łuczyński
a36c6e5df9
fix(checkhealth): duplicate checks if module name has "-" #15935
Problem:    Some plugins have structure `lua/nvim-someplugin/..`
            Since `-` is not allowed in vim function names, healthcheck names in
            lua and in vim can not have the same name (typically vim will use `_`
            instead of `-`).
Solution:   Normalize the names before checking for duplicates.
2021-10-08 17:36:35 -07:00
francisco souza
fcc11d5942
fix(lsp): add textDocument/prepareRename to capability map (#15961)
This is a simple fix for #15899, as it should at least stop calling
`prepareRename` on servers that don't support renaming.

I imagine a better fix would be to inspect the actual value for, but
that requires some plumbing changes on how capabilities are evaluated
before sending requests out.

Co-authored-by: francisco souza <fsouza@users.noreply.github.com>
2021-10-08 11:30:18 -07:00
Gregory Anders
d5dd0aa1e6
fix(diagnostic): error on invalid severity value (#15965)
Users can pass string values for severities that match with the enum
names (e.g. "Warn" or "Info") which are converted to the corresponding
numerical value in `to_severity`. Invalid strings were simply left
as-is, which caused confusing errors later on. Instead, report an
invalid severity string right up front to make the problem clear.
2021-10-08 12:28:02 -06:00
Rishikesh Vaishnav
3f09732195
fix(lsp): expose ContentModified error code to callbacks (#15262) 2021-10-08 11:19:33 -07:00
Mathias Fußenegger
e9d6f7ca6c
feat(lsp): utilize textEdit.range for startbyte in omnifunc (#15957)
Closes https://github.com/neovim/neovim/issues/15784
2021-10-08 08:47:59 -07:00
Gregory Anders
7f93b2ab01
fix: support severity_sort option for show_diagnostic functions (#15948)
Support the severity_sort option for show_{line,position}_diagnostics.
2021-10-07 19:19:30 -06:00
Tejasvi S. Tomar
e16adbf238
fix(provider): compare versions as number, not string #15937
"3.10" < "3.3" but v3.10 > v3.3
Fixes #14586
2021-10-07 14:27:40 -07:00
Sean Dewar
b55944e8af
feat(diagnostic): update jumplist on goto_next/prev (#15942) 2021-10-07 08:46:17 -07:00
Yorick Peterse
c61a3865ee
fix: set cursorlineopt=number in terminal mode (#15493)
When entering terminal mode, cursorlineopt is no longer entirely
disabled. Instead, it's set to `number`. Doing so ensures that users
using `set cursorline` combined with `set cursorlineopt=number` have
consistent highlighting of the line numbers, instead of this being
disabled when entering terminal mode.

Co-authored-by: Gregory Anders <greg@gpanders.com>
Co-authored-by: Sean Dewar <seandewar@users.noreply.github.com>
2021-10-06 16:31:14 -06:00
dundargoc
1034f7d7b1
vim-patch:8.2.0017: OS/2 and MS-DOS are still mentioned #15928
Problem:    OS/2 and MS-DOS are still mentioned, even though support was
            removed long ago.
Solution:   Update documentation. (Yegappan Lakshmanan, closes vim/vim#5368)
6f345a1458
2021-10-06 06:14:56 -07:00
Javier Lopez
acd5e831b6
fix(checkhealth): mitigate issues with duplicate healthchecks #15919
* fix(runtime/health): mitigate issues with duplicate healthchecks
  Previously if a healthcheck was found as Lua and Vim it was executed
  both times.
  This new implementations prefers Lua, therefore if two are found It only
  runs the Lua one, this way a plugin can mantain both implementations the
  Lua one with the method `check()` and the autoload function `#check()`
  (for none HEAD nvim versions).
  **Note: This will require plugins to use `check()` as the function name,
  since the autoload function that wraps the lua implementation won't be
  called**
* docs(health): use spaces and don't overuse backtics

followup to #15259
2021-10-05 15:37:39 -07:00
github-actions[bot]
59edd377d3
docs: regenerate #15545 2021-10-05 10:48:48 -07:00
Javier Lopez
49fdc62114
feat(api): named marks set, get, delete #15346
Adds the following API functions.

- nvim_buf_set_mark(buf, name, line, col)
  * Set marks in a buffer.
- nvim_buf_del_mark(buf, name)
  * Delete a mark that belongs to buffer.
- nvim_del_mark(name)
  * Delete a global mark.
- nvim_get_mark(name)
  * Get a global mark.

Tests:

- Adds test to all the new api functions, and adds more for the existing
  nvim_buf_get_mark.
    * Tests include failure cases.

Documentation:

- Adds documentation for all the new functions, and improves the
  existing fucntion docs.
2021-10-05 08:49:20 -07:00
Michael Lingelbach
912a6e5a9c
feat(lsp): improve json deserialization performance (#15854)
* Add optional second table argument to vim.json.decode which takes
  a table 'luanil' which can include the 'object' and/or 'array' keys. These
  options use luanil when converting NULL in json objects and arrays
  respectively. The default behavior matches the original lua-cjson.
* Remove recursive_convert_NIL function from rpc.lua, use
  vim.json.decode with luanil = { object = true } instead. This removes a hotpath
  in the json deserialization pipeline by dropping keys with json NULL
  values throughout the deserialized table.
2021-10-05 08:37:20 -07:00
Christian Clason
f6a9f0bfca
fix(vim-patch): add missing nginx runtime files (#15916)
Followup to incomplete runtime update https://github.com/neovim/neovim/pull/15911
2021-10-05 15:19:16 +02:00
zeertzjq
17f7c83f29
docs(intro.txt): change vimhelp.appspot.com to vimhelp.org (#15915)
Ref 6c1e1570b1 (diff-644ad027e3580bc940a6b7b4aaf1869bae267f7ff30e359e523d5de70e317106)
2021-10-05 06:49:15 -06:00
Christian Clason
0c2a7aa5f7
vim-patch:6e649224926b (#15911)
Update runtime files
6e64922492
2021-10-05 14:12:16 +02:00
Javier Lopez
0a7a215aa6
fix(healthcheck): update builtins to the new convention #15914
Adjust some builtin healthchecks to use Lua, after #15259
2021-10-05 05:05:33 -07:00
Christian Clason
a2734efdc2
vim-patch:8.2.3473: some tcl files are not recognized #15912
Problem:    Some files with tcl syntax are not recognized.
Solution:   Add a few file patterns. (Doug Kearns)
78aa5ffe31
2021-10-05 04:21:52 -07:00
Matthieu Coudron
93a7571fab
Merge pull request #15259 from muniter/muniter/checkhealth-from-lua
feat(checkhealth): support Lua healthchecks
2021-10-05 11:27:07 +02:00
zeertzjq
655e489e90
docs(develop.txt): nvim_open_win is now in win_config.c (#15909) 2021-10-04 20:10:07 -06:00
Javier López
8f2a8b50da docs(runtime/health): update with new lua support
- describe how the lua support works
- explain new behavior of :checkhealth *
- fixed formatting to use tab instead of spaces
2021-10-04 14:28:54 -05:00
Javier López
9249dcdda1 feat(runtime/health): support lua healthchecks
- Refactor health.vim to discover lua healthcheck in the runtime
  directories lua/**/health{/init}.lua
- Support healthchecks for lua submodules e.g :checkhealth vim.lsp and
  also support wildcard "*" at the end for all submodules
  :checkhealth vim*
- Refactor health.vim to use variable scope instead of output capturing
- Create health.lua module to wrap report functions and future
  extensibility.
- Move away from searching just in the runtimepath, use
  `nvim_get_runtime_file` due to #15632

Example:
Plugin linter in rtp can declare it's checkhealts in lua module
`lua/linter/health{/init}.lua` that returns a table with a method
"check" that when executed calls the report functions provided by the
builtin lua module require("health").

The plugin also has a submodule `/lua/linter/providers` in which it
defines `/lua/linter/providers/health{/init}.lua`

This plugin healthcheck can now be run by the ex command:
  `:checkhealth linter linter.providers`

Also calling all submodules can be done by:
  `:checkhealth linter*

And "linter" and "linter.provider" would be discovered when:
  `:checkhealth`
2021-10-04 14:28:54 -05:00
Aditya Kurdunkar
83fa8956c3
docs: fix typo 2021-10-04 13:09:32 -06:00
Gregory Anders
c7a63f35db
feat(startup): load builtin plugins with --clean #15893
Closes #15605
2021-10-04 07:01:49 -07:00
Gregory Anders
088026205f refactor: define diagnostic highlights in syntax.c 2021-10-03 20:06:06 -06:00
Justin M. Keyes
8a9f292991
Merge #15218 from gpanders/split-trimempty
feat(lua): add "noempty" param to vim.split()
2021-10-03 17:33:12 -07:00
dundargoc
a0bf28cd54
vim-patch:8.2.3469: some files with json syntax are not recognized (#15891)
Problem:    Some files with json syntax are not recognized.
Solution:   Add a few file patterns. (Emiliano Ruiz Carletti, closes vim/vim#8947)
50c5689342
2021-10-03 16:50:51 -06:00
Sean Dewar
a8504638cd
feat(eval/method): partially port v8.1.1987
Cannot be fully ported as the remote_*() functions from +clientserver
are not yet ported. Include the test changes anyway.

line()'s optional winid argument was already ported. (Wasn't added in
this patch; this just adds documentation)
2021-10-03 20:12:20 +01:00
Sean Dewar
c5583df3c0
vim-patch:8.1.1984: more functions can be used as methods
Problem:    More functions can be used as methods.
Solution:   Make various functions usable as a method.
3f4f3d8e7e

test_prompt_buffer.vim already had all the changes, except
Test_prompt_garbage_collect().
2021-10-03 20:12:20 +01:00
Sean Dewar
d23d37b212
vim-patch:8.1.1961: 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.  Add a test for
            mapcheck().
a144983633

mzeval() (if_mzscheme) is N/A.
2021-10-03 20:12:20 +01:00
Sean Dewar
86593beaa4
feat(eval/method): partially port v8.1.1954
Does not include listener_*() functions.

js_*() functions are N/A.

json_encode() and json_decode() didn't include tests; add some anyway
(to json_functions_spec.lua).

test_lua.vim isn't included yet, so add tests to luaeval_spec.lua.
2021-10-03 20:06:33 +01:00
Sean Dewar
59c8a1fd51
feat(eval/method): partially port v8.1.1953
Adds method call support for all functions in the patch, but it cannot
be fully ported due to missing tests for:

- index(): requires Blobs from v8.1.0735.
           Note that index() was already added as a method in v8.1.1803;
           this patch only adds a test.

- iconv(): requires v8.1.1136 for test_termcodes.vim.

Nvim deprecated inputdialog(), so it no longer has an eval.txt entry.

Keep the test for hlexists() commented-out, just like previously. (Nvim
always defines the Number group, so it always returns 1 instead)

Cannot include both changes to test_syn_attr.vim as Nvim doesn't support
":hi term=..."; however, both test the same ->hlID() syntax anyway.
2021-10-03 20:06:32 +01:00
Sean Dewar
8b7615c735
vim-patch:8.1.1952: 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.
5d69fdb7c4
2021-10-03 20:06:32 +01:00
Sean Dewar
3137c7d635
feat(eval/method): partially port v8.1.1925
Adds method call support for all functions in the patch, but it cannot
be fully ported due to missing tests for:

- getcwd(): requires chdir() and Test_chdir_func() from v8.1.1291.

Note that the method call tests for getreg() and getregtype() were
removed in v8.2.1547, which has already been ported, but doesn't seem to
have been replaced with a new test...

This patch also makes getchangelist()'s argument optional (defaults to
the current buffer).

eval.txt includes a typo for gettabwinvar(), which is fixed in
v8.1.1952.
2021-10-03 20:06:32 +01:00
Sean Dewar
6110480c29
feat(eval/method): partially port v8.1.1921
Adds method call support for all functions in the patch, but it cannot
be fully ported due to missing tests for:

- filereadable(): requires v8.1.1378 for Test_delete_rf(), but there
                  appears to have been some trouble porting it. (#12784)

- confirm(): requires v8.1.0832 for Test_confirm() and v8.1.0815 for
             feedkeys()'s "L" flag.

             (I did attempt to port the test using nvim_input() instead,
             but seems that input handling for confirm() doesn't work in
             --headless mode?)

             Note that confirm() was actually added as a method in
             v8.1.1915.

Uncomment use of method call syntax in Test_Executable() previously
included instead from v8.2.2259.
2021-10-03 20:06:31 +01:00
zeertzjq
7ba11e06c0
vim-patch:8.2.3466: completion submode not indicated for virtual replace (#15886)
Problem:    Completion submode not indicated for virtual replace.
Solution:   Add submode to "Rv". (closes vim/vim#8945)
cc8cd44533
2021-10-03 15:04:51 -04:00
zeertzjq
04b59ebd85
vim-patch:8.2.3465: cannot detect insert scroll mode (#15885)
Problem:    Cannot detect insert scroll mode.
Solution:   Add "scroll" to complete_info(). (closes vim/vim#8943)
27fef59dd1
2021-10-03 14:53:58 -04:00
Christian Clason
9fe704f88e
vim-patch:8.2.3464: nginx files are not recognized (#15883)
Problem:    nginx files are not recognized.
Solution:   Add several file patterns. (Chris Aumann, closes vim/vim#8922)
8b8c0ed657
2021-10-03 13:40:59 +02:00
Gregory Anders
23d13aa4cc
Merge pull request #15786 from gpanders/diagnostic-signs-unique-severity 2021-10-02 21:01:40 -06:00
Gregory Anders
0f554ef6f8 refactor(diagnostics): always make 'set' go through 'show'
Always make calls to `vim.diagnostic.set` call `vim.diagnostic.show`.
This creates an easier to reason about code path and is also less
surprising when users wish to override override `vim.diagnostic.show`
with custom behavior and `vim.diagnostic.set` is called with empty
diagnostics.

Functionally, the end result is the same: when `show` is called with an
empty diagnostics list, it just calls `hide` and then returns, which is
exactly what `reset` does right now.
2021-10-02 20:37:09 -06:00
Gregory Anders
1124439954 docs(diagnostic): add blurb on how to replace builtin handlers 2021-10-02 20:37:09 -06:00
zeertzjq
4449297d12
docs(lsp): clarify parameters of some util functions (#15851)
`pad_left` and `pad_right` are unused
List used keys of `opts` in `make_floating_popup_options`
2021-10-02 17:55:54 -07:00
zeertzjq
b3e815094b
fix(float)!: always anchor to corner of window including border #15832
N, W, S, E are all inclusive, i.e., always anchor to the exact corner of the
window (including border). This line may also need change in this case (change
0 to -1):

This is most consistent and easiest to reason about, especially with GUIs whose
border do not need to have width/height of 1/1 in cell units.

Fix #15789
2021-10-02 17:36:24 -07:00
dundargoc
ac973d5532
docs: remove obsolete text on language #15875 2021-10-02 14:30:13 -07:00
Michael Lingelbach
724ffe7095
feat(diagnostics): add vim.diagnostic.get_namespaces (#15866)
Many vim.diagnostic functions expect the user to pass in a namespace id.

This PR allows the user to list active diagnostic namespaces:

```lua
:lua print(vim.inspect(vim.diagnostic.get_namespaces()))

{
  [7] = {
    name = "vim.lsp.client-1",
    opts = {},
    sign_group = "vim.diagnostic.vim.lsp.client-1"
  }
}
```
2021-10-01 22:50:28 -07:00
Gregory Anders
36408146ad
docs(diagnostics): add "priority" option to signs table (#15860)
This feature was added in #15785, but the docs for
vim.diagnostic.config() weren't updated.
2021-10-01 19:07:55 -06:00
Daniel Steinberg
88442c2fa6 docs: add 'plus one' to correct getmousepos docs
This change was applied to Vim as part of 90df4b9.
90df4b9d42
2021-09-29 11:13:49 -04:00
Daniel Steinberg
096309037b chore: remove empty line
This update was part of vim-patch:4c29502.
4c295027a4
The other parts of that patch were applied to Neovim in ad6bb38.
2021-09-29 11:13:49 -04:00
Daniel Steinberg
3b9e75b366 vim-patch:8.1.2304: cannot get the mouse position when getting a mouse click
Problem:    Cannot get the mouse position when getting a mouse click.
Solution:   Add getmousepos().
db3a205147
2021-09-29 11:13:49 -04:00
Mathias Fußenegger
ec4731d982
feat(lsp): add codeAction/resolve support (#15818)
Closes https://github.com/neovim/neovim/issues/15339 and https://github.com/neovim/neovim/issues/15828
2021-09-28 14:04:01 -07:00
Mathias Fußenegger
19a77cd5a7
feat(lsp): add client command support to codelens (#15820)
Also adds a check against the server capabilities to fix
https://github.com/neovim/neovim/issues/15183
2021-09-28 09:19:19 -07:00
Mathias Fußenegger
ff18a8bcc4
refactor(lsp): remove json encode/decode wrappers (#15826) 2021-09-28 09:13:44 -07:00
Mathias Fußenegger
9ca7b6b71a
fix(ui): s/format_entry/format_item to match docs (#15819)
Follow up to https://github.com/neovim/neovim/pull/15771
2021-09-27 16:12:03 -07:00
Mathias Fußenegger
63fde086d9
feat(ui): add vim.ui.select and use in code actions (#15771)
Continuation of https://github.com/neovim/neovim/pull/15202

A plugin like telescope could override it with a fancy implementation
and then users would get the telescope-ui within each plugin that
utilizes the vim.ui.select function.

There are some plugins which override the `textDocument/codeAction`
handler solely to provide a different UI. With custom client commands and
soon codeAction resolve support, it becomes more difficult to implement
the handler right - so having a dedicated way to override the picking
function will be useful.
2021-09-27 21:57:28 +02:00
Michael Lingelbach
96614f84ab
fix(lsp): avoid serializing boolean as key (#15810)
In vim.lsp.buf.references, the key vim.type_idx (which evaluates to a
boolean) was set to equal vim.types.dictionary. This resulted in a
boolean key in json which is not allowed by the json spec, and which
lua-cjson fails to serialize.
2021-09-27 00:32:30 -07:00
Gregory Anders
187e3a3b7e
refactor(diagnostic): use sign priority for severity_sort #15785
Rather than relying on the order in which signs are placed to dictate
the order in which they are displayed, explicitly set the priority of
the sign according to the severity of the diagnostic and the value of
severity_sort. If severity_sort is false or unset then all signs use the
same priority.
2021-09-26 16:02:18 -07:00
Mathias Fußenegger
73280a7987
feat(lsp): allow subset of CodeActionContext as arg to code_action methods (#15793)
This makes it easier to filter the code actions. For example:

    vim.lsp.buf.code_action { only = 'refactor' }
2021-09-26 23:40:28 +02:00
Michael Lingelbach
c217766f7c
feat(lsp): use cjson for lsp rpc (#15759) 2021-09-26 22:53:04 +02:00
Gregory Anders
84f66909e4 refactor: use kwargs parameter in vim.split 2021-09-25 20:11:32 -06:00
Gregory Anders
5fa26e2c2f feat: add trimempty optional parameter to vim.split
The `split()` VimL function trims empty items from the returned list by
default, so that, e.g.

  split("\nhello\nworld\n\n", "\n")

returns

  ["hello", "world"]

The Lua implementation of vim.split does not do this. For example,

  vim.split("\nhello\nworld\n\n", "\n")

returns

  {'', 'hello', 'world', '', ''}

Add an optional parameter to the vim.split function that, when true,
trims these empty elements from the front and back of the returned
table. This is only possible for vim.split and not vim.gsplit; because
vim.gsplit is an iterator, there is no way for it to know if the current
item is the last non-empty item.

Note that in order to preserve backward compatibility, the parameter for
the Lua vim.split function is `trimempty`, while the VimL function uses
`keepempty` (i.e. they are opposites). This means there is a disconnect
between these two functions that may surprise users.
2021-09-25 20:11:30 -06:00
Justin M. Keyes
55d1e630b4
Merge #15731 vim-patch:7.4.725,8.2.{0597,0598,0924,1035}
fixes #14581
2021-09-24 05:11:19 -07:00
Chris Kipp
433bda405e
fix(lsp): guard textDocument/codeAction command logic #15769
Problem:

    Error executing vim.schedule lua callback: ...ovim/HEAD-aba3979/share/nvim/runtime/lua/vim/lsp/buf.lua:502: command: expected string, got
     nil
    stack traceback:
            ...ovim/HEAD-aba3979/share/nvim/runtime/lua/vim/lsp/buf.lua:502: in function 'execute_command'
            ...HEAD-aba3979/share/nvim/runtime/lua/vim/lsp/handlers.lua:151: in function <...HEAD-aba3979/share/nvim/runtime/lua/vim/lsp/handlers.lua:113>
            ...ovim/HEAD-aba3979/share/nvim/runtime/lua/vim/lsp/buf.lua:465: in function 'callback'
            ...r/neovim/HEAD-aba3979/share/nvim/runtime/lua/vim/lsp.lua:1325: in function 'handler'
            ...r/neovim/HEAD-aba3979/share/nvim/runtime/lua/vim/lsp.lua:899: in function 'cb'
            vim.lua:281: in function <vim.lua:281>


Solution:

This is a follow-up to the work done in
6c03601e3a.
There are valid situations where a `textDocument/codeAction` is returned
without a command, since a command in optional. For example from Metals,
the Scala language server when you get a code action to add a missing
import, it looks like this:

```json
Result: [
  {
    "title": "Import \u0027Instant\u0027 from package \u0027java.time\u0027",
    "kind": "quickfix",
    "diagnostics": [
      {
        "range": {
          "start": {
            "line": 6,
            "character": 10
          },
          "end": {
            "line": 6,
            "character": 17
          }
        },
        "severity": 1,
        "source": "bloop",
        "message": "not found: value Instant"
      }
    ],
    "edit": {
      "changes": {
        "file:///Users/ckipp/Documents/scala-workspace/sanity/src/main/scala/Thing.scala": [
          {
            "range": {
              "start": {
                "line": 6,
                "character": 10
              },
              "end": {
                "line": 6,
                "character": 17
              }
            },
            "newText": "Instant"
          },
          {
            "range": {
              "start": {
                "line": 1,
                "character": 0
              },
              "end": {
                "line": 1,
                "character": 0
              }
            },
            "newText": "\nimport java.time.Instant\n"
          }
        ]
      }
    }
  }
]
```

This change just wraps the logic that grabs the command in a conditional
to skip it if there is no command.
2021-09-23 18:20:10 -07:00
Gregory Anders
9cde1e5891
fix(diagnostic): check for nil in show_diagnostics (#15772) 2021-09-23 09:52:21 -07:00
Gregory Anders
057606e845
fix(diagnostic): don't return nil when callers expect a table (#15765)
diagnostic_lines() returns a table, so make the early exit condition an
empty table rather than 'nil'. This way, functions that use the input
from diagnostic_lines don't have to do a bunch of defensive nil checking
and can always assume they're operating on a table.
2021-09-23 08:23:57 -07:00
Justin M. Keyes
c05b10748c doc(dev_style.txt): misc updates 2021-09-23 06:59:30 -07:00
Dundar Göc
5f49d0efee doc: convert neovim style guide to vim doc. 2021-09-23 06:59:30 -07:00
Sean Dewar
f9779facca
vim-patch:8.2.0924: cannot save and restore a register properly
Problem:    Cannot save and restore a register properly.
Solution:   Add getreginfo() and make setreg() accept a dictionary. (Andy
            Massimino, closes vim/vim#3370)
bb861e293e

Cherry-pick eval.txt changes for getreginfo() from:
6aa57295cf
207f009326
2021-09-23 02:04:11 +01:00
Gregory Anders
d999c96cf3
feat(diagnostic): allow customized diagnostic messages (#15742)
Provide a 'format' option for virtual text and floating window previews
that allows the displayed text of a diagnostic to be customized.
2021-09-22 12:20:15 -07:00
Michael Lingelbach
248974a4c6
Merge pull request #14115 from mfussenegger/lsp-commands
lsp: Add a registry for client side code action commands
2021-09-22 11:42:56 -07:00
Christian Clason
fb6f27e86f
vim-patch:34cc7d8c034f #15753
Update runtime files
34cc7d8c03
2021-09-22 06:12:06 -07:00
Gregory Anders
bc652f148f refactor(diagnostic): remove get_virt_text_chunks()
This function isn't compatible with including diagnostic sources when
"source" is "if_many" since it only has access to diagnostics for a
single line. Rather than having an inconsistent or incomplete interface,
make this function private. It is still exported as part of the module
for backward compatibility with vim.lsp.diagnostics, but it can
eventually be made into a local function.
2021-09-21 18:54:28 -06:00
Gregory Anders
d43151ea0b feat(diagnostic): add option to include diagnostic source
Add an option to virtual text display and floating window previews to
include diagnostic source in the diagnostic message.
2021-09-21 18:54:26 -06:00
Gregory Anders
17b7968f02
fix(diagnostic): preserve fields from LSP diagnostics via user_data (#15735)
* preserve fields from LSP diagnostics via adding a user_data table to the diagnostic, which can hold arbitrary data in addition to the lsp diagnostic information.
2021-09-21 15:27:12 -07:00
Mathias Fußenegger
8164adc144
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-21 15:05:49 -07:00
Mathias Fussenegger
6c03601e3a feat(lsp): add a registry for client side code action commands
This builds on https://github.com/neovim/neovim/pull/14112 and closes
https://github.com/neovim/neovim/issues/12326
2021-09-20 22:26:00 +02:00
Mathias Fussenegger
187579fe19 feat(lsp): include original request params in handler ctx
This is mostly motivated by https://github.com/neovim/neovim/issues/12326

Client side commands might need to access the original request
parameters.

Currently this is already possible by using closures with
`vim.lsp.buf_request`, but the global handlers so far couldn't access
the request parameters.
2021-09-20 22:06:54 +02:00
Gregory Anders
0216aed20c
fix(diagnostic): clamp line numbers in display layer (#15729)
Some parts of LSP need to use cached diagnostics as sent from the LSP
server unmodified. Rather than fixing invalid line numbers when
diagnostics are first set, fix them when they are displayed to the user
(e.g. in show() or one of the get_next/get_prev family of functions).
2021-09-20 11:32:21 -07:00
Gregory Anders
e61ea7772e
feat(diagnostic): match(), tolist(), fromlist() #15704
* feat(diagnostic): add vim.diagnostic.match()
  Provide vim.diagnostic.match() to generate a diagnostic from a string and
  a Lua pattern.
* feat(diagnostic): add tolist() and fromlist()
2021-09-19 15:13:23 -07:00
zeertzjq
51567db4b6 vim-patch:8.2.3424: a sequence of spaces is hard to see in list mode
Problem:    A sequence of spaces is hard to see in list mode.
Solution:   Add the "multispace" option to 'listchars'. (closes vim/vim#8834)
f14b8ba137
2021-09-19 13:13:44 +08:00
zeertzjq
963474321b vim-patch:8.1.1071: cannot get composing characters from the screen
Problem:    Cannot get composing characters from the screen.
Solution:   Add screenchars() and screenstring(). (partly by Ozaki Kiichi,
            closes vim/vim#4059)
2912abb3a2
2021-09-19 13:13:44 +08:00
Gregory Anders
924e8e4f2d
fix(diagnostic): only update decorations for loaded buffers (#15715)
When vim.diagnostic.config() is called, the decorations for diagnostics
are re-displayed to use the new configuration. This should only be done
for loaded buffers.
2021-09-18 14:01:03 -07:00
hrsh7th
41cfba63cd
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-18 13:19:21 -07:00
Gregory Anders
ef52433847 fix(diagnostic): resolve nil bufnr in show_line_diagnostics 2021-09-18 09:44:30 -06:00
Björn Linse
396280d303 refactor(runtime): always use DIP_START when searching for runtime files
Now remove the addition of "start/*" packages in 'packpath' as
explicit items in 'runtimepath'. This avoids 'runtimepath' from becoming
very long when using a lot of plugins as packages.

To get the effective search path as a list, use |nvim_list_runtime_paths()|
2021-09-18 13:53:50 +02:00
Gregory Anders
0dcf4ab27b fix(diagnostic): remove check on nil return value
vim.diagnostic._set_signs doesn't return anything, so checking the
return value will always fail.
2021-09-17 21:10:10 -06:00
Gregory Anders
445ef41314 refactor(diagnostic): combine config() and set() calls 2021-09-17 21:07:24 -06:00
Gregory Anders
15d501ff7a refactor(diagnostic): group local functions together 2021-09-17 21:07:24 -06:00
Gregory Anders
938ed458e2 fix(diagnostic): change default severity_sort order
When severity_sort is true, higher severities should be displayed before
lower severities (e.g. ERROR is displayed over WARN).

Also improved the test case for this.
2021-09-17 14:59:30 -06:00
Michael Lingelbach
ede5695eb1
Merge pull request #15696 from gpanders/diagnostic-sign-fix
Diagnostic hot fixes
2021-09-17 11:31:56 -07:00
ii14
4d7dcbe49f
fix(termdebug): replace mapset with nvim_set_keymap (#15699)
Co-authored-by: ii14 <ii14@users.noreply.github.com>
2021-09-17 19:29:27 +02:00
Oliver Marriott
d9f93e5642
fix(typo): overriden -> overridden (RE: PR #14159) (#15360) 2021-09-17 13:07:00 -04:00
Gregory Anders
32c0631183 fix(diagnostic): support severity_sort 2021-09-17 10:50:25 -06:00
Gregory Anders
f87779a24d fix(diagnostic): correctly handle folder level diagnostics 2021-09-17 09:28:11 -06:00
Gregory Anders
15fbc9b69e docs(diagnostics): fix typos 2021-09-17 08:57:51 -06:00
Gregory Anders
3fd145007c fix(diagnostic): fix wrong data type in setqflist() 2021-09-17 08:53:08 -06:00
Gregory Anders
71e0e6cc63 fix(diagnostic): don't overwrite existing sign definitions 2021-09-17 08:44:52 -06:00
Jan Edmund Lazo
1ec3d37192
Merge pull request #15580 from seandewar/vim-8.2.3378
vim-patch:8.2.{3378,3379,3384,3386,3398,3400}
2021-09-17 09:39:36 -04:00
Christian Clason
22d146760e fix(diagnostic): don't convert diagnostic table twice
The recursive implementation of vim.lsp.diagnostic.get() applied
`diagnostic_vim_to_lsp` twice, and the second time gave wrong
results because of the unexpected format.

Fixes https://github.com/neovim/neovim/issues/15689
2021-09-17 13:35:57 +02:00
Christian Clason
3e230da90b fix(diagnostic): show_line_diagnostic with empty lnum
The documentation claims to default to the current line number if
the argument `lnum` is nil, but that was never actually done.

Fixes https://github.com/neovim/neovim/issues/15690
2021-09-17 13:33:54 +02:00
Christian Clason
4881456e83
fix(diagnostic): nvim_echo takes three args (#15687)
Fixup for https://github.com/neovim/neovim/pull/15585
Closes https://github.com/neovim/neovim/issues/15686
2021-09-17 09:21:17 +02:00
Gregory Anders
c13242cf47
fix(diagnostic): remove useless highlight links (#15683)
These links were actually defined backwards: the highlight groups
actually being used for display are the new "Diagnostic*" groups, so
linking the old "LspDiagnostics*" groups to these does absolutely
nothing, since there is nothing actually being highlighted with the
LspDiagnostics* groups.

These links were made in an attempt to preserve backward compatibility
with existing colorschemes. We could reverse the links to maintain this
preservation, but then that disallows us from actually defining default
values for the new highlight groups.

Instead, just remove the links and be done with the old LspDiagnostics*
highlight groups.

This is not technically a breaking change: the breaking change already
happened in #15585, but this PR just makes that explicit.
2021-09-17 08:17:54 +02:00
Gregory Anders
c2a65921d7
fix(diagnostic): don't override existing highlight groups #15682
Use the 'default' keyword to prevent overriding existing highlight groups.

ref #15585
2021-09-16 14:51:29 -07:00
Justin M. Keyes
2e8103475e
Merge #15585 refactor: move vim.lsp.diagnostic to vim.diagnostic
## Overview

- Move vim.lsp.diagnostic to vim.diagnostic
- Refactor client ids to diagnostic namespaces
- Update tests
- Write/update documentation and function signatures

Currently, non-LSP diagnostics in Neovim must hook into the LSP subsystem. This
is what e.g. null-ls and nvim-lint do. This is necessary because none of the
diagnostic API is exposed separately from the LSP subsystem.

This commit addresses this by generalizing the diagnostic subsystem beyond the
scope of LSP. The `vim.lsp.diagnostic` module is now simply a specific
diagnostic producer and primarily maintains the interface between LSP clients
and the broader diagnostic API.

The current diagnostic API uses "client ids" which only makes sense in the
context of LSP. We replace "client ids" with standard API namespaces generated
from `nvim_create_namespace`.

This PR is *mostly* backward compatible (so long as plugins are only using the
publicly documented API): LSP diagnostics will continue to work as usual, as
will pseudo-LSP clients like null-ls and nvim-lint. However, the latter can now
use the new interface, which looks something like this:

```lua
-- The namespace *must* be given a name. Anonymous namespaces will not work with diagnostics
local ns = vim.api.nvim_create_namespace("foo")

-- Generate diagnostics
local diagnostics = generate_diagnostics()

-- Set diagnostics for the current buffer
vim.diagnostic.set(ns, diagnostics, bufnr)
```

Some public facing API utility methods were removed and internalized directly in `vim.diagnostic`:

* `vim.lsp.util.diagnostics_to_items`

## API Design

`vim.diagnostic` contains most of the same API as `vim.lsp.diagnostic` with
`client_id` simply replaced with `namespace`, with some differences:

* Generally speaking, functions that modify or add diagnostics require a namespace as their first argument, e.g.

  ```lua
  vim.diagnostic.set({namespace}, {bufnr}, {diagnostics}[, {opts}])
  ```

   while functions that read or query diagnostics do not (although in many cases one may be supplied optionally):

   ```lua
   vim.diagnostic.get({bufnr}[, {namespace}])
   ```

* We use our own severity levels to decouple `vim.diagnostic` from LSP. These
  are designed similarly to `vim.log.levels` and currently include:

  ```lua
  vim.diagnostic.severity.ERROR
  vim.diagnostic.severity.WARN
  vim.diagnostic.severity.INFO
  vim.diagnostic.severity.HINT
  ```

  In practice, these match the LSP diagnostic severity levels exactly, but we
  should treat this as an interface and not assume that they are the same. The
  "translation" between the two severity types is handled transparently in
  `vim.lsp.diagnostic`.

* The actual "diagnostic" data structure is: (**EDIT:** Updated 2021-09-09):

  ```lua
  {
    lnum = <number>,
    col = <number>,
    end_lnum = <number>,
    end_col = <number>,
    severity = <vim.diagnostic.severity>,
    message = <string>
  }
  ```

This differs from the LSP definition of a diagnostic, so we transform them in
the handler functions in vim.lsp.diagnostic.

## Configuration

The `vim.lsp.with` paradigm still works for configuring how LSP diagnostics are
displayed, but this is a specific use-case for the `publishDiagnostics` handler.
Configuration with `vim.diagnostic` is instead done with the
`vim.diagnostic.config` function:

```lua
vim.diagnostic.config({
    virtual_text = true,
    signs = false,
    underline = true,
    update_in_insert = true,
    severity_sort = false,
}[, namespace])
```

(or alternatively passed directly to `set()` or `show()`.)

When the `namespace` argument is `nil`, settings are set globally (i.e. for
*all* diagnostic namespaces). This is what user's will typically use for their
local configuration. Diagnostic producers can also set configuration options for
their specific namespace, although this is generally discouraged in order to
respect the user's global settings. All of the values in the table passed to
`vim.diagnostic.config()` are resolved in the same way that they are in
`on_publish_diagnostics`; that is, the value can be a boolean, a table, or
a function:

```lua
vim.diagnostic.config({
    virtual_text = function(namespace, bufnr)
        -- Only enable virtual text in buffer 3
        return bufnr == 3
    end,
})
```

## Misc Notes

* `vim.diagnostic` currently depends on `vim.lsp.util` for floating window
  previews. I think this is okay for now, although ideally we'd want to decouple
  these completely.
2021-09-16 14:23:42 -07:00
Gregory Anders
4fca63dbf7 fix(lint): remove unused parameters from deprecated functions 2021-09-16 15:01:09 -06:00
Jan Edmund Lazo
7d21b95869
Merge pull request #15211 from seandewar/blob-port
Port VimL's Blob type - vim-patch:8.1.{0735,0736,0738,0741,0742,0755,0756,0757,0765,0793,0797,0798,0802,1022,1023,1671},8.2.{0121,0184,0404,0521,0829,1473,1866,2712}
2021-09-16 16:31:41 -04:00
Gregory Anders
0c86bf563c refactor: remove UTF to byte col conversion 2021-09-16 11:26:45 -06:00
zeertzjq
29bc648d2b
fix(man.vim): ensure buftype=nofile after :tag or :stag #15675
Problem:
`buftype=help` occasionally propagates from help to man buffer. As a result the
next time you open help it opens in the man window, replacing the manpage.

Test case:
    nvim -u NORC
    :Man man
    :set bt?            " should print `buftype=nofile`
    :help
    <C-W><C-W><C-W>c    " go back to :Man window and close it
    :help               " focus help window
    :Man man            " open window with manpage again
    :set bt?            " prints `buftype=help`

Solution:
- call s:set_options()
    - man#read_page() (called by autocmd BufReadCmd man://*) should already do
      this. But BufReadCmd doesn't fire for already-existing man:// buffers.

Fix #15650
2021-09-16 06:51:26 -07:00
Sean Dewar
10283915d6
doc(eval): include latest relevant Blob changes
Also includes some small relevant nearby non-Blob changes and typo
fixes.

Changes are included from:
- v8.1.0815
- v8.1.0846
- v8.1.1084
- v8.1.2326
- v8.2.1969
- d89682477c
- d09091d495
- 53f7fccc94
2021-09-16 00:14:48 +01:00
Sean Dewar
e53b71627f
feat(f_msgpackparse): support parsing from Blob
Note that it is not possible for msgpack_unpack_next() and
msgpack_unpacker_next() to return MSGPACK_UNPACK_EXTRA_BYTES, so it
should be fine to abort() on that.

Lua 5.1 doesn't support string hex escapes (\xXX) like VimL does (though
LuaJIT does), so convert them to decimal escapes (\DDD) in tests.
2021-09-16 00:14:47 +01:00
Sean Dewar
5fdf741f77
feat(f_msgpackdump): support dumping to Blob 2021-09-16 00:14:47 +01:00
Sean Dewar
7e9ea08321
feat(f_chansend): support Blob data argument 2021-09-16 00:14:47 +01:00
Sean Dewar
e88961943b
fix(eval): partially port v8.2.3284
These were issues that I found while porting that I fixed upstream. :^)

Very little of the patch can be exactly ported as we're a bit behind on
dependant patches (we also can't use the exact :for emsg, as we don't
support iterating over Strings yet), so just translate the fixes as best
as we can for now.

Include latest relevant doc changes from:
- v8.1.0815
- v8.2.2658
2021-09-16 00:14:46 +01:00
Sean Dewar
9e38c4a79f
vim-patch:8.2.1473: items in a list given to :const can still be modified
Problem:    Items in a list given to :const can still be modified.
Solution:   Work like ":lockvar! name" but don't lock referenced items.
            Make locking a blob work.
021bda5671
2021-09-16 00:13:41 +01:00
Sean Dewar
e140eec441
vim-patch:8.1.0797: error E898 is used twice
Problem:    Error E898 is used twice.
Solution:   Rename the Blob error to E899. (closes vim/vim#3853)
bf821bccf1
2021-09-15 22:30:31 +01:00
Sean Dewar
c57132ec2a
vim-patch:8.1.0793: incorrect error messages for functions that take a Blob
Problem:    Incorrect error messages for functions that now take a Blob
            argument.
Solution:   Adjust the error messages. (Dominique Pelle, closes vim/vim#3846)
0d17f0d1c0
2021-09-15 22:30:31 +01:00
Sean Dewar
0eadd7e5fd
vim-patch:8.1.0757: not enough documentation for Blobs
Problem:    Not enough documentation for Blobs.
Solution:   Add a section about Blobs.
d89682477c

Include doc changes for empty() from v7.4.1274.
Include some minor typo fixes.
2021-09-15 22:30:20 +01:00
Sean Dewar
de9df825d5
feat(decode_string): decode binary string with NULs to Blob
Strings that previously decoded into a msgpack special for representing
BINs with NULs now convert to Blobs. It shouldn't be possible to decode
into this special anymore after this change?

Notably, Lua strings with NULs now convert to Blobs when passed to VimL.
2021-09-15 21:19:30 +01:00
Sean Dewar
af6f454f5c
feat(msgpack): convert Blobs to BIN strings 2021-09-15 21:19:30 +01:00
Sean Dewar
ab82369c8e
feat(json): convert Blobs to array of byte values
Similiar to how Vim does it, but to be consistent with how Nvim encodes
lists, add a space after every comma.
2021-09-15 21:19:29 +01:00
Sean Dewar
9095101743
vim-patch:8.1.0735: cannot handle binary data
Problem:    Cannot handle binary data.
Solution:   Add the Blob type. (Yasuhiro Matsumoto, closes vim/vim#3638)
6e5ea8d2a9

Nvim-specific Blob conversions are implemented in future commits.

Refactor write_blob() to use a FileDescriptor, as f_writefile() was
refactored to use one (does not apply to read_blob()).

Use var_check_lock() in f_add() for Blobs from v8.1.0897.

Add a modeline to test_blob.vim and fix some doc typos.

Include if_perl.txt's VIM::Blob() documentation. Interestingly, this
function already worked before this port, as it just returns a Blob
string literal, not an actual Blob object.

N/A patches for version.c:

vim-patch:8.1.0741: viminfo with Blob is not tested

Problem:    Viminfo with Blob is not tested.
Solution:   Extend the viminfo test.  Fix reading a blob.  Fixed storing a
            special variable value.
8c8b8bb56c

vim-patch:8.1.1022: may use NULL pointer when out of memory

Problem:    May use NULL pointer when out of memory. (Coverity)
Solution:   Check for blob_alloc() returning NULL.
e142a9467a
2021-09-15 21:19:22 +01:00
Gregory Anders
a5bbb932f9 refactor: move vim.lsp.diagnostic to vim.diagnostic
This generalizes diagnostic handling outside of just the scope of LSP.
LSP clients are now a specific case of a diagnostic producer, but the
diagnostic subsystem is decoupled from the LSP subsystem (or will be,
eventually).

More discussion at [1].

[1]: https://github.com/neovim/neovim/pull/15585
2021-09-15 14:09:47 -06:00
Michael Lingelbach
685cf39813
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-15 11:35:04 -07:00
Justin M. Keyes
b63b4777ec
docs: third-party licenses, TEST_COLORS, system() #15665 2021-09-14 10:20:33 -07:00
hrsh7th
516775e9d8
fix(lsp): correctly parse LSP snippets #15579
Fixes #15522
2021-09-14 04:31:41 -07:00
Christian Clason
5fd21b8d3e
vim-patch:6c391a74fe90 (#15654)
Update runtime files
6c391a74fe

omit autoload/getscript.vim

skip doc/eval.txt (needs 8.2.2468)
skip doc/various.txt (needs 8.2.3400)

(typofixes courtesy of @dundargoc)
2021-09-13 16:33:41 +02:00
Christian Clason
1a9d2a4040
vim-patch:89a9c159f23f #15641
Update runtime files
89a9c159f2

Omit:
nsis/lang/turkish.nsi
pixmaps/gen-inline-pixbufs.sh
doc/popup.txt
doc/terminal.txt
tutor/tutor*
src/[g]vimtutor
CONTRIBUTING.md

Skip:
doc/eval.txt (needs 8.1.2342)
doc/testing.txt (needs 8.2.0299)
2021-09-13 06:05:27 -07:00
Christian Clason
b9d57fa107
vim-patch:8.2.3432: octave/Matlab filetype detection does not work properly (#15652)
Problem:    Octave/Matlab filetype detection does not work properly.
Solution:   Update the patterns used for matching. (Doug Kearns)
ca0627df69
2021-09-13 10:00:09 +02:00
Sean Dewar
643cb8a6ec
doc(options): remove vim9script reference (#15645)
[skip ci]
2021-09-12 13:51:00 +02:00
Christian Clason
5615ea8b6b
vim-patch:8.2.3368: not all Racket files are recognized (#15643)
Problem:    Not all Racket files are recognized.
Solution:   Also recognize .rktl and .rktd files. (Doug Kearns)
9cd91a1e88
2021-09-12 13:09:18 +02:00
Christian Clason
ae73aa8339
vim-patch:8.2.3374: Pyret files are not recognized (#15642)
Problem:    Pyret files are not recognized.
Solution:   Recognize .arr files as Pyret. (Doug Kearns)
eb05d05f8a
2021-09-12 12:55:34 +02:00
Christian Clason
229effac9f
vim-patch:partial 6aa57295cfbe (#15633)
* vim-patch:partial 6aa57295cfbe

Update runtime files
6aa57295cf

omit doc/popup.txt
omit plugin/manpager.vim

partial skip runtime/doc/eval.txt (needs 8.2.{0258,0924,1544,2324,2468,2606})

skip ftplugin/julia.vim, indent/julia.vim, syntax/julia.vim (already
        ported in
        65f32f0f19)
skip syntax/scala.vim (already ported in
        a92e83ac14)
2021-09-12 11:02:33 +02:00
Christian Clason
4a7a99ff31
Merge pull request #15550 from jasonccox/vim-8.2.3385
vim-patch:8.2.3385,8.2.3393
2021-09-12 10:55:35 +02:00
Justin M. Keyes
413e86869e
Merge #14611 from seandewar/vim-8.1.1116
vim-patch:8.1.{1116,1188,1190,1355,1722,2035,2036,2038,2043},8.2.{0886,2309}
2021-09-11 12:12:59 -07:00
Christian Clason
e31652879e
vim-patch:partial 53f7fccc9413 (#15631)
* vim-patch:partial 53f7fccc9413

Update runtime files
53f7fccc94

omit macros/hanoi/hanoi.vim
omit spell/tet/main.aap
omit tools/shtags.1
omit tools/xcmdsrv_client.c

skip doc/pattern.txt (requires 8.2.3110; 8.2.{1665,1872})
skip doc/map.txt (requires 8.2.3228)
2021-09-11 16:47:45 +02:00
Sean Dewar
90a4cf92d2
vim-patch:8.2.0886: cannot use octal numbers in scriptversion 4
Problem:    Cannot use octal numbers in scriptversion 4.
Solution:   Add the "0o" notation. (Ken Takata, closes vim/vim#5304)
c17e66c5c0

:scriptversion is N/A.

Cherry-pick latest str2nr() doc changes from v8.1.2035.
Cherry-pick various mentions of the 0o prefix from:
 - v8.2.2324
 - 2346a63784
 - 11e3c5ba82
 - 82be4849ee

Patch used ascii_isbdigit() by mistake, which was fixed in v8.2.2309.

Make STR2NR_OOCT work the same as STR2NR_OCT when forcing.
In Vim, STR2NR_FORCE | STR2NR_OOCT isn't handled, and doesn't actually
force anything. Rather than abort(), make it work as STR2NR_OCT.

This means STR2NR_FORCE | STR2NR_OCT works the same as
STR2NR_FORCE | STR2NR_OOCT and STR2NR_FORCE | STR2NR_OCT | STR2NR_OOCT.
2021-09-11 15:36:03 +01:00
Sean Dewar
6617629ad6
vim-patch:8.1.2035: recognizing octal numbers is confusing
Problem:    Recognizing octal numbers is confusing.
Solution:   Introduce scriptversion 4: do not use octal and allow for single
            quote inside numbers.
60a8de28d1

:scriptversion is N/A.

Cherry-pick Test_readfile_binary() from v8.1.0742.

Note that this patch was missing vim_str2nr() changes, and so fails the
tests; this was fixed in v8.1.2036.
2021-09-11 15:33:20 +01:00
Sean Dewar
cd18fe17a8
vim-patch:8.1.1116: cannot enforce a Vim script style
Problem:    Cannot enforce a Vim script style.
Solution:   Add the :scriptversion command. (closes vim/vim#3857)
558ca4ae55

:scriptversion is N/A, but ":let ..=" is relevant.

N/A patches for version.c

vim-patch:8.1.1188: not all Vim variables require the v: prefix

Problem:    Not all Vim variables require the v: prefix.
Solution:   When scriptversion is 3 all Vim variables can only be used with
            the v: prefix.  (Ken Takata, closes vim/vim#4274)
d2e716e6df

vim-patch:8.1.1190: has('vimscript-3') does not work

Problem:    has('vimscript-3') does not work.
Solution:   Add "vimscript-3" to the list of features.
93a4879c20

vim-patch:8.1.2038: has('vimscript-4') is always 0

Problem:    has('vimscript-4') is always 0.
Solution:   Add "vimscript-4" to the feature table. (Naruhiko Nishino,
            closes vim/vim#4941)
af91438338
2021-09-11 15:33:06 +01:00
Christian Clason
521817ee76
Merge pull request #15619 from clason/vim-90df4b9d4234
vim-patch:90df4b9d4234

chore(vim-patch): add doc/vim9.txt to unwanted files
2021-09-11 12:59:30 +02:00
Justin M. Keyes
915703f2d8 docs: extmarks indexing #15311
ref #11456
2021-09-10 19:10:09 -07:00
Javier López
f8e406ed30 docs: extmarks indexing #15311
fix #11456
2021-09-10 18:31:11 -07:00
Patrice Peterson
9b553ad28d docs: extmark indexing #12742
Extmarks mostly use api-indexing, except for nvim_buf_get_extmarks(),
which uses api-indexing with inclusive ranges.

ref #11456
2021-09-10 17:59:28 -07:00
zeertzjq
9697023a0b
vim-patch:8.2.3389: cannot stop insert mode completion without side effects #15538
Problem:    Cannot stop insert mode completion without side effects.
Solution:   Add CTRL-X CTRL-Z. (closes vim/vim#8821)
dca29d9cf4
2021-09-10 17:14:32 -07:00
Justin M. Keyes
7525052270
Merge #15626 vim-patch:8.1.{2281,2283},8.2.{2903,3391,3397} 2021-09-10 08:43:45 -07:00
Sean Dewar
fd1dbb103b
vim-patch:8.1.2281: 'showbreak' cannot be set for one window
Problem:    'showbreak' cannot be set for one window.
Solution:   Make 'showbreak' global-local.
ee85702c10

Change in oneleft() is N/A as the relevant condition was removed
(has_mbyte is always true for Nvim, so the condition was always false;
see commit 73dc9e9).

Use wp over curwin for curs_columns().

Required for v8.2.2903 (otherwise test fails as it'll leave the global
option set).

N/A patches for version.c:

vim-patch:8.1.2283: missed on use of p_sbr

Problem:    Missed on use of p_sbr.
Solution:   Add missing p_sbr change.
91e22eb6e0

Already ported in commit 43a874a.
2021-09-10 15:50:43 +01:00
Sean Dewar
f46341fa43
vim-patch:8.2.3400: ":z!" is not supported
Problem:    ":z!" is not supported.
Solution:   Make ":z!" work and add tests. (Dominique Pellé, closes vim/vim#8836)
            Use display height instead of current window height.
7f2dd1e90c
2021-09-10 15:35:19 +01:00
Sean Dewar
b3a97c56b6
vim-patch:8.2.3384: cannot disable modeline for an individual file
Problem:    Cannot disable modeline for an individual file.
Solution:   Recognize "nomodeline" in a modeline. (Hu Jialun, closes vim/vim#8798)
9dcd349ca8

Cherry-pick missing modeline for test_modeline.vim (heh) from v8.2.1432.
2021-09-10 15:35:18 +01:00
Gregory Anders
c58ee4ef7f
docs: clarify :runtime START, OPT behavior #15342
By default, the :runtime command searches "pack/*/start" in 'packpath'
along with 'runtimepath'. Update the documentation to reflect this
behavior.
2021-09-10 07:11:50 -07:00
Justin M. Keyes
329047b3db
docs #15625
fix #12261
fix #15536
fix #15623
fix #15572
ref #14244
ref #15034

close #15555
close #14957
2021-09-10 06:59:17 -07:00
zeertzjq
af6948d271
docs(terminal): clarify CTRL-\ behavior #15171 2021-09-10 06:24:08 -07:00
Javier Lopez
4b452d4efb
perf(lua): optimize vim.deep_equal #15236
By remembering the keys already compared in repeating a comparison is
avoided. Thanks: https://stackoverflow.com/a/32660766
2021-09-10 06:22:40 -07:00
Christian Clason
aab3583e74
vim-patch:8.2.3399: Octave files are not recognized (#15622)
Problem:    Octave files are not recognized.
Solution:   Detect Octave files. (Doug Kearns)
deba5eb195
2021-09-10 14:01:13 +02:00
Christian Clason
be557dddf4 vim-patch:90df4b9d4234
Update runtime files
90df4b9d42

omit .github/CODEOWNERS
omit doc/vim9.txt
omit po/it.po

skip ftplugin/jsonc.vim
skip indent/jsonc.vim
skip syntax/jsonc.vim
(already ported in dce50312e1)

partial skip doc/eval.txt (needs 8.1.{2304,2321})
2021-09-10 09:14:56 +02:00
Christian Clason
8f0c843c13
vim-patch:4d8f476176ea (#15612)
* vim-patch:4d8f476176ea

Update runtime files
4d8f476176

skip nsis/README.txt
skip doc/vim9.txt
skip src/nvim/po/it.po
2021-09-10 08:48:27 +02:00
Gregory Anders
a422f2136a
docs(gen_vimdoc.py): ignore health.lua files #15614 2021-09-09 18:28:12 -07:00
Christian Clason
2fe95cb1ad
vim-patch:partial 2346a6378483 (#15599)
Update runtime files
2346a63784

omit doc/vim.man
omit doc/vim9.txt
omit doc/vimdiff.txt
omit doc/vimdiff.man

skip doc/eval.txt (missing patch 8.2.2324)
skip doc/help.txt (missing patch 8.2.2344)
2021-09-09 18:59:11 +02:00
Björn Linse
0f596665cc feat(lua): make vim.mpack support vim.NIL and vim.empty_dict() 2021-09-09 16:06:43 +02:00
Justin M. Keyes
9f3679cbfd docs: naming conventions 2021-09-09 06:28:11 -07:00
Justin M. Keyes
69fe427df4 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-09 06:09:33 -07:00
Sean Dewar
4eb1ebbcf7
fix(doc): various fixes #15604
In particular:
- jobwait: omitting {timeout} arg is the same as -1.
- sockconnect: omitting {opts} arg is the same as {}.
- jobsend: obsoleted by chansend; don't mention it in job_control.txt.
- menu_get: add to |functions| table.

[skip ci]
2021-09-09 00:37:59 -07:00
Zi How Poh
c1f573fbc9
feat(lsp): support textDocument/prepareRename (#15514) 2021-09-08 17:00:15 +02:00
Christian Clason
11289ad733
fix(termdebug): replace term_getline with getbufline #15598
Correct incomplete runtime file port in
79cbbd5179
2021-09-08 07:35:40 -07:00
Christian Clason
79cbbd5179
vim-patch:d2ea7cf10a4d #15571
Update runtime files
d2ea7cf10a

omit `runtime/doc/if_tcl.txt`
omit `runtime/doc/textprop.txt`
omit `runtime/tutor/*`
omit `runtime/syntax/vim.vim` (cherry-picked in 2dd7828511)

manual merge of `runtime/pack/dist/opt/termdebug/plugin/termdebug.vim`
2021-09-08 07:24:12 -07:00
Michael Lingelbach
384a43fe71
chore(lsp): fix formatting in vim.lsp.log (#15596) 2021-09-07 21:48:19 -07:00
Michael Lingelbach
e6777a7a04 feat(lsp): add warning message for large log size 2021-09-07 20:52:08 -07:00
Michael Lingelbach
e26802650d feat(lsp): add lsp healthcheck
Add healthcheck for language server client, currently only checks
logging status.
2021-09-07 20:51:40 -07:00
Mathias Fußenegger
687a0b3d3e
fix(lsp): adapt codelens resolve to handler signature change (#15578)
Follow up to https://github.com/neovim/neovim/pull/15504
2021-09-06 17:30:53 +02:00
Jose Alvarez
3f526feebf
fix(lsp): update workspace/applyEdit handler signature (#15573) 2021-09-05 12:48:54 -07:00