Commit Graph

29230 Commits

Author SHA1 Message Date
luukvbaal
97122eaa1c
fix(column): ignore empty signcols range (#28177)
Problem:  Invalid assert for empty signcols range. The empty range
          should already be removed from "b_signcols" at this point.
          The "clear" == kTrue call before the splice that made the
          range empty will have removed it, and the "clear" == kNone
          call after the splice already ignores the empty range.
Solution: Return early when "row2" < "row1".
2024-04-06 09:32:07 +08:00
zeertzjq
5581a90e20
test: reduce sleep for file timestamp change (#28196)
Now that Nvim always supports nanotime, sleeping for some milliseconds
is enough.
2024-04-06 08:59:50 +08:00
zeertzjq
08ae0c840b
test(old): sleep for 1 second on non-Windows in test_stat.vim (#28195)
Now that Nvim always supports nanotime, sleeping for some milliseconds
is actually enough, but for test_stat.vim keeping some longer sleeps may
increase test coverage, so just match the upstream test.
2024-04-06 08:33:07 +08:00
zeertzjq
a4e4e493df
Merge pull request #28194 from zeertzjq/vim-9.1.0267
vim-patch:9.1.{0267,0268,0269}
2024-04-06 06:18:50 +08:00
zeertzjq
c7d12a5e01 vim-patch:9.1.0269: Test for TextChanged is still flaky with ASAN
Problem:  Test for TextChanged is still flaky with ASAN.
Solution: Don't index the result of readfile().
          (zeertzjq)

It turns out that with ASAN the file may become empty during a write
even if it's non-empty both before and after the write, in which case
indexing the result of readfile() will error, so use join() instead.

Also don't delete the file halfway the test, just in case it may cause
errors on the next read.

closes: vim/vim#14421

e9ff79a7c9
2024-04-06 05:59:13 +08:00
zeertzjq
f4a0c853db vim-patch:9.1.0268: Two tests in test_filechanged.vim are slow
Problem:  Two tests in test_filechanged.vim are slow.
Solution: Sleep for shorter if the +nanotime feature is available.
          (zeertzjq)

closes: vim/vim#14418

83cd2c7bf0
2024-04-06 05:58:55 +08:00
zeertzjq
dcf4c5744a vim-patch:9.1.0267: File name entered in GUI dialog is ignored
Problem:  File name entered in GUI dialog is ignored (after v9.1.0265)
Solution: Only set file name to "Untitled" if GUI dialog didn't set it.
          (zeertzjq)

closes: vim/vim#14417

c20bdf1107
2024-04-06 05:58:21 +08:00
zeertzjq
66568ed452
vim-patch:b73faa1c02d0 (#28193)
runtime: fix :compiler leaving behind a g:makeprg variable (vim/vim#14414)

Problem:  :compiler may leave behind a g:makeprg variable after vim/vim#14336.
Solution: Use a script local variable.

b73faa1c02

Also apply previously omitted change to compiler/context.vim.
2024-04-06 05:44:37 +08:00
Christian Clason
7098341387 build(deps): bump msgpack-c to v6.0.1 2024-04-05 18:49:42 +02:00
Christian Clason
39a0e6bf3c fix(treesitter): update parsers and queries 2024-04-05 18:36:17 +02:00
Evgeni Chasnovski
73de98256c feat(comment): add built-in commenting
Design

- Enable commenting support only through `gc` mappings for simplicity.
  No ability to configure, no Lua module, no user commands. Yet.

- Overall implementation is a simplified version of 'mini.comment'
  module of 'echasnovski/mini.nvim' adapted to be a better suit for
  core. It basically means reducing code paths which use only specific
  fixed set of plugin config.

  All used options are default except `pad_comment_parts = false`. This
  means that 'commentstring' option is used as is without forcing single
  space inner padding.

As 'tpope/vim-commentary' was considered for inclusion earlier, here is
a quick summary of how this commit differs from it:

- **User-facing features**. Both implement similar user-facing mappings.
  This commit does not include `gcu` which is essentially a `gcgc`.
  There are no commands, events, or configuration in this commit.

- **Size**. Both have reasonably comparable number of lines of code,
  while this commit has more comments in tricky areas.

- **Maintainability**. This commit has (purely subjectively) better
  readability, tests, and Lua types.

- **Configurability**. This commit has no user configuration, while
  'vim-commentary' has some (partially as a counter-measure to possibly
  modifying 'commentstring' option).

- **Extra features**:
    - This commit supports tree-sitter by computing `'commentstring'`
      option under cursor, which can matter in presence of tree-sitter
      injected languages.

    - This commit comments blank lines while 'tpope/vim-commentary' does
      not. At the same time, blank lines are not taken into account when
      deciding the toggle action.

    - This commit has much better speed on larger chunks of lines (like
      above 1000). This is thanks to using `nvim_buf_set_lines()` to set
      all new lines at once, and not with `vim.fn.setline()`.
2024-04-05 18:07:43 +02:00
Christian Clason
2b9d8dc87e vim-patch:408281e16a36
runtime: Remove fallback :CompilerSet definition from compiler plugins

The :CompilerSet command was added in version Vim 6.4 which was released
twenty years ago.  Other runtime files do not support versions of that
vintage so it is reasonable to remove this fallback command definition
now.

closes: vim/vim#14399

408281e16a

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2024-04-05 15:45:13 +02:00
Mathias Fußenegger
9af3559643
feat(lsp): set workDoneToken in initialize request (#28182)
Problem:

Some servers don't report progress during initialize unless the client
sets the `workDoneToken`

See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#initiatingWorkDoneProgress

In particular:

> There is no specific client capability signaling whether a client will
> send a progress token per request. The reason for this is that this is
> in many clients not a static aspect and might even change for every
> request instance for the same request type. So the capability is signal
> on every request instance by the presence of a workDoneToken property.

And:

> Servers can also initiate progress reporting using the
> window/workDoneProgress/create request. This is useful if the server
> needs to report progress outside of a request (for example the server
> needs to re-index a database). The token can then be used to report
> progress using the same notifications used as for client initiated
> progress.

So far progress report functionality was relying entirely on the latter.

Solution:

Set a `workDoneToken`

Closes https://github.com/neovim/neovim/issues/27938
2024-04-05 13:24:39 +02:00
zeertzjq
6ecb5d2d0c
vim-patch:9.1.0265: console dialog cannot save unnamed buffers (#28185)
Problem:  console dialog cannot save unnamed buffers
Solution: set bufname before save (glepnir). Define dialog_con_gui
          to test for GUI+Console dialog support, use it to skip
          the test when the GUI feature has been defined.

Note: The dialog_changed() function will also try to call the
browse_save_fname() function, when FEAT_BROWSE is defined (which is only
defined in a GUI build of Vim). This will eventually lead to a call of
do_browse(), which causes an error message if a GUI is not currently
running (see the TODO: in do_browse()) and will then lead to a failure
in Test_goto_buf_with_onfirm().

Therefore, we must disable the Test_goto_buf_with_onfirm(), when the
dialog_con_gui feature is enabled (which basically means dialog feature
for GUI and Console builds, in contrast to the dialog_con and dialog_gui
feature).

(Previously this wasn't a problem, because the test aborted in the YES
case for the :confirm :b XgotoConf case and did therefore not run into
the browse function call)

closes: vim/vim#14398

df46115fc8

Co-authored-by: glepnir <glephunter@gmail.com>
2024-04-05 18:32:04 +08:00
zeertzjq
9711370c26
feat(defaults): add :Inspect to right-click menu (#28181)
Ref #21393

- Move default user commands to _defaults.lua as that now contains all
  kinds of defaults rather than just default mappings and menus.
- Remove the :aunmenu as there are no menus when _defaults.lua is run.
2024-04-05 18:08:54 +08:00
zeertzjq
a500c5f808
vim-patch:8.1.0815: dialog for file changed outside of Vim not tested (#28184)
Problem:    Dialog for file changed outside of Vim not tested.
Solution:   Add a test.  Move FileChangedShell test.  Add 'L' flag to
            feedkeys().

5e66b42aae

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2024-04-05 18:04:45 +08:00
Christian Clason
4add77ddbf vim-patch:5ccdcc482e29
runtime(java): Improve the matching of contextual keywords

- Recognise a _record_ contextual keyword.
- Recognise _non-sealed_, _sealed_, and _permits_ contextual
  keywords.
- Admit _$_ to keyword characters.
- Group _abstract_, _final_, _default_, _(non-)sealed_
  (apart from _(non-)sealed_, the incompossibility of these
  modifiers calls for attention).
- Remove another _synchronized_ keyword redefinition.

I have also replaced a function with an expression.  Before
patch 8.1.0515, it should have been declared :function! to
work with repeatable script sourcing; there is less to worry
about with an expression.

References:
https://openjdk.org/jeps/395 (Records)
https://openjdk.org/jeps/409 (Sealed Classes)
https://docs.oracle.com/javase/specs/jls/se21/html/jls-3.html#jls-3.8

closes: vim/vim#14403

5ccdcc482e

Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com>
2024-04-05 09:07:07 +02:00
Famiu Haque
75b80516d5
build: fix link error for _BitScanForward64 (#28173)
Problem: The usage of `_BitScanForward64` causes linking to fail on some systems.
Solution: Correctly check if it exists using `check_c_source_compiles`.
2024-04-05 09:56:35 +08:00
zeertzjq
dc69c475a5
vim-patch:9.1.0262: Test for TextChanged is flaky with ASAN (#28180)
Problem:  Test for TextChanged is flaky with ASAN.
Solution: Wait for the file to be non-empty.
          (zeertzjq)

closes: vim/vim#14404

4a65391ca2
2024-04-05 07:24:25 +08:00
dundargoc
e016f5bee6 test: reduce exec_lua calls
`exec_lua` makes code slighly harder to read, so it's beneficial to
remove it in cases where it's possible or convenient.

Not all `exec_lua` calls should be removed even if the test passes as it
changes the semantics of the test even if it happens to pass.

From https://github.com/neovim/neovim/pull/28155#discussion_r1548185779:

"Note for tests like this, which fundamentally are about conversion, you
end up changing what conversion you are testing. Even if the result
happens to be same (as they often are, as we like the rules to be
consistent if possible), you are now testing the RPC conversion rules
instead of the vim script to in-process lua conversion rules."

From https://github.com/neovim/neovim/pull/28155#discussion_r1548190152:

"A test like this specifies that the cursor is valid immediately and not
after a separate cycle of normal (or an other input-processing) mode."
2024-04-04 13:10:11 +02:00
Christian Clason
56701cd21e vim-patch:08d2401fbc6d
runtime(netrw): filetype not detected when editing remote files

fixes: vim/vim#14400

08d2401fbc

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-04-04 10:29:58 +02:00
zeertzjq
15a2dd9e96
vim-patch:89cc03af71d9 (#28168)
runtime(doc): sort filetype.txt in the alphabetical order (vim/vim#14395)

89cc03af71

Co-authored-by: K.Takata <kentkt@csc.jp>
2024-04-04 06:19:13 +08:00
zeertzjq
a469745338
vim-patch:9.1.0259: Normal mode TextChanged isn't tested properly (#28167)
Problem:  Normal mode TextChanged isn't tested properly.
Solution: Combine Test_Changed_ChangedI() and Test_Changed_ChangedI_2()
          and also run it on Windows. Fix a typo in main.c.
          (zeertzjq)

closes: vim/vim#14396

c422662933
2024-04-04 06:11:17 +08:00
bfredl
1b55ed58ec
Merge pull request #28156 from bfredl/attr_extend
refactor(tests): allow to extend the new base set of attrs
2024-04-03 13:39:08 +02:00
Raphael
dbc0fa9bd6
fix(stdpath): remove duplicate directories (#26653) 2024-04-03 18:44:57 +08:00
bfredl
ab0d3c4098
Merge pull request #28157 from fredizzimo/fsundvik/fix-io
fix: prevent child processes from inheriting ui channel file descriptors
2024-04-03 12:35:57 +02:00
Christian Clason
e74cd1d9ff vim-patch:9.1.0253: filetype: typespec files are not recognized
Problem:  filetype: typespec files are not recognized
Solution: Detect '*.tsp' files as typespec
          (Hilmar Wiegand)

Specs is at https://typespec.io/

closes: vim/vim#14392

6c9f4f98f1

Co-authored-by: Hilmar Wiegand <me@hwgnd.de>
2024-04-03 10:45:29 +02:00
zeertzjq
99b3a068de
vim-patch:8.2.4098: typing "interrupt" at debug prompt may keep exception around (#28161)
Problem:    Typing "interrupt" at debug prompt may keep exception around,
            causing function calls to fail.
Solution:   Discard any exception at the toplevel. (closes vim/vim#9532)

069613c9e8

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2024-04-03 10:43:03 +08:00
zeertzjq
30b94ae494
Merge pull request #28153 from zeertzjq/vim-9.0.0581
vim-patch:9.{0.0581,1.0254}
2024-04-03 06:15:31 +08:00
zeertzjq
aeabd8e245 vim-patch:9.1.0254: [security]: Heap buffer overflow when calling complete_add() in 'cfu'
Problem:  [security]: Heap buffer overflow when calling complete_add()
          in the first call of 'completefunc'
Solution: Call check_cursor() after calling 'completefunc' (zeertzjq)

closes: vim/vim#14391

0a419e07a7
2024-04-03 05:55:50 +08:00
zeertzjq
a941207523 vim-patch:9.0.0581: adding a character for incsearch fails at end of line
Problem:    Adding a character for incsearch fails at end of line.
Solution:   Only check cursor line number.

d4566c14e7

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2024-04-03 05:55:50 +08:00
Fred Sundvik
b400b947f3 fix: prevent child processes from inheriting ui channel file descriptors 2024-04-02 22:15:34 +03:00
bfredl
fa74f75710 refactor(tests): allow to extend the new base set of attrs
We start at 100 so we can make the base set larger if needed. (It might need to
grow/shrink as a result of adopting the new default color scheme as the
default for tests)

Usage best illustrataded by example.

Improving the workflow for making new tests with `screen:snapshot_util()` will
be a follow up.
2024-04-02 20:28:27 +02:00
Lewis Russell
d9235efa76 refactor(lsp): move workspace folder logic into the client
- Changed `reuse_client` to check workspace folders in addition to
  root_dir.
2024-04-02 16:47:17 +01:00
dundargoc
ffe3002568 test: silence expected errors
This will remove unrelated errors in .nvimlog at the end of test output.
2024-04-02 17:07:44 +02:00
Christian Clason
6cfca21bac feat(treesitter): add @injection.filename
Problem: Injecting languages for file redirects (e.g., in bash) is not
possible.

Solution: Add `@injection.filename` capture that is piped through
`vim.filetype.match({ filename = node_text })`; the resulting filetype
(if not `nil`) is then resolved as a language (either directly or
through the list maintained via `vim.treesitter.language.register()`).

Note: `@injection.filename` is a non-standard capture introduced by
Helix; having two editors implement it makes it likely to be upstreamed.
2024-04-02 11:13:16 +02:00
Will Hopkins
b3f9da9524
refactor: informative error msg for 'noautocmd' (#28147)
Problem: Attempting to set 'noautocmd' for an existing window throws an error
that just says "Invalid key: 'noautocmd'" which is not very helpful.
Solution: Explain that 'noautocmd' can't be used with existing windows.
2024-04-02 12:48:21 +08:00
Christian Clason
feaab21c71 vim-patch:cc7597c1edf4
runtime(yaml): improve syntax highlighting for YAML

- Recognize block scalar style to avoid unexpected highlighting by `yamlFlowString` (fix vim/vim#11517)
- Improve performance of `yamlFlowMappingKey` by allowing execution by the NFA engine (fix vim/vim#10730)
  - It was intentionally disabled before patterns were optimized by `s:SimplifyToAssumeAllPrintable`.
- Fix detection of flow style mapping indicators (fix vim/vim#8234).
- Enable highlighting of explicit mapping value indicators and node properties in flow style.
- Add syntax highlighting tests

closes: vim/vim#14354

cc7597c1ed

Co-authored-by: itchyny <itchyny@cybozu.co.jp>
2024-04-01 15:52:26 +02:00
zeertzjq
4a6b4b00cb
vim-patch:9.1.0251: Filetype test fails (#28142)
Problem:  Filetype test fails.
Solution: Move detection by name before detection by extension.
          Improve TextChanged test and remove wrong test and fix
          a typo in a comment (zeertzjq).

closes: vim/vim#14373

8eb7523802

The changes to filetype.vim are N/A since Nvim always prefers filename
matches to extension matches.
2024-04-01 21:49:44 +08:00
zeertzjq
381806729d
vim-patch:9.0.1643: filetype detection fails if file name ends in many '~' (#28141)
Problem:    Filetype detection fails if file name ends in many '~'.
Solution:   Strip multiple '~' at the same time. (closes vim/vim#12553)

c12e4eecbb

In Nvim this already works as Lua filetype detection isn't subject to
such a small recursion limit as autocommands, but it still makes sense
to avoid unnecessary recursion.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2024-04-01 18:43:30 +08:00
Christian Clason
2e97ae2664 vim-patch:9.1.0250: filetype: ldscripts cannot be recognized
Problem:  filetype: ldscripts cannot be recognized
Solution: Detect '*/ldscripts/*' as ld
          (Wu, Zhenyu)

closes: vim/vim#14371

4c7098b00a

Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
2024-04-01 12:01:47 +02:00
Christian Clason
000431820e vim-patch:9.1.0249: filetype: rock_manifest and config.ld files are not recognized
Problem:  filetype: rock_manifest and config.ld files are not recognized
Solution: Detect 'rock_manifest' and 'config.ld' as lua
          (Wu, Zhenyu)

closes: vim/vim#14370

a917bd58bd

Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
2024-04-01 12:01:47 +02:00
Christian Clason
19ee281809 vim-patch:9.1.0248: filetype: yarn lock files are not recognized
Problem:  filetype: yarn lock files are not recognized
Solution: Detect 'yarn.lock' files as yaml
          (Wu, Zhenyu)

closes: vim/vim#14369

3b497aa247

Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
2024-04-01 12:01:47 +02:00
Christian Clason
de1a54dfe1 vim-patch:9.1.0247: filetype: bundle config files are not recognized
Problem:  filetype: bundle config files are not recognized
Solution: Detect '*/.bundle/config' as yaml
          (Wu, Zhenyu)

closes: vim/vim#14368

3f6fa93b3b

Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
2024-04-01 12:01:47 +02:00
Christian Clason
09869c3745 vim-patch:9.1.0246: filetype: fontconfig files are not recognized
Problem:  filetype: fontconfig files are not recognized
Solution: detect 'fonts.conf' as xml
          (Wu, Zhenyu)

closes: vim/vim#14367

a2c27b01dc

Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
2024-04-01 12:01:47 +02:00
Christian Clason
fa863c17b2 vim-patch:9.1.0245: filetype: zsh theme, history and zunit files are not recognized
Problem:  filetype: zsh theme, history and zunit files are not
          recognized.
Solution: Detect '.zsh_history', '*.zsh-theme' and '*.zunit' as zsh
          (Wu, Zhenyu)

closes: vim/vim#14366

a55a22a1a3

Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
2024-04-01 12:01:47 +02:00
Christian Clason
239101e32a vim-patch:9.1.0244: filetype: bash history files are not recognized
Problem:  filetype: bash history files are not recognized
Solution: detect .bash-history and .bash_history files as bash
          (Wu, Zhenyu)

closes: vim/vim#14365

84ce55001a

Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
2024-04-01 12:01:47 +02:00
Christian Clason
1a0b27965c vim-patch:9.1.0243: filetype: netrw history file is not recognized
Problem:  filetype: netrw history file is not recognized
Solution: Detect .netrwhist as vim files (Wu, Zhenyu)

closes: vim/vim#14364

abbb4a4f70

Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
2024-04-01 12:01:47 +02:00
Christian Clason
5cdbb22c34 vim-patch:9.1.0242: filetype: octave history files are not recognized
Problem:  filetype: octave history files are not recognized
Solution: Detect octave/history files as octave
          (Wu, Zhenyu)

closes: vim/vim#14363

be71ac694f

Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
2024-04-01 12:01:47 +02:00
Christian Clason
afc7a5611e vim-patch:9.1.0241: filetype: mysql history files are not recognized
Problem:  filetype: mysql history files are not recognized
Solution: Detect .mysql_history as mysql
          (Wu, Zhenyu)

closes: vim/vim#14362

6b285c8cfd

Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
2024-04-01 12:01:47 +02:00