Commit Graph

5912 Commits

Author SHA1 Message Date
zeertzjq
d90f5ab9ac
test(statusline): add test with control characters (#24197) 2023-06-29 11:18:56 +08:00
Justin M. Keyes
e0453d7f57
fix(api): nvim_cmd{cmd="win_getid"} parsed as :winsize #24181
Problem:
`:lua vim.cmd.win_getid(30,10)` is interpreted as `:win[size] 30 10`.
User intention was to call `vim.fn.win_getid(30,10)`.

Solution:
Check that the `cmd` actually matches the resolved command.
2023-06-28 04:51:55 -07:00
zeertzjq
42f9573e5d
vim-patch:9.0.1670: resetting local option to global value is inconsistent (#24185)
Problem:    Resetting local option to global value is inconsistent.
Solution:   Handle "<" specifically for 'scrolloff' and 'sidescrolloff'.
            (closes vim/vim#12594)

bf5f189e44

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-06-28 08:13:14 +08:00
Jaehwang Jung
c7e7f1d4b4
fix(treesitter): make foldexpr work without highlighting (#24167)
Problem: Treesitter fold is not updated if treesitter hightlight is not
active. More precisely, updating folds requires `LanguageTree:parse()`.

Solution: Call `parse()` before computing folds and compute folds when
lines are added/removed.

This doesn't guarantee correctness of the folds, because some changes
that don't add/remove line won't update the folds even if they should
(e.g. adding pair of braces). But it is good enough for most cases,
while not introducing big overhead.

Also, if highlighting is active, it is likely that
`TSHighlighter._on_buf` already ran `parse()` (or vice versa).
2023-06-27 19:05:09 +01:00
ObserverOfTime
8ea9a70d05
vim-patch:9.0.1668: PEM files are not recognized (#24169)
Problem:    PEM files are not recognized.
Solution:   Add patterns to match PEM files. (closes vim/vim#12582)

0256d76a33
2023-06-27 09:14:34 +02:00
zeertzjq
116b09ac04 vim-patch:9.0.1667: regression test doesn't fail when fix is reverted
Problem:    Regression test doesn't fail when fix is reverted.
Solution:   Add "n" to 'cpoptions' instead of using :winsize. (closes vim/vim#12587,
            issue vim/vim#12528)

e429893741
2023-06-27 08:26:11 +08:00
zeertzjq
3b6fb3fefd vim-patch:9.0.1664: divide by zero when scrolling with 'smoothscroll' set
Problem:    Divide by zero when scrolling with 'smoothscroll' set.
Solution:   Avoid using a negative width. (closes vim/vim#12540, closes vim/vim#12528)

8154e642aa

Co-authored-by: fullwaywang <fullwaywang@tencent.com>
2023-06-27 08:26:10 +08:00
Jonas Strittmatter
0ca2d11c1f
vim-patch:9.0.1632: not all cabal config files are recognized (#24025)
Problem:    Not all cabal config files are recognized.
Solution:   Add a couple of patterns. (Marcin Szamotulski, closes vim/vim#12463)

166cd7b801

Also:
- Do not expand Lua patterns in environment variables used in file patterns.
- Test $XDG_CONFIG_HOME on Windows, as it can be used by Nvim (and the runner
  sets it).

Co-authored-by: Marcin Szamotulski <coot@coot.me>
2023-06-26 11:19:13 +01:00
Mike
aa65bd478a
fix(startup): "nvim -l foo.lua" may not set arg0 #24161
Problem:
Using "nvim -l args.lua" without passing extra script args, does not set `_G.arg[0]`.

Steps to reproduce:
```
cat > args.lua<<EOF
vim.print(_G.arg, '')
vim.print(vim.v.argv, '')
EOF

nvim --clean -l args.lua
```

Solution:
Fix condition in command_line_scan.
2023-06-26 02:38:48 -07:00
zeertzjq
cd6458123f
fix(charset): fix wrong display of 0xffff (#24158) 2023-06-26 11:52:52 +08:00
zeertzjq
dc3ee122dc vim-patch:9.0.1665: empty CmdlineEnter autocommand causes errors in Ex mode
Problem:    Empty CmdlineEnter autocommand causes errors in Ex mode.
Solution:   Save and restore ex_pressedreturn. (Christian Brabandt,
            closes # 12581, closes vim/vim#12578)

590aae3557

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-06-26 07:19:36 +08:00
Justin M. Keyes
5ceb2238d3
Merge #24116 from justinmk/doc 2023-06-25 09:17:47 -07:00
Justin M. Keyes
036da0d079 fix(docs): vimdoc syntax errors
gen_help_html: truncate parse-error sample text
2023-06-25 17:14:28 +02:00
Christian Clason
cc624fac68
vim-patch:9.0.1661: BUCK files are not recognized (#24142)
Problem:    BUCK files are not recognized.
Solution:   Recognize BUCK files as "bzl". (Son Luong Ngoc, closes vim/vim#12564)

b46e0f3263

Co-authored-by: Son Luong Ngoc <sluongng@gmail.com>
2023-06-24 20:04:30 +02:00
zeertzjq
8182384205
test(extmarks): add a test for #23848 (#24140) 2023-06-24 22:15:13 +08:00
Christian Clason
c2d696f009
Merge pull request #24082 from smjonas/fix_24064
fix(filetype): correctly detect bash-fc-{id} files as "sh" (vim-patch:9.0.1644)
2023-06-24 13:41:50 +02:00
Ibby
31a51acdc3
fix(extmarks): fix heap buffer overflow caused by inline virtual text (#23851)
also fixes an edge case where the extends character would not be drawn if the real text exactly fits the grid.
2023-06-24 11:39:16 +01:00
smjonas
771dad7a05 vim-patch:9.0.1644: not all filetype file name matches are tested
Problem:    Not all filetype file name matches are tested.
Solution:   Add more file names to test with. (Jonas Strittmatter,
            closes vim/vim#12569)

bd087ae8f0

Co-authored-by: smjonas <jonas.strittmatter@gmx.de>
2023-06-23 18:18:33 +02:00
zeertzjq
3688735c2b
fix(cmdline): don't redraw 'tabline' in Ex mode (#24123)
Redrawing of 'statusline' and 'winbar' are actually already inhibited by
RedawingDisabled in Ex mode.

In Vim there is a check for `msg_scrolled == 0` (which is false in Ex
mode) since Vim doesn't have msgsep. Add a `!exmode_active` check here
in Nvim instead.
2023-06-23 06:40:26 +08:00
Mathias Fußenegger
12c2c16acf
feat(lsp): opt-in to dynamicRegistration for inlay hints (#24102)
Since https://github.com/neovim/neovim/pull/23681 there is dynamic
registration support. We should use that for new features unless there
is a good reason to turn it off.
2023-06-22 19:39:57 +02:00
Christian Clason
904ad5458d
vim-patch:9.0.1645: zserio files are not recognized (#24120)
Problem:    zserio files are not recognized.
Solution:   Add a pattern for zserio files. (Dominique Pellé,
            closes vim/vim#12544)

2b994da57a

Co-authored-by: =?UTF-8?q?Dominique=20Pell=C3=A9?= <dominique.pelle@gmail.com>
2023-06-22 19:38:49 +02:00
zeertzjq
f0884f21fa
feat(extmarks): support hl_mode "combine" for inline virt_text (#24099) 2023-06-22 20:39:35 +08:00
Justin M. Keyes
2f17ef1fc4
fix(messages): use "Vimscript" instead of "VimL" #24111
followup to #24109
fix #16150
2023-06-22 04:09:14 -07:00
Justin M. Keyes
4e6356559c
test: spellcheck :help (vimdoc) files #24109
Enforce consistent terminology (defined in
`gen_help_html.lua:spell_dict`) for common misspellings.

This does not spellcheck English in general (perhaps a future TODO,
though it may be noisy).
2023-06-22 03:44:51 -07:00
zeertzjq
f4f1ce1d16
fix(extmarks): hide inline virt_text properly with 'smoothscroll' (#24106) 2023-06-22 18:15:04 +08:00
zeertzjq
958cc22836
fix(extmarks): empty inline virt_text interfering with DiffText (#24101) 2023-06-22 17:48:53 +08:00
zeertzjq
a9cd8467cb fix(api): wrong nvim_buf_set_extmark error for invalid hl_mode 2023-06-22 15:04:46 +08:00
zeertzjq
0534ad8ca5 fix(extmarks): empty inline virt_text interfering with Visual highlight 2023-06-22 15:04:46 +08:00
zeertzjq
ded01a819a
fix(folds): don't show search or match highlighting on fold (#24084) 2023-06-21 18:28:12 +08:00
Justin M. Keyes
8d4a53fe6e
fix(vim.json)!: remove global options, "null", "array_mt" #24070
Problem:
- `vim.json` exposes various global options which:
  - affect all Nvim Lua plugins (especially the LSP client)
  - are undocumented and untested
  - can cause confusing problems such as: cc76ae3abe
- `vim.json` exposes redundant mechanisms:
  - `vim.json.null` is redundant with `vim.NIL`.
  - `array_mt` is redundant because Nvim uses a metatable
    (`vim.empty_dict()`) for empty dict instead, which `vim.json` is
    configured to use by default (see `as_empty_dict`).
    Example:
    ```
    :lua vim.print(vim.json.decode('{"bar":[],"foo":{}}'))
    --> { bar = {},  foo = vim.empty_dict() }
    ```
    Thus we don't need to also decorate empty arrays with `array_mt`.

Solution:
Remove the functions from the public vim.json interface.
Comment-out the implementation code to minimize drift from upstream.

TODO:
- Expose the options as arguments to `vim.json.new()`
2023-06-21 01:10:32 -07:00
Sooryakiran Ponnath
3bf887f6e0
fix(lsp): always return boolean in lsp.buf_client_attach (#24077)
Co-authored-by: Mathias Fussenegger <f.mathias@zignar.net>
2023-06-20 21:17:13 +02:00
Mathias Fußenegger
64f2691a98
refactor(lsp): extract common execute command functionality (#24065) 2023-06-20 18:36:18 +02:00
Chinmay Dalal
ca5de9306c
feat(lsp): inlay hints #23984
Add automatic refresh and a public interface on top of #23736

 * add on_reload, on_detach handlers in `enable()` buf_attach, and
  LspDetach autocommand in case of manual detach
* unify `__buffers` and `hint_cache_by_buf`
* use callback bufnr in `on_lines` callback, bufstate: remove __index override
* move user-facing functions into vim.lsp.buf, unify enable/disable/toggle

Closes #18086
2023-06-19 23:06:54 -07:00
Justin M. Keyes
cee981bf09
docs #22363
Co-authored by: zeertzjq <zeertzjq@outlook.com>
Co-authored by: Steven Todd McIntyre II <114119064+stmii@users.noreply.github.com>
Co-authored by: nobe4 <nobe4@users.noreply.github.com>

- docs: mention --luadev-mod to run with lua runtime files
  When changing a lua file in the ./runtime folder, a new contributor
  might expect changes to be applied to the built Neovim binary.
2023-06-19 02:24:44 -07:00
Evgeni Chasnovski
8a7e3353eb
fix(fs): make normalize() work with '/' path (#24047)
Problem: Current implementation of "remove trailing /" doesn't
account for the case of literal '/' as path.
Solution: Remove trailing / only if it preceded by something else.

Co-authored by: notomo <notomo.motono@gmail.com>
2023-06-18 06:49:33 -05:00
Jonas Strittmatter
c07dceba33
fix(lsp): allow Lua pattern chars in code action filter (#24041)
Previously, filtering code actions with the "only" option failed
if the code action kind contained special Lua pattern chars such as "-"
(e.g. the ocaml language server supports a "type-annotate" code action).

Solution: use string comparison instead of string.find
2023-06-17 08:01:31 +02:00
zeertzjq
11060793d6 vim-patch:9.0.1635: error message is cleared when removing mode message
Problem:    Error message is cleared when removing mode message.
Solution:   Also reset flags when the message is further down.

da51ad51bf

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-06-16 08:55:05 +08:00
zeertzjq
cba07dad49 vim-patch:9.0.1634: message is cleared when removing mode message
Problem:    Message is cleared when removing mode message (Gary Johnson).
Solution:   Do not clear the command line after displaying a message.

800cdbb7ca

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-06-16 08:55:03 +08:00
zeertzjq
ddba917efe
vim-patch:9.0.1636: expanding a pattern interferes with cmdline completion (#24034)
Problem:    Expanding a pattern interferes with command line completion.
Solution:   Set the file index only when appropriate. (closes vim/vim#12519)

094dd152fe
2023-06-16 07:02:21 +08:00
zeertzjq
1f8fb7c000
fix(:let): fix error when applying operator to boolean option (#24030) 2023-06-15 12:36:21 +08:00
zeertzjq
d81f78713b
test(decorations_spec): add test for extmark case of #21486 (#24028) 2023-06-15 11:14:50 +08:00
zeertzjq
a05bbc60ea
fix(extmarks): don't position overlay virt_text halfway a char (#24027) 2023-06-15 09:03:39 +08:00
zeertzjq
78d77c03de
vim-patch:9.0.1631: passing wrong variable type to option gives multiple errors (#24026)
Problem:    Passing a wrong variable type to an option gives multiple errors.
Solution:   Bail out early on failure. (closes vim/vim#12504)

4c7cb372c1
2023-06-15 08:05:26 +08:00
zeertzjq
bbb934e775
vim-patch:9.0.1629: having utf16idx() rounding up is inconvenient (#24019)
Problem:    Having utf16idx() rounding up is inconvenient.
Solution:   Make utf16idx() round down. (Yegappan Lakshmanan, closes vim/vim#12523)

95707037af

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-06-14 20:54:11 +08:00
Jon Huhn
79a5b89d66
perf(lsp): reduce polling handles for workspace/didChangeWatchedFiles (#23500)
Co-authored-by: Lewis Russell <lewis6991@gmail.com>
2023-06-14 12:40:11 +02:00
zeertzjq
4c7cec4e29
fix(extmarks): handle inline virt_text with empty chunk (#24005) 2023-06-13 11:30:19 +08:00
zeertzjq
a7e5d4238a
vim-patch:8.2.4600: Vim9: not enough test coverage for executing :def function (#24001)
Problem:    Vim9: not enough test coverage for executing :def function.
Solution:   Add a few more tests.  Fix inconsistencies.

6b8c7ba062

Cherry-pick a blank line in test_listdict.vim from patch 8.2.3842.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-06-12 21:58:40 +08:00
zeertzjq
d86acfa149 vim-patch:8.2.3338: Vim9: no type check when assigning a list range
Problem:    Vim9: no type check when assigning a list range. (Naohiro Ono)
Solution:   Check the member type. (closes vim/vim#8750)

89071cb6a1

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-06-12 21:05:56 +08:00
zeertzjq
aa92a04bee vim-patch:8.2.3332: Vim9: cannot assign to range in list
Problem:    Vim9: cannot assign to range in list.
Solution:   Implement overwriting a list range.

4f0884d6e2

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-06-12 21:05:22 +08:00
zeertzjq
aa7c4b88dc vim-patch:8.2.3853: Vim9: not enough tests
Problem:    Vim9: not enough tests.
Solution:   Run more existing tests for Vim9 script.

700e6b1662

Cherry-pick test_listdict.vim change from patch 8.2.3854.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-06-12 18:17:40 +08:00