Commit Graph

28793 Commits

Author SHA1 Message Date
Maria José Solano
853f647da6 fix(lsp): handle reverse lookup in capabilities 2024-02-28 20:20:02 +00:00
Maria José Solano
d981670bc9 refactor(lsp): remove outdated comment 2024-02-28 20:20:02 +00:00
Christian Clason
0246f1a897 fix(tohtml): set filetype of generated HTML to html
Problem: `:TOhtml` opens the generated HTML code in a split, meaning it
inherits the `help` filetype if a help buffer is to be converted.

Solution: Explicitly set the filetype to `html`.
2024-02-28 18:34:12 +00:00
notomo
aa62898ae3
fix(lsp): correct the error message's cmd on spawning (#27632) 2024-02-28 17:36:28 +01:00
Jaehwang Jung
7311958e12
fix(lsp): remove unnecessary file load/write when renaming (#27621)
Previously rename would unconditionally read the to-be-renamed file from the
disk and write it to the disk. This is redundant in some cases

If the file is not already loaded, it's not attached to lsp client, so nvim
doesn't need to care about this file.
If the file is loaded but has no change, it doesn't need to be written.
2024-02-28 17:32:25 +01:00
altermo
2f85bbe615 feat!: rewrite TOhtml in lua
Co-authored-by: wookayin <wookayin@gmail.com>
Co-authored-by: clason <c.clason@uni-graz.at>
Co-authored-by: Lewis Russell <me@lewisr.dev>
2024-02-28 16:26:00 +00:00
bfredl
c538ec8522
Merge pull request #27643 from bfredl/metadata2
refactor(metadata): generate all metadata in lua
2024-02-28 11:32:25 +01:00
bfredl
de5cf09cf9 refactor(metadata): generate all metadata in lua
Then we can just load metadata in C as a single msgpack blob. Which also
can be used directly as binarly data, instead of first unpacking all the
functions and ui_events metadata to immediately pack it again, which was
a bit of a silly walk (and one extra usecase of `msgpack_rpc_from_object`
which will get yak shaved in the next PR)
2024-02-28 11:00:38 +01:00
Christian Clason
07b4b7524f vim-patch:e84d2d4432cd
runtime(sh): Update ftplugin, fix vim/vim#14101 (vim/vim#14102)

Add the 'b' flag to 'comments', so that the shebang line is not detected as comment.

Fixes vim/vim#14101.

e84d2d4432

Co-authored-by: dkearns <dougkearns@gmail.com>
2024-02-28 10:56:58 +01:00
Ilia Choly
0190771713
fix(lua): remove uri fragment from file paths (#27647)
Problem: Some LSP servers return `textDocument/documentLink` responses
         containing file URIs with line/column numbers in the fragment.
         `vim.uri_to_fname` returns invalid file names for these URIs.

Solution: Remove the URI fragment from file URIs.
2024-02-28 10:50:53 +01:00
Maria José Solano
cb146cc4aa docs(lpeg): merge upstream changes 2024-02-28 09:22:09 +00:00
zeertzjq
a7788c2e25
vim-patch:b1427b46f5fe (#27652)
runtime(vim): Update base-syntax, improve :echo highlighting (vim/vim#14103)

- Normalise behaviour of :echo commands and improve expression matching.
- Allow continued argument lines.
- Refine string interpolation groups.
- Remove duplicated :menu and :map generated commands that are handled
  specially later in the file.

b1427b46f5

Co-authored-by: dkearns <dougkearns@gmail.com>
2024-02-28 07:57:18 +08:00
zeertzjq
7e46ff791c
vim-patch:9.1.0140: cursor on wrong row after 1 char 'below' virtual text when EOL is shown (#27651)
Problem:  The cursor screen row was incorrectly being calculated when the
          cursor follows a 1 character text_align 'below' virtual text line,
          resulting in the cursor being shown on the wrong line.
          This was caused by a cell size of 2 instead of 1 being used for the EOL
          character, which propagated to the calculation of space for putting the
          'below' virtual text on its own line. (rickhowe)
Solution: Fix the size used for the EOL character in calculating the
          cursor's screen position (Dylan Thacker-Smith)

fixes: vim/vim#11959
related: vim/vim#12028
closes: vim/vim#14096

da0c9137d1

Co-authored-by: Dylan Thacker-Smith <dylan.ah.smith@gmail.com>
2024-02-28 07:28:48 +08:00
Maria José Solano
63f9c2da9a feat(lsp): support completion itemDefaults 2024-02-27 16:50:51 +01:00
Maria José Solano
3d96e3f9f2 refactor(lsp): alias for CompletionResult 2024-02-27 16:50:51 +01:00
Lewis Russell
9beb40a4db feat(docs): replace lua2dox.lua
Problem:

The documentation flow (`gen_vimdoc.py`) has several issues:
- it's not very versatile
- depends on doxygen
- doesn't work well with Lua code as it requires an awkward filter script to convert it into pseudo-C.
- The intermediate XML files and filters makes it too much like a rube goldberg machine.

Solution:

Re-implement the flow using Lua, LPEG and treesitter.

- `gen_vimdoc.py` is now replaced with `gen_vimdoc.lua` and replicates a portion of the logic.
- `lua2dox.lua` is gone!
- No more XML files.
- Doxygen is now longer used and instead we now use:
  - LPEG for comment parsing (see `scripts/luacats_grammar.lua` and `scripts/cdoc_grammar.lua`).
  - LPEG for C parsing (see `scripts/cdoc_parser.lua`)
  - Lua patterns for Lua parsing (see `scripts/luacats_parser.lua`).
  - Treesitter for Markdown parsing (see `scripts/text_utils.lua`).
- The generated `runtime/doc/*.mpack` files have been removed.
   - `scripts/gen_eval_files.lua` now instead uses `scripts/cdoc_parser.lua` directly.
- Text wrapping is implemented in `scripts/text_utils.lua` and appears to produce more consistent results (the main contributer to the diff of this change).
2024-02-27 14:41:17 +00:00
Maria José Solano
7ad2e3c645
docs: fix type of setreg() argument {options} (#27631) 2024-02-27 19:53:49 +08:00
Christian Clason
1a7c38caec vim-patch:c7ddc9b73543
runtime(debian): update Debian syntax files (#14098)

* debversions.vim: Move lunar to unsupported release
* debsources: Add word boundaries around keyword match patterns

c7ddc9b735

Co-authored-by: James McCoy <jamessan@jamessan.com>
Co-authored-by: James Addison <jay@jp-hosting.net>
2024-02-27 10:31:11 +01:00
Christian Clason
c6c19c3b2d build(deps): bump luv to 1.48.0-1 2024-02-27 10:31:02 +01:00
zeertzjq
a4b4442524
vim-patch:2c51e15b66a4 (#27637)
runtime(vim): Update syntax file, improve :substitute matching (vim/vim#14093)

- Differentiate between :substitute and substitute(), fixes vim/vim#13883.
- Match all allowed :substitute delimiters.
- Remove leading context from :substitute matches.

2c51e15b66

Co-authored-by: dkearns <dougkearns@gmail.com>
2024-02-27 06:22:57 +08:00
zeertzjq
0d75324e3b
vim-patch:9.1.0137: <Del> in cmdline mode doesn't delete composing chars (#27636)
Problem:  <Del> in cmdline mode doesn't delete composing chars
Solution: Use mb_head_off() and mb_ptr2len() (zeertzjq)

closes: vim/vim#14095

ff2b79d239
2024-02-27 06:09:06 +08:00
bfredl
2ce3a9efa7
Merge pull request #27635 from bfredl/nomsgvalid
refactor(msgpack): remove undead unpacker code in helpers
2024-02-26 20:28:59 +01:00
Gregory Anders
a8e4ee2f2b
fix(defaults): validate 'channel' before responding to OSC request (#27594)
Validate the channel number before responding to an OSC 10/11 request.
When used with nvim_open_term, the channel number is unset (since there
is no process on the other side of the PTY).
2024-02-26 11:33:16 -06:00
bfredl
cdcdc10411 refactor(msgpack): remove dead unpacker code in helpers
Unpacker code now lives in unpacker.c
This was part of the old unpacker which I forgor to remove.
2024-02-26 14:47:47 +01:00
bfredl
7038fdeee2
Merge pull request #27599 from bfredl/nofilealloc
refactor(fileio): remove API shell layer encouraging unnecessary allocations
2024-02-26 14:43:42 +01:00
VanaIgr
ad5a155b1f
fix(mbyte): fix bugs in utf_cp_*_off() functions
Problems:
- Illegal bytes after valid UTF-8 char cause utf_cp_*_off() to fail.
- When stream isn't NUL-terminated, utf_cp_*_off() may go over the end.
Solution: Don't go over end of the char of end of the string.
2024-02-26 18:12:55 +08:00
zeertzjq
8b4e269156
test(terminal/buffer_spec): re-skip bang test on Windows 2024-02-26 10:11:59 +08:00
zeertzjq
268066e014
fix(process): start pty process eof timer on main thread (#27625) 2024-02-26 09:47:49 +08:00
Maria José Solano
185752614d refactor(types): fix miscellaneous type warnings 2024-02-25 22:08:11 +00:00
bfredl
7447b035ca refactor(shada): devirtualize writer
writer is only ever used with FileDescriptor. We already have separate
code paths for serializing shada data into memory, see
shada_encode_regs() and friends
2024-02-25 11:20:06 +01:00
bfredl
77e928fd3e refactor(fileio): remove API shell layer encouraging unnecessary allocations
Functions like file_open_new() and file_open_fd_new() which just is a
wrapper around the real functions but with an extra xmalloc/xfree around
is an anti-pattern. If the caller really needs to allocate a
FileDescriptor as a heap object, it can do that directly.

FileDescriptor by itself is pretty much a pointer, or rather two:
the OS fd index and a pointer to a buffer. So most of the time an extra
pointer layer is just wasteful.

In the case of scriptin[curscript] in getchar.c, curscript used
to mean in practice:

N+1 open scripts           when curscript>0
zero or one open scripts   when curscript==0

Which means scriptin[0] had to be compared to NULL to disambiguate the
curscript=0 case.

Instead, use curscript==-1 to mean that are no script,
then all pointer comparisons dissappear and we can just use an array of
structs without extra pointers.
2024-02-25 11:20:06 +01:00
Maria José Solano
0fcbda5987
fix(lsp): add snippet regression test (#27618) 2024-02-25 11:05:37 +01:00
zeertzjq
c651a0f643
vim-patch:partial:d086b8f646a6 (#27623)
runtime(doc): fix inconsistent indent (vim/vim#14089)

d086b8f646
2024-02-25 16:38:34 +08:00
zeertzjq
b72dc2d8ad
test: don't use minimal timeout for "intermediate" flag (#27620)
With "intermediate" flag, only using minimal timeout is too short and
may lead to failures.
Also remove the fallback timeout in screen:expect_unchanged(), as having
a different fallback timeout than screen:expect() is confusing.
2024-02-25 13:35:24 +08:00
Gregory Anders
2e1f5055ac
fix(lsp): add assertion for explicit bufnr in apply_text_edits (#27614)
Assert that the buffer number passed to apply_text_edits is fully
resolved (not 0 or null). Pass the known buffer number to
apply_text_edits from lsp.formatexpr().
2024-02-24 19:21:57 -06:00
Evgeni Chasnovski
c2ddef30e7
docs: fix several misleading and superfluous wordings (#27609) 2024-02-25 08:45:34 +08:00
zeertzjq
52fe3741aa
vim-patch:374e26aba2e5 (#27617)
runtime(doc): clarify ':set[l] {option}<' behaviour

closes: vim/vim#14062

374e26aba2

Co-authored-by: Matt Ellis <m.t.ellis@gmail.com>
2024-02-25 08:19:43 +08:00
zeertzjq
091e374c7f
vim-patch:9.1.0135: Insufficient testing for 'delcombine' (#27616)
Problem:  Insufficient testing for 'delcombine'.
Solution: Add test for both Normal and Insert modes without Arabic.
          (zeertzjq)

closes: vim/vim#14086

cd3a13e774
2024-02-25 07:48:54 +08:00
dundargoc
71384129f7 build: download libiconv and gettext from deps repository
Downloading it from https://ftp.gnu.org/pub/gnu/ has started to become
unreliable and we can therefore no longer rely on it.
2024-02-24 17:45:52 +01:00
Jaehwang Jung
8addd27504
fix(lsp): when renaming directory, check path prefix of buffer names (#27603)
For example, when renaming /path/to/dir, buffers like
fern://drawer/file:///path/to/dir, /path/to/dir123 should not be
matched.
2024-02-24 16:47:34 +01:00
zeertzjq
04f723f1a5
vim-patch:9.1.0131: buffer-completion may not always find all matches (#27610)
Problem:  buffer-completion code too complicated and does not always
          find all matches (irisjae)
Solution: do not try to anchor pattern to beginning of line or
          directory-separator, always return all matches

Note: we are considering the non-fuzzy buffer-matching here.

Currently, the buffer-completion code makes 2 attempts to match a
pattern against the list of available patterns. First try is to match
the pattern and anchor it to either the beginning of the file name or
at a directory-separator (// or \\).

When a match is found, Vim returns the matching buffers and does not try
to find a match anywhere within a buffer name. So if you have opened two
buffers like /tmp/Foobar.c and /tmp/MyFoobar.c using `:b Foo` will only
complete to the first filename, but not the second (the same happens
with `getcompletion('Foo', 'buffer')`).

It may make sense, that completion priorities buffer names at directory
boundaries, but it inconsistent, may cause confusion why a certain
buffer name is not completed when typing `:b Foo<C-D>` which returns
only a single file name and then pressing Enter (to switch to that
buffer), Vim will error with 'E93: More than one match for Foo').
Similar things may happen when wiping the /tmp/Foobar.c pattern and
afterwards the completion starts completing other buffers.

So let's simplify the code and always match the pattern anywhere in the
buffer name, do not try to favor matches at directory boundaries. This
is also simplifies the code a bit, we do not need to run over the list
of buffers several times, but only twice.

fixes vim/vim#13894
closes: vim/vim#14082

0dc0bff000

Cherry-pick test_cmdline.vim from patch 9.1.0019 as it already passes.

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-02-24 22:59:28 +08:00
Christian Clason
a0394b648c docs(lsp): mark ClientConfig.init_options as optional
Followup to neovim/neovim#27443
2024-02-24 15:45:54 +01:00
zeertzjq
febf481002
vim-patch:9.1.0132: "C" doesn't include composing chars with 'virtualedit' (#27605)
Problem:  using "C" and 've=all' set, doesn't include composing chars
          when changing a line, keeps the composing chars for whatever
          is typed afterwards.
Solution: Use mb_head_off() and mb_ptr2len() instead of mb_tail_off().
          (zeertzjq)

closes: vim/vim#14083

048761bcd4
2024-02-24 22:04:52 +08:00
Christian Clason
63c9e0c4ae build(deps): bump lua-compat-5.3 to v0.13
* Convert lua_pushlstring from a macro to a function
* strerror_r is not available on mingw
* Support getting io.popen results on file:close() on PUC-Rio Lua 5.1
* Fix missing closing parenthesis in preprocessor macro
* fix detection of LUA_USE_WINDOWS define

Also switch to new org
2024-02-24 15:04:20 +01:00
zeertzjq
9ea8a77b04
vim-patch:9.1.0129: Fix truncation of text_wrap 'wrap' virt text after EOL list char (#27600)
Problem:  Virtual text with text_wrap 'wrap' was effectively being
          truncated by a break conditional on the EOL list character
          being added to the screen line. (BigPeet)
Solution: Remove the condition that was leading to the early break and
          instead fix a similar but incorrectly written outer condition
          that checks if there is more to add at the end of the screen
          line. (Dylan Thacker-Smith)

Also, related:
- update comment in win_line()
- remove no longer necessary at_end_str variable in win_line()

fixes: vim/vim#12725
closes: vim/vim#14079

f548ae7b63

Co-authored-by: Dylan Thacker-Smith <dylan.ah.smith@gmail.com>
2024-02-24 20:16:39 +08:00
Jaehwang Jung
90f6d999b1
refactor(lsp): remove redundant code (#27601)
* use builtin function
* buffer:// was removed in 236c20795e.
2024-02-24 13:14:12 +01:00
zeertzjq
9418381ccc
vim-patch:a35235e824bb (#27598)
runtime(doc) Update help text for matchbufline() and matchstrlist()

closes: vim/vim#14080

a35235e824

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2024-02-24 17:55:32 +08:00
bfredl
acb13c7ac7
Merge pull request #27562 from bfredl/envalloc
perf(os/env): os_getenv() allocation when there is no env var set
2024-02-24 09:57:33 +01:00
bfredl
c5990f2cdc perf(os/env): os_getenv() allocation when there is no env var set
os_getenv("FOO") caches the result when $FOO is set to something
non-empty. However, when $FOO was not set, every new call to
os_getenv("FOO") would allocate a temporary scratch buffer to
immediately throw away.

This has an huge impact e.g. on logging which depends on potentially
non-set env vars.
2024-02-24 09:30:21 +01:00
Tim Pope
15f7ac6a04
docs(lsp): remove obsolete didChangeConfiguration explanation (#27595)
Rendered obsolete by c6d747e6a5.
2024-02-24 07:19:33 +01:00