Commit Graph

26365 Commits

Author SHA1 Message Date
Christian Clason
11844dde81
feat(treesitter): bundle markdown parser and queries (#22481)
* bundle split Markdown parser from https://github.com/MDeiml/tree-sitter-markdown
* add queries from https://github.com/nvim-treesitter/nvim-treesitter/tree/main
* upstream `#trim!` and `#inject-language!` directives

Co-authored-by: dundargoc <gocdundar@gmail.com>
2023-07-01 11:08:06 +02:00
Christian Clason
538b6c3853
build(deps): bump libuv to v1.46.0 (#24218)
https://github.com/libuv/libuv/releases/tag/v1.46.0
2023-07-01 11:07:54 +02:00
zeertzjq
628f6cce80
fix(startup): don't truncate when printing with -l (#24216) 2023-07-01 08:16:34 +08:00
zeertzjq
2493815290
refactor: fix clang/PVS warnings (#24213) 2023-06-30 21:13:08 +08:00
Sanchayan Maity
d191bdf9d5
fix(lsp): fix attempt to call non existent function (#24212)
Commit 37079fc moved inlay_hint to vim.lsp() but in the process did
missed converting a call to disable/enable which are now local.

Fixes the below error when trying to toggle inlay hints.

E5108: Error executing lua /usr/local/share/nvim/runtime/lua/vim/lsp/inlay_hint.lua:248: attempt to call field 'disable' (a nil value)
stack traceback:
        /usr/local/share/nvim/runtime/lua/vim/lsp/inlay_hint.lua:248: in function 'toggle'
        /usr/local/share/nvim/runtime/lua/vim/lsp/inlay_hint.lua:310: in function 'inlay_hint'
        [string ":lua"]:1: in main chunk
2023-06-30 13:42:58 +02:00
zeertzjq
751b9d73fd
Merge pull request #24147 from clason/fix/ftplugin
fix(ftplugin): respect runtimepath ordering
2023-06-30 18:22:02 +08:00
Mathias Fußenegger
37079fca58
feat(lsp): move inlay_hint() to vim.lsp (#24130)
Allows to keep more functions hidden and gives a path forward for
further inlay_hint related functions - like applying textEdits.

See https://github.com/neovim/neovim/pull/23984#pullrequestreview-1486624668
2023-06-30 11:33:28 +02:00
zeertzjq
6cceef6d4c test(lua/runtime_spec): add test for ftplugin ordering 2023-06-30 17:09:43 +08:00
NAKAI Tsuyoshi
d55d7646c1
docs(luaref): fix tags for constants (#24203) 2023-06-30 09:38:28 +08:00
zeertzjq
d7bb19e013
fix(statusline): fill for double-width char after moving items (#24207) 2023-06-30 08:36:09 +08:00
Frede
8758c6fb87
feat(defaults): set g:netrw_use_errorwindow = 0 #24179
Problem:
netrw uses a bespoke window to show messages.

Solution:
change the default so that netrw uses normal vim :echoerr
2023-06-29 14:14:14 -07:00
Chinmay Dalal
7968322e7a
fix(lsp): inlay_hint nil reference error #24202
Problem:
vim_lsp_inlayhint: Error executing lua: .../lsp/_inlay_hint.lua:249: attempt to index field 'applied' (a nil value)

Solution:
Assign {} to bufstates.applied in on_reload

fixes #24172
2023-06-29 07:26:29 -07:00
zeertzjq
aa362a2af8
refactor: remove some casts to char * (#24200) 2023-06-29 15:48:42 +08:00
zeertzjq
7d0a23973b
fix(column): handle unprintable chars in 'statuscolumn' (#24198) 2023-06-29 11:37:55 +08:00
zeertzjq
d90f5ab9ac
test(statusline): add test with control characters (#24197) 2023-06-29 11:18:56 +08:00
zeertzjq
421c66f741
vim-patch:9.0.1671: Termdebug: error with more than 99 breakpoints (#24194)
Problem:    Termdebug: error with more than 99 breakpoints.
Solution:   Use a different sign for breakpoint 100 and over. (closes vim/vim#12589,
            closes vim/vim#12588)

e7d9ca2b3b

Co-authored-by: skywind3000 <skywind3000@163.com>
2023-06-29 07:04:46 +08:00
luukvbaal
a878e02d5d
fix(column): use maxwidth to allocate/fill 'statuscolumn' click defs #24190
Use the actual width of the 'statuscolumn' to allocate and fill its click definition array.
The returned width of the built statuscolumn string may be shorter (and is padded later).
2023-06-28 14:16:03 -07: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
e85e7fc7bc
fix(treesitter): handle empty region when logging (#24173) 2023-06-27 19:05:44 +01: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
Justin M. Keyes
ab65a98adb
fix(docs): ignore_invalid #24174
Regex bug in scripts/gen_help_html.lua:ignore_invalid()
2023-06-27 10:21:27 -07:00
NAKAI Tsuyoshi
929e4865d1
docs(diagnostic): return value of get() #24144 2023-06-27 08:14:17 -07: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
2e055e49a3
Merge pull request #24170 from zeertzjq/vim-9.0.1664
vim-patch:9.0.{1664,1667}: divide by zero when scrolling with 'smoothscroll' set
2023-06-27 08:55:59 +08: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
Justin M. Keyes
7578144cbd
Merge #24153 from justinmk/doc 2023-06-26 02:56:42 -07: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
Justin M. Keyes
17c59e417f fix(docs): vimdoc syntax errors
Prepare for https://github.com/neovim/tree-sitter-vimdoc/pull/108 which improves
`{arg}` highlighting in many common cases:

    vim.foo({bar})
    vim.foo( {bar})
    nvim_foo({bar})
    nvim_foo({bar},{baz})
    nvim_foo({bar}, {baz})
    foo[{buf}]

The tradeoff is that things like `"[{"` are flagged as parse errors.
We could avoid if we drop support for `foo[{buf}]`, but that is rather common
(see `builtin.txt`).
2023-06-26 11:29:12 +02:00
Justin M. Keyes
99cb1f0c37 build(deps): tree-sitter-vimdoc v2.0.1 2023-06-26 11:29:12 +02:00
Christian Clason
b6878f5d63
docs: fix misparsed headings (#24162)
Problem: vimdoc parser requires space between column heading and `~`.

Solution: Add space to docs (and mention it). Also edit `luaref.txt`
headings for consistency.
2023-06-26 11:16:55 +02:00
Christian Clason
b697c0cd4f
fix(treesitter): update lua parser and queries (#24148) 2023-06-26 09:25:46 +02:00
zeertzjq
cd6458123f
fix(charset): fix wrong display of 0xffff (#24158) 2023-06-26 11:52:52 +08:00
zeertzjq
91aeaeef64
Merge pull request #24154 from zeertzjq/vim-9.0.1665
vim-patch:8.2.3833,9.0.1665
2023-06-26 07:55:49 +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
zeertzjq
7966020f70 vim-patch:8.2.3833: error from term_start() not caught by try/catch
Problem:    Error from term_start() not caught by try/catch.
Solution:   save and restore did_emsg when applying autocommands. (Ozaki
            Kiichi, closes vim/vim#9361)

c3f91c0648

Co-authored-by: ichizok <gclient.gaap@gmail.com>
2023-06-26 07:18:54 +08:00
Justin M. Keyes
957d05d16b
fix(docs): too much whitespace around <pre> blocks #24151
Problem:
In the generated docs HTML there is too much whitespace before/after `<pre>`
blocks.
- In the old layout (fixed-width), all text in `.old-help-para` is formatted as
  `white-space:pre`.
- In the new layout, when `<pre>` is at the end of a `<div>`, the margins of
  both are redundant, causing too much space.

Solution:
- In the old layout, always remove `<pre>` margin.
- In the new layout, disable `<pre>` margin if it is the last child.
2023-06-25 12:29:56 -07:00
Justin M. Keyes
5ceb2238d3
Merge #24116 from justinmk/doc 2023-06-25 09:17:47 -07:00
Justin M. Keyes
49a7585981 docs: autocmds, misc 2023-06-25 17:25:47 +02: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
502a7a0558 fix(ftplugin): respect runtimepath ordering
Problem: bundled `ftplugin/foo/*.vim` are sourced before user
`ftplugin/foo.vim`.

Solution: call `runtime!` once on all patterns to be sourced.

Followup to #23801. Fixes #24003.
2023-06-25 12:34:30 +02:00
zeertzjq
e59cf3b3a9
vim-patch:9.0.1663: Termdebug on MS-Windows: some file names are not recognized (#24145)
Problem:    Termdebug on MS-Windows: some file names are not recognized.
Solution:   Do not always change \t and \n. (Christian Brabandt,
            closes vim/vim#12565, closes vim/vim#12560, closes vim/vim#12550)

c9a4a8ab28

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-06-25 08:12:41 +08: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
zeertzjq
57fda7688b
vim-patch:9.0.1659: Termdebug: default highlight cleared if changing colorscheme (#24139)
Problem:    Termdebug: default highlight cleared when changing colorscheme.
Solution:   Use a ColorScheme autocommand. (Christian Brabandt, closes vim/vim#12566,
            closes vim/vim#12555)

279de0cd1f

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-06-24 22:14:57 +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
Chinmay Dalal
fa0a25dcb3
fix(lsp): error in reset_timer on second detach #24117
Problem:
On running `zig fmt` manually, the on_lines callback and the
server both detach (for some reason), and both of them call
`clear()`. This fixes it, otherwise the second one to detach
has an error in `reset_timer` since the bufstate doesn't exist

Solution:
* exit early in clear if `bufstates[bufnr]` is nil
* set bufstatte.enabled to true on reload instead of making bufstate nil
2023-06-23 16:33:15 -07:00