Commit Graph

19039 Commits

Author SHA1 Message Date
gmntroll
8b0e6cc05d
fix(api): fix crash after set_option_value_for() #15390
Problem:
This crashes Nvim:
    tabedit
    call nvim_win_set_option(1000, 'statusline', 'status')
    split
    wincmd J
    wincmd j

Solution:
- Change `no_display` parameter value to be the same as in matching
  `restore_win_noblock` call. In case of different values `topframe`
  isn't restored to `curtab->tp_topframe`.
- Call `restore_win_noblock` if `switch_win_noblock` returns `FAIL`
  (`switch_win` must always have matching `restore_win`)
- Change `switch_win`/`restore_win` to `_noblock` versions to allow
  autocommands.

fixes #14097
fixes #13577
2021-09-25 17:48:06 -07:00
dundargoc
2f9b9e61d7
refactor: format with uncrustify #15778
* fixup: force exactly one whitespace between type and variable
2021-09-25 17:16:04 -07:00
James McCoy
05d685be52
Merge pull request #15776 from jamessan/macos-11-ci
Add macos-11 CI
2021-09-25 09:43:57 -04:00
Thomas Vigouroux
7cb34a341d
test(normal): CA_COMMAND_BUSY in visual select mode #15292
Fix was already applied in 5f144efefa #15688,
but this commit adds another dimension to the test.

Test correctly fails after reverting 5f144efefa.

ref #15288
2021-09-24 09:59:36 -07:00
James McCoy
64a5eddc89
ci: use runner, instead of os, for job name and cache key 2021-09-24 09:01:50 -04:00
James McCoy
e0cf32c6de
ci: add macOS 11 build 2021-09-24 09:01:30 -04:00
Justin M. Keyes
bc570b0064
Merge #15774 fix(pvs): fix warnings, script 2021-09-24 05:13:55 -07: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
dundargoc
7a26eb8a56
refactor: format with uncrustify #15755 2021-09-24 05:03:15 -07:00
Justin M. Keyes
03ed72642d fix(pvs): Exclude xdiff from analysis
ref 088161a945
ref fbe88ef8f5
2021-09-24 03:26:31 -07:00
Justin M. Keyes
508fcdadb7 fix(PVS): disable "typo" warnings V1051, V1074
PVS is worried about typos. Now we need it to stop worrying...
Disable these checks entirely, they are all false positives.

tui.c:1873        V1074   Boundary between escape sequence and string is unclear. The escape sequence ends with a letter and the next character is also a letter. Check for typos.
tui.c:1983        V1074   Boundary between escape sequence and string is unclear. The escape sequence ends with a letter and the next character is also a letter. Check for typos.

regexp_nfa.c:6189 V1051   Consider checking for misprints. It's possible that the 'pim->result' should be checked here.
screen.c:2928     V1051   Consider checking for misprints. It's possible that the 'vcol_sbr' should be checked here.
screen.c:3187     V1051   Consider checking for misprints. It's possible that the 'line_attr' should be checked here.
screen.c:3267     V1051   Consider checking for misprints. It's possible that the 'multi_attr' should be checked here.
screen.c:4747     V1051   Consider checking for misprints. It's possible that the 'redraw_next' should be checked here.
syntax.c:3448     V1051   Consider checking for misprints. It's possible that the 'arg_end' should be checked here.
syntax.c:3625     V1051   Consider checking for misprints. It's possible that the 'arg_end' should be checked here.
tui.c:1836        V1051   Consider checking for misprints. It's possible that the 'data->unibi_ext.set_cursor_style' should be checked here.
tui.c:1863        V1051   Consider checking for misprints. It's possible that the 'data->unibi_ext.set_cursor_style' should be checked here.
tui.c:1882        V1051   Consider checking for misprints. It's possible that the 'data->unibi_ext.set_cursor_style' should be checked here.
2021-09-24 03:22:26 -07:00
Justin M. Keyes
3c7cef7b08 fix(PVS V681): function call order is undefined
https://pvs-studio.com/en/docs/warnings/v681/
2021-09-24 02:49:59 -07:00
Justin M. Keyes
fefd1652e7 fix(PVS V576): false positive
`lower`, `upper` are `varnumber_T`, correctly matched to `PRIdVARNUMBER`
format.
2021-09-24 02:43:37 -07:00
Justin M. Keyes
0d59c01a64 fix(PVS V576): wrong fprintf() format
https://pvs-studio.com/en/docs/warnings/v576/

Before 1bffe66508 this was originally
"%ld" but that looks like a mistake. At least now, w_height_inner and
w_width_inner are just `int`.
2021-09-24 02:29:49 -07:00
Justin M. Keyes
d15defeb2f fix(PVS V507): false positive
https://pvs-studio.com/en/docs/warnings/v507/

"Pointer to local array 'sourcing_name_buf' is stored outside the scope
of this array. Such a pointer will become invalid."

False positive: `sourcing_name = save_sourcing_name` before returning
from this scope.
2021-09-24 02:09:52 -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
Justin M. Keyes
be93821647
fix: move contrib/uncrustify.cfg -> src/uncrustify.cfg #15768
If uncrustify is now the (partial) authority on code style, it is no
longer "contrib".
2021-09-23 14:56:58 -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
abf13258cf
Merge #14979 doc: convert Nvim style guide XML to vim :help 2021-09-23 07:02:43 -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
f1bf70c2f9
vim-patch:8.2.1035: setreg() does not always clear the register
Problem:    setreg() does not always clear the register.
Solution:   Clear the register if the dict argument is empty. (Andy Massimino,
            closes vim/vim#3370)
7633fe595e

Do not getdigits for block_len strictly. For example, a user could
previously abort Nvim using:

:call setreg("0", "abort!", "\<C-V>999999999999999999")

or, after v8.2.0924's port:

:call setreg("0", #{regcontents: ["abort!"],
                  \ regtype: "\<C-V>999999999999999999"})

Instead, default to 0 so block_len is -1, which acts like the selection
width was omitted (defaults to length of longest line).
2021-09-23 02:07:21 +01:00
Sean Dewar
f8241f825a
vim-patch:7.4.725
Problem:    ":call setreg('"', [])" reports an internal error.
Solution:   Make the register empty. (Yasuhiro Matsumoto)
659c94d483

Required for v8.2.1035.

Note that setreg('"', []) didn't cause an internal error for us, but
didn't clear the register properly either...
2021-09-23 02:04:16 +01: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
Sean Dewar
74ddd14241
vim-patch:8.2.0598: test_eval_stuff fails in normal terminal
Problem:    Test_eval_stuff fails in normal terminal.
Solution:   Close the new window.
61fbb3371e

Required for v8.2.0598 to work.
2021-09-22 23:53:13 +01:00
Sean Dewar
3b2be8f3de
vim-patch:8.2.0597: test_eval is old style
Problem:    Test_eval is old style.
Solution:   Change some tests to a new style test.
90455cfa87

Cherry-pick Test_setreg_basic changes from v8.2.0610.

Note that the old-style version of the tests (and the cherry-picked
changes) exist in legacy/eval_spec.lua; keep them as they've already
been Lua'd.

Required for v8.2.0924.
2021-09-22 23:53:13 +01:00
Christian Clason
aba397991b
build(deps): bump luarocks to 3.7.0 #15740
Besides bugfixes, this brings `XDG_*` compliance and improved
robustness, especially for network errors.

See https://github.com/luarocks/luarocks/blob/master/CHANGELOG.md

- fixup: set LIBUV_LIBDIR to workaround 83126ba324
    - https://github.com/luarocks/luarocks/issues/1214
    - https://github.com/luarocks/luarocks/pull/1355
2021-09-22 12:26:01 -07: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
James McCoy
80e3f0eb34
Merge pull request #15739 from clason/luv-bump 2021-09-22 15:11:10 -04: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
Justin M. Keyes
ec447b8798
docs: .git-blame-ignore-revs #15653 2021-09-22 06:36:53 -07:00
dundargoc
48e67b2294
refactor: format with uncrustify #15741 2021-09-22 06:25:38 -07:00
Christian Clason
fb6f27e86f
vim-patch:34cc7d8c034f #15753
Update runtime files
34cc7d8c03
2021-09-22 06:12:06 -07:00
Michael Lingelbach
e8fb0728e2
Merge pull request #15717 from gpanders/diagnostic-include-source
feat(diagnostic): add option to include diagnostic source
2021-09-21 18:32:32 -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
dundargoc
a65d8c34e6
ci(PVS): PVS/V009: add required header #15751 2021-09-21 09:02:43 -07:00
Justin M. Keyes
c76cddf3e0
fix(startup): init.lua: set $MYVIMRC to absolute path #15748
- main.c: remove os_setenv("MYVIMRC",…), it is already done by
  do_source().
  - This also sets $MYVIMRC to a full (absolute) path.
- code cleanup.
2021-09-21 08:47:46 -07:00
James McCoy
c208993026
Merge pull request #15745 from e-kwsm/Makefile
build: enhance Makefile
2021-09-21 08:22:08 -04:00
James McCoy
f446ab3aa3
fix(build): call find_package(Threads) before using its variables 2021-09-21 06:56:59 -04:00
Christian Clason
9cbebcb247 chore(deps): bump libuv and luv to 1.42.0 2021-09-21 10:17:05 +02:00
Eisuke Kawashima
7014731035
build: enhance Makefile
- fix regression where `-j` is not passed to ninja
  (39c886551b, #15708)
- enable to pass `-l` (load) to ninja as well
- s/BUILD_TYPE/CMAKE_GENERATOR/
2021-09-21 15:54:14 +09:00
James McCoy
21f7555277
Merge pull request #15743 from jamessan/libuv-threads
build: Add ${CMAKE_THREAD_LIBS_INIT} to LIBUV_LIBRARIES
2021-09-20 21:56:49 -04:00
James McCoy
2435cf77d1
build: add ${CMAKE_THREAD_LIBS_INIT} to LIBUV_LIBRARIES
This is a workaround for not yet having fully correct Find* cmake
modules for static builds.

https://github.com/Tronic/cmake-modules/issues/3#issuecomment-624469020
2021-09-20 21:19:52 -04: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