Commit Graph

31530 Commits

Author SHA1 Message Date
Christian Clason
48c09ed4d9 vim-patch:6c57c30: runtime(compiler): include a basic bash syntax checker compiler
See @saccarosium 's suggestion at
https://github.com/vim/vim/pull/16311#issuecomment-2563447885

closes: vim/vim#16314

6c57c30ad4

Co-authored-by: Konfekt <Konfekt@users.noreply.github.com>
2024-12-28 00:35:32 +01:00
Gregory Anders
35247b00a4
feat(lsp): support function for client root_dir (#31630)
If root_dir is a function it is evaluated when the client is created to
determine the root directory.

This enables dynamically determining the root directory based on e.g.
project or directory structure (example: finding a parent Cargo.toml
file that contains "[workspace]" in a Rust project).
2024-12-27 10:09:22 -06:00
Christian Clason
6d2c67350a build(deps): bump tree-sitter to v0.24.6 2024-12-27 12:23:22 +01:00
Christian Clason
69fbb58385 vim-patch:9.1.0962: filetype: bun.lock file is not recognized
Problem:  filetype: bun.lock file is not recognized
Solution: detect 'bun.lock' file as jsonc filetype
          (Anton Kastritskii)

closes: vim/vim#16308

f07ae5b3bd

Co-authored-by: Anton Kastritskii <halloy52@gmail.com>
2024-12-27 11:40:38 +01:00
glepnir
46c7faa00b
vim-patch:9.1.0963: fuzzy-matching does not prefer full match (#31741)
Problem:  fuzzy-matching does not prefer full match
          (Maxim Kim)
Solution: add additional score for a full match
          (glepnir)

fixes: vim/vim#15654
closes: vim/vim#16300

5a04999a74
2024-12-27 14:23:06 +08:00
zeertzjq
557f2d9700
vim-patch:9b67a2e: runtime(vim): Update base-syntax, allow parens in default arguments (#31738)
Allow parentheses in default arguments specified in :def and :function
definitions.

fixes vim/vim#16243
closes: vim/vim#16269

9b67a2e1dd

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2024-12-27 09:11:03 +08:00
Famiu Haque
6257270040
refactor(options): set option value for non-current context directly
Problem: Currently, we use `switch_option_context` to temporarily switch the current option context before setting an option for a different buffer / window. This is not ideal because we already support getting and setting option values for non-current contexts in the underlying implementation.

Solution: Set option value for non-current context by passing the context directly to the lower level functions. Also introduce a new `OptCtx` struct to store option context information, this will scale much better if we add more option scopes and other context information in the future.
2024-12-26 20:55:13 +06:00
Famiu Haque
98763ce4e9
refactor(autocmd): allow specifying window for autocmd context
Problem: Currently we can only specify a buffer to use for an autocmd context through `aucmd_prepbuf()`, which finds a window that uses that buffer in the current tabpage, or creates an autocmd window. This means it's not possible to actually specify a window to use for an autocmd.

Solution: Add an `aucmd_prepbuf_win()` function which also takes a window as a parameter and uses it for the autocmd. If the window is not provided, then it behaves similarly to `aucmd_prepbuf()`
2024-12-26 19:51:13 +06:00
Artem
487c48ec86
fix(api): clamp range lines in nvim__redraw() (#31710)
Problem:
`nvim__redraw()` doesn't clamp the lines in the `range` parameter before truncating to int. The resulting range may be empty when the original range contained buffer lines and vice versa.

E.g. for a buffer with 4 lines, these are the redrawn lines:

```lua
{ 2, 2 ^ 31 } -> none (should be { 2, 3 })
{ 2, 2 ^ 32 } -> none (should be { 2, 3 })
{ 2 ^ 32 - 1, 2 } -> { 0, 1 } (should be none)
```

Solution:
Clamp `range` values before truncating to int.
2024-12-25 21:12:40 +01:00
Christian Clason
7567f7d322 vim-patch:9.1.0961: filetype: TI gel files are not recognized
Problem:  filetype: TI gel files are not recognized
Solution: detect '*.gel' files as gel filetype, include
          get filetype and syntax plugins
          (Wu, Zhenyu)

References:
https://downloads.ti.com/ccs/esd/documents/users_guide/ccs_debug-gel.html

closes: vim/vim#16226

9360de9027

Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
2024-12-25 13:38:45 +01:00
Christian Clason
01e1598072 vim-patch:9.1.0960: filetype: hy history files are not recognized
Problem:  filetype: hy history files are not recognized
Solution: detect '*.hy', '.hy-history' files as hy filetype,
          detect '.lips_repl_history' files are scheme filetype
          (Wu, Zhenyu)

closes: vim/vim#16298

a32daed559

Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
2024-12-25 13:38:45 +01:00
Shihua Zeng
b51110f4a1
docs(api): return type of nvim_get_keymap() #31708 2024-12-24 09:56:10 -08:00
zeertzjq
f8df96d276
Merge pull request #31713 from glepnir/vim-9.1.0954
vim-patch:9.1.{0954,0956}
2024-12-24 19:34:47 +08:00
Mathias Fussenegger
34cd94812d feat(test): support and document lua test case debugging
Similar to how there is a `GDB` environment variable to let the nvim
test instances to be run under `gdbserver` this adds a `OSV_PORT`
variable to start nvim test instances with `osv` in blocking mode to let
a debug client attach to it for debugging of `exec_lua` code blocks.
2024-12-24 12:29:39 +01:00
glepnir
05eca4c04d vim-patch:9.1.0956: completion may crash, completion highlight wrong with preview window
Problem:  completion may crash, completion highlight wrong with preview
          window (after v9.1.0954)
Solution: correctly calculate scroll offset, check for preview window
          when adding extra highlighting
          (glepnir)

when there have a preview window prepare_tagpreview
will change curwin to preview window and this may cause
ComplMatchIns check condition not correct. check wp is curwin
and also the type of wp is not a preview or poup info

fixes: https://github.com/vim/vim/issues/16284
closes: https://github.com/vim/vim/pull/16283

8d0bb6dc9f
2024-12-24 18:56:40 +08:00
glepnir
a103ec7449 vim-patch:9.1.0954: popupmenu.c can be improved
Problem:  popupmenu.c can be improved
Solution: slightly refactor the logic
          (glepnir)

closes: vim/vim#16271

Replace some if blocks and combine user attr abstract to an inline
function.

89a107efd1

Co-authored-by: glepnir <glephunter@gmail.com>
2024-12-24 18:56:40 +08:00
Christian Clason
14ee1de7e5 vim-patch:9.1.0958: filetype: supertux2 config files detected as lisp
Problem:  filetype: supertux2 config files detected as lisp
Solution: detect supertux2 config files as scheme instead
          (Wu, Zhenyu)

References:
https://github.com/SuperTux/supertux/wiki/S-Expression

supertux uses #t and #f as bool type, which is same as scheme, not
common lisp

closes: vim/vim#16287

e62d93ead1

Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
2024-12-24 11:55:06 +01:00
Gregory Anders
c51bf5a6b2
fix(terminal): set cursor cell percentage (#31703)
Fixes: https://github.com/neovim/neovim/issues/31685
2024-12-23 15:39:36 -06:00
Yorick Peterse
4cbeb6fa3c
fix(diagnostic): silence :chistory #31701
vim.diagnostic.set_list() uses chistory to restore the actively selected
entry whenever necessary. This however also results in it displaying
some output in the message bar, but this output isn't useful (and can
even be distracting) when opening the quickfix window. This fixes this
by silencing the chistory command.
2024-12-23 11:57:15 -08:00
Justin M. Keyes
ffaab09e99
fix(build): <termios.h> is system-dependent #31705
Problem:
Since 2a7d0ed614, build fails with glibc
version 2.28 / RHEL8 (where `termios.h` does not include unistd.h and is
therefore missing `_POSIX_VDISABLE`):

    …/src/nvim/tui/termkey/termkey.c: In function 'termkey_start':
    …/src/nvim/tui/termkey/termkey.c:516:31: error: '_POSIX_VDISABLE' undeclared (first use in this function)
      516 |         termios.c_cc[VQUIT] = _POSIX_VDISABLE;
          |                               ^~~~~~~~~~~~~~~
    …/src/nvim/tui/termkey/termkey.c:516:31: note: each undeclared identifier is reported only once for each function it appears in

Solution:
- Undo the `<termios.h>` change and mark the imports with `IWYU pragma: keep`.
2024-12-23 11:13:19 -08:00
dundargoc
d74c74aae3 build: remove lintcommit from lint target
Previously, `make lint` would invoke `lintcommit` which would fail if
there were fixup or other disallowed commits. This would disrupt local
development as developers would often want non-commit linting to work
early on without needing to adhere to the strict commit rules.
2024-12-23 17:42:39 +01:00
Justin M. Keyes
a1fa2b3a4e
refactor(eval): move funcs to deprecated.c #31650 2024-12-23 07:39:25 -08:00
dundargoc
25abcd243e fix: fix broken wasmtime build
Regression from 2a7d0ed614, which removed
header that is only needed if wasmtime support is enabled. Prevent this
from happening again by wrapping the include in a `HAVE_WASMTIME` check.
2024-12-23 16:07:09 +01:00
Justin M. Keyes
2a7d0ed614
refactor: iwyu #31637
Result of `make iwyu` (after some "fixups").
2024-12-23 05:43:52 -08:00
Lukasz Piepiora
55c5d0de26
docs(api): vim.version.range():has() method #31622
Problem:
The :has() method of the vim.version.range() result is not documented
though it's mentioned in examples.

Solution:
Mention it in the range() result doc.
2024-12-23 05:08:20 -08:00
Christian Clason
adcd9360df vim-patch:4ce1cb5: runtime(graphql): contribute vim-graphql to Vim core
Contribute the core of my vim-graphql project (ftplugin, indent, syntax)
to the Vim project. This replaces the basic ftplugin support that was
already in the runtime with a more complete set of filetype settings. I
can assume maintainership for all of these files.

I'll continue to maintain the higher-level embedded filetype support
separately (in vim-graphql) for now, because it's fairly complex, but we
can consider integrating that code directly into vim later.

runtime files use the MIT license.

closes: vim/vim#16273

4ce1cb5bf1

Co-authored-by: Jon Parise <jon@indelible.org>
2024-12-23 11:34:23 +01:00
Justin M. Keyes
7e1c1ff7fc
Merge #31661 cmdline_show/hide events 2024-12-22 16:06:46 -08:00
Luuk van Baal
a10636fbe7 feat(ui): specify whether msg_show event is added to history
Pass along whether message in msg_show event is added to the internal
:messages history.
2024-12-23 00:37:28 +01:00
Christian Clason
665a0e85c4 vim-patch:9.1.0953: filetype: APKBUILD files not correctly detected
Problem:  filetype: APKBUILD files not correctly detected
Solution: detect 'APKBUILD' files as apkbuild filetype,
          include a apkbuild syntax script (which basically
          just sources the sh.vim syntax file)
          (Hugo Osvaldo Barrera)

Vim plugins (e.g.: ALE, nvim-lspconfig, etc) rely on filetype to
determine which integrations/helpers are applicable. They expect
filetype=apkbuild for APKBUILD files.

On the other hand, plugins also enable bash-specific linters and
functionality when filetype=bash, but APKBUILD files are POSIX sh, not
bash, so these often provide bogus results.

Change the filetype for APKBUILD to a 'apkbuild', so that tools and
ftplugin can properly target these files. This filetype will use the
existing `sh` syntax rules, since these are applicable for them.

7cb24917a1

Co-authored-by: Hugo Osvaldo Barrera' via vim_dev <vim_dev@googlegroups.com>
2024-12-22 18:05:07 +01:00
luukvbaal
d1e00a5f6d
fix(messages): typo and unwanted truncation in msg_outtrans_long #31669
- Typo/bug in msg_outtrans_long passing string length as "hist" argument.
- Avoid truncating message in msg_outtrans_long with ext_messages (followup to 
  1097d239c3).
- Remove `_hl` from `msg_keep`, `smsg_keep` as there is no non-`_hl` variant.
- `msg_printf_hl` is removed (identical to `smsg` except it sets
  `msg_scroll = true`, seemingly as a caveat to force a more prompt in
  cmdline mode). Move this logic to the only the only place this was
  used in ex_getln.c.
2024-12-22 06:42:48 -08:00
Luuk van Baal
394f69a25d feat(ui): additional arguments for cmdline_show/hide events
Problem:  Unable to tell what highlight the prompt part of a
          cmdline_show event should have, and whether cmdline_hide was
          emitted after aborting.
Solution: Add additional arguments hl_id to cmdline_show, and abort to
          cmdline_hide.
2024-12-22 15:23:43 +01:00
Christian Clason
c7a4197a5c vim-patch:9.1.0951: filetype: jshell files are not recognized
Problem:  filetype: jshell files are not recognized
Solution: detect '*.jsh' files as java filetype
          (Konfekt)

closes: vim/vim#16260

62e3014ab1

Co-authored-by: Konfekt <Konfekt@users.noreply.github.com>
2024-12-22 11:58:51 +01:00
dundargoc
fd05c7f19d test: format C test files and fix clang-tidy warnings
It's probably not worth adding the C test files to regular formatting as
they're pretty much never touched, but ensuring the files are formatted
according to our standards and getting rid of warnings is a cheap
one-time fix.
2024-12-21 16:01:58 +01:00
Gregory Anders
130b5fd85f
feat(lsp): return table from lsp/ files on runtimepath (#31663)
Problem: LSP configs on the runtimepath must have the same name as the
LSP server and must also explicitly set the name in vim.lsp.config. This
is redundant and creates a footgun where a user may accidentally use the
wrong name when assigning to the vim.lsp.config table.

Solution: Return a table from lsp/ runtimepath files instead
2024-12-21 08:27:27 -06:00
dundargoc
382eb878bc build: bump lua dev dependencies
busted: 2.1.1 -> 2.2.0
https://github.com/lunarmodules/busted/releases/tag/v2.1.2
https://github.com/lunarmodules/busted/releases/tag/v2.2.0

luacheck: 1.1.0 -> 1.2.0
https://github.com/lunarmodules/luacheck/releases/tag/v1.1.1
https://github.com/lunarmodules/luacheck/releases/tag/v1.1.2
https://github.com/lunarmodules/luacheck/releases/tag/v1.2.0
2024-12-21 13:07:34 +01:00
Christian Clason
5f8fac00bf vim-patch:70881ba: runtime(dockerfile): do not set commentstring in syntax script
fixes: vim/vim#16268

70881ba195

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-12-21 11:31:04 +01:00
Christian Clason
0fea57bc71 vim-patch:9.1.0950: filetype: fennelrc files are not recognized
Problem:  filetype: fennelrc files are not recognized
Solution: detect 'fennelrc' files as fennel filetype
          (Wu Zhenyu)

References:
https://github.com/bakpakin/Fennel/issues/193

closes: vim/vim#16262

f173f4249f

Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
2024-12-21 11:30:52 +01:00
zeertzjq
725d3e25a3
vim-patch:c673b80: runtime(netrw): more reformating vim/vim#16248 (#31662)
closes: vim/vim#16266

c673b805ad

Co-authored-by: shane.xb.qian <shane.qian@foxmail.com>
2024-12-21 01:17:23 +00:00
luukvbaal
e1c2179dd9
fix(coverity): INTEGER_OVERFLOW #31657
CID 516419:  Integer handling issues  (INTEGER_OVERFLOW)
    /src/nvim/message.c: 2242 in msg_puts_display()
    2236         }
    2237         // Concat pieces with the same highlight
    2238         size_t len = maxlen < 0 ? strlen(str) : strnlen(str, (size_t)maxlen);
    2239         ga_concat_len(&msg_ext_last_chunk, str, len);
    2240         msg_ext_cur_len += len;
    2241         // When message ends in newline, reset variables used to format message: msg_advance().
    >>>     CID 516419:  Integer handling issues  (INTEGER_OVERFLOW)
    >>>     Expression "len - 1UL", which is equal to 18446744073709551615, where "len" is known to be equal to 0, underflows the type that receives it, an unsigned integer 64 bits wide.
    2242         if (str[len - 1] == '\n') {
    2243           msg_ext_cur_len = 0;
    2244           msg_col = 0;
    2245         }
    2246         return;
    2247       }
2024-12-20 07:48:40 -08:00
Tomasz N
909b18d05a
fix(messages): no message kind for completion menu messages #31646 2024-12-20 04:41:57 -08:00
Dan Pascu
4e130c1ee4
fix(vim.system): invalid MAX_TIMEOUT for 32-bit systems #31638
The maximum signed value on 32-bit systems is 2 ^ 31 - 1. When using 2 ^ 31 for
the default timeout, the value would overflow on such systems resulting in
a negative value, which caused a stack trace when calling wait() without
a timeout.
2024-12-20 01:43:56 -08:00
zeertzjq
39781be14b
vim-patch:c363ca1: runtime(netrw): change indent size from 1 to 2 (#31648)
closes: vim/vim#16248

c363ca1ecd

Co-authored-by: Luca Saccarola <github.e41mv@aleeas.com>
2024-12-20 11:33:05 +08:00
zeertzjq
889f9a0c5d
vim-patch:9.1.0948: Missing cmdline completion for :pbuffer (#31645)
Problem:  Missing cmdline completion for :pbuffer.
Solution: Add cmdline completion for :pbuffer like :buffer.
          (zeertzjq)

fixes: vim/vim#16250
closes: vim/vim#16251

3baf19a2b1
2024-12-20 08:04:46 +08:00
Justin M. Keyes
8ef41f5902
feat(jobs): jobstart(…,{term=true}), deprecate termopen() #31343
Problem:
`termopen` has long been a superficial wrapper around `jobstart`, and
has no real purpose. Also, `vim.system` and `nvim_open_term` presumably
will replace all features of `jobstart` and `termopen`, so centralizing
the logic will help with that.

Solution:
- Introduce `eval/deprecated.c`, where all deprecated eval funcs will live.
- Introduce "term" flag of `jobstart`.
- Deprecate `termopen`.
2024-12-19 07:07:04 -08:00
luukvbaal
a5a4149e97
docs(api): specify when decor provider on_buf is called #31634 2024-12-19 07:04:33 -08:00
luukvbaal
31d6885deb
fix(messages): better formatting for :highlight with ext_messages #31627
Also avoid going down message callstack with empty message, and remove expected grid for some tests where it did not change, and we are just testing for expected messages.
2024-12-19 06:24:48 -08:00
zeertzjq
02bc40c194
vim-patch:9.1.0945: ComplMatchIns highlight doesn't end after inserted text (#31628)
Problem:  ComplMatchIns highlight doesn't end after inserted text.
Solution: Handle ComplMatchIns highlight more like search highlight.
          Fix off-by-one error. Handle deleting text properly.
          (zeertzjq)

closes: vim/vim#16244

f25d8f9312
2024-12-18 23:59:03 +00:00
luukvbaal
160cbd0ef4
test(cursor_spec): global highlight definitions (#31613) 2024-12-18 19:06:16 +00:00
Gregory Anders
3db3947b0e
fix(terminal): restore cursor from 'guicursor' on TermLeave (#31620)
Fixes: https://github.com/neovim/neovim/issues/31612
2024-12-18 11:41:05 -06:00
Lewis Russell
7121983c45 refactor(man.lua): various changes
- Replace all uses of vim.regex with simpler Lua patterns.
- Replace all uses of vim.fn.substitute with string.gsub.
- Rework error handling so expected errors are passed back via a return.
  - These get routed up an passed to `vim.notify()`
  - Any other errors will cause a stack trace.
- Reworked the module initialization of `localfile_arg`
- Updated all type annotations.
- Refactored CLI completion by introduction a parse_cmdline()
  function.
- Simplified `show_toc()`
- Refactor highlighting
- Inline some functions
- Fix completion on MacOS 13 and earlier.
  - Prefer `manpath -q` over `man -w`
- Make completion more efficient by avoiding vim.fn.sort and vim.fn.uniq
  - Reimplement using a single loop
2024-12-18 14:40:36 +00:00