Commit Graph

2762 Commits

Author SHA1 Message Date
Tristan Knight
bcae8be91f
docs: vim.lsp.rpc.connect() TCP requires IP address #30219
"localhost" would work if we used
[tcp_connect](ae0387742b/examples/echo-server-client.lua (L42)),
but that will require changes to
[vim.lsp.rpc.connect](318c0415d5/runtime/lua/vim/lsp/rpc.lua (L638)).
2024-09-01 15:46:01 -07:00
Justin M. Keyes
61e9137394
docs: misc #28970 2024-09-01 13:01:24 -07:00
Gregory Anders
6913c5e1d9
feat(treesitter)!: default to correct behavior for quantified captures (#30193)
For context, see https://github.com/neovim/neovim/pull/24738. Before
that PR, Nvim did not correctly handle captures with quantifiers. That
PR made the correct behavior opt-in to minimize breaking changes, with
the intention that the correct behavior would eventually become the
default. Users can still opt-in to the old (incorrect) behavior for now,
but this option will eventually be removed completely.

BREAKING CHANGE: Any plugin which uses `Query:iter_matches()` must
update their call sites to expect an array of nodes in the `match`
table, rather than a single node.
2024-09-01 18:01:53 +00:00
Gregory Anders
318c0415d5
fix(ui): correctly pass metadata to get_node_text #30222
Fixes: #30220
2024-09-01 10:15:02 -07:00
Yi Ming
9b983e5f6c docs(treesitter): annotate some tables as TSMetadata 2024-09-01 10:45:24 +01:00
Gregory Anders
9762c5e340
feat(ui): gx: use url extmark attribute and tree-sitter directive (#30192)
Use the "url" extmark attribute as well as the "url" tree-sitter
metadata key to determine if the cursor is over something Nvim considers
a URL.
2024-08-31 19:56:20 -05:00
glepnir
42ed0ffad9
fix(lsp): when prefix is non word add all result into matches (#30044)
Problem: prefix can be a symbol like period, the fuzzy matching can't
handle it correctly.

Solution: when prefix is empty or a symbol add all lsp completion
result into matches.
2024-08-30 20:23:49 +02:00
bfredl
cfdf68a7ac feat(mbyte): support extended grapheme clusters including more emoji
Use the grapheme break algorithm from utf8proc to support grapheme
clusters from recent unicode versions.

Handle variant selector VS16 turning some codepoints into double-width
emoji. This means we need to use ptr2cells rather than char2cells when
possible.
2024-08-30 11:49:09 +02:00
Riley Bruins
59baa5e8a1
fix(tohtml): apply sp color if present #30110
Problem:
Things like underlines are always given a default foreground highlight
regardless of the value of `sp`.

Solution:
Check for `sp` first, and apply that color to the text decoration color if it
exists.

Limitations:
If there is no value of `sp`, vim applies a text decoration color that matches
the foreground of the text. This is still not implemented (and seems like a much
more complex problem): in TOhtml, the underline will still be given a default
foreground highlight.
2024-08-29 09:36:33 -07:00
zeertzjq
7588ff2d89
fix(man): check if buffer is valid before restoring 'tagfunc' (#30180) 2024-08-29 11:53:48 +00:00
glepnir
6c2186a998
docs(eval): fix wrong return type of getcharsearch() (#30176) 2024-08-29 18:02:23 +08:00
dundargoc
cd05a72fec
docs: misc (#29719)
Co-authored-by: Evgeni Chasnovski <evgeni.chasnovski@gmail.com>
Co-authored-by: Lauri Heiskanen <lauri.heiskanen@nimble.fi>
Co-authored-by: Piotr Doroszewski <5605596+Doroszewski@users.noreply.github.com>
Co-authored-by: Tobiasz Laskowski <tobil4sk@outlook.com>
Co-authored-by: ariel-lindemann <41641978+ariel-lindemann@users.noreply.github.com>
Co-authored-by: glepnir <glephunter@gmail.com>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2024-08-29 06:11:32 +08:00
Maria José Solano
dad55f5e76
feat(lsp): export diagnostic conversion functions (#30064) 2024-08-27 13:16:33 -05:00
Riley Bruins
f8e1ebd6f6 fix(treesitter): escape things like " in omnifunc results 2024-08-27 09:27:47 +02:00
Maria José Solano
d9ccd828b0
fix(lsp): return call hierarchy item, not the index (#30145) 2024-08-26 17:37:36 +02:00
Maria José Solano
0e394f136f
fix(lsp): log when receiving markup messages (#30065) 2024-08-26 17:35:43 +02:00
Mathias Fußenegger
983953858e
fix(lsp): fix isIncomplete condition in completion trigger (#30130)
Follow up to https://github.com/neovim/neovim/pull/30028#discussion_r1726539370
2024-08-26 17:34:54 +02:00
Lewis Russell
688b961d13 feat(treesitter): add support for wasm parsers
Problem: Installing treesitter parser is hard (harder than
climbing to heaven).

Solution: Add optional support for wasm parsers with `wasmtime`.

Notes:

* Needs to be enabled by setting `ENABLE_WASMTIME` for tree-sitter and
  Neovim. Build with
  `make CMAKE_EXTRA_FLAGS=-DENABLE_WASMTIME=ON
  DEPS_CMAKE_FLAGS=-DENABLE_WASMTIME=ON`
* Adds optional Rust (obviously) and C11 dependencies.
* Wasmtime comes with a lot of features that can negatively affect
  Neovim performance due to library and symbol table size. Make sure to
  build with minimal features and full LTO.
* To reduce re-compilation times, install `sccache` and build with
  `RUSTC_WRAPPER=<path/to/sccache> make ...`
2024-08-26 16:44:03 +02:00
JonnyKong
b8135a76b7 fix(docs): wrong return value annotation for nvim_buf_get_extmarks 2024-08-25 08:36:00 +01:00
glepnir
1f5bcc7c4e
feat(lsp): completion opts support custom item conversion (#30060)
Problem: Some items of completion results include function signatures that can
cause the pum to be very long when a function has many params, because pum
scales with the longest word/abbr.

Solution: add custom covert function that can customise abbr to remove params.
2024-08-22 21:42:27 +02:00
glepnir
e48179f31e
fix(lsp): suppress completion request if completion is active (#30028)
Problem: the autotrigger mechanism could fire completion requests despite
completion already being active from another completion mechanism or manual
trigger

Solution: add a condition to avoid an additional request.
2024-08-22 09:51:44 +02:00
atusy
fe5ae88b20
fix(lsp): update request name to capability map #30098
Add items based on specifications (<https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocumentClientCapabilities>)

- textDocument/documentColor
- textDocument/inlineValue
- textDocument/linkedEditingRange
- textDocument/moniker
- textDocument/onTypeFormatting
- textDocument/selectionRange
2024-08-20 06:37:03 -07:00
Ricardo Casía
766d503627
docs(lsp): annotate with vim.lsp.protocol.Methods enum #29521
Added the enum type annotation `vim.lsp.protocol.Methods` to provide some intellisense support.
2024-08-20 05:52:14 -07:00
Gregory Anders
33464189bc
fix(vim.text): handle very long strings (#30075)
Lua's string.byte has a maximum (undocumented) allowable length, so
vim.text.hencode fails on large strings with the error "string slice too
long".

Instead of converting the string to an array of bytes up front, convert
each character to a byte one at a time.
2024-08-17 22:28:03 -05:00
Maria José Solano
a901fb875f
fix(docs): add missing properties to hl_info #30032 2024-08-16 08:36:23 -07:00
zeertzjq
ee5aaba215
fix(man): avoid setting v:errmsg (#30052) 2024-08-15 22:02:20 +08:00
futsuuu
67bb0cfa79 fix(loader): follow the style of the error message for built-in loaders
start the error message with '\n\t' instead of '\n'
surround the module name by single quotes
2024-08-13 14:05:10 +01:00
Aaron
65a703e060
fix(lua): ignore stdout and stderr for xdg-open
Ref #19724
Fix #29932
2024-08-12 07:03:48 +00:00
Lewis Russell
9b5ab66678 test(lsp): refactor and tidy
- Merge all the top level 'LSP' describe blocks
- Refactor text edit tests
- Fix typing errors
- Add linebreaks between tests
2024-08-11 15:14:14 +01:00
Christian Clason
8df6736ca1 feat(term): enable reflow by default (#21124)
Problem: Contents of terminal buffer are not reflown when Nvim is
resized.

Solution: Enable reflow in libvterm by default. Now that libvterm is
vendored, also fix "TUI rapid resize" test failures there.

Note: Neovim's scrollback buffer does not support reflow (yet), so lines
vanishing into the buffer due to a too small window will be restored
without reflow.
2024-08-10 10:26:07 +02:00
zeertzjq
e01ccda1be vim-patch:0cc5dce: runtime(doc): clarify directory of Vim's executable vs CWD
According to :h win32-PATH, "the same directory as Vim" means the same
directory as the Vim executable, not Vim's current directory.  In patch
8.2.4860 these two concepts were mixed up.

closes: vim/vim#15451

0cc5dce578
2024-08-09 07:21:59 +08:00
Grzegorz Rozdzialik
7031949be0
fix(lsp): avoid reusing diagnostics from different servers in actions (#30002)
Problem: When preparing the parameters for a code actions LSP request,
the code set `context.diagnostics` when processing the first LSP client,
and then reused those `context.diagnostics` for subsequent LSP clients.

This meant that the second and next LSP clients got diagnostics that
did not originate from them, and they did not get the diagnostics that
they sent.

Solution: Avoid setting `context.diagnostics` (which is referenced by
all clients). Instead, set `params.context.diagnostics` directly, which
is specific to a single client.

Fixes #30001
Caused by #29501
2024-08-07 17:28:01 +02:00
Yi Ming
0a1212ef94 docs(treesitter): generate inline docs for Ranges
docs(treesitter): in-place parameter description

docs(treesitter): remove internal type names

docs(treesitter): add missing private annotation
2024-08-06 18:18:34 +02:00
zeertzjq
37952bf7b4
vim-patch:8.2.4838: checking for absolute path is not trivial (#29990)
Problem:    Checking for absolute path is not trivial.
Solution:   Add isabsolutepath(). (closes vim/vim#10303)

dca1d40cd0

vim-patch:8a3b805c6c9c

Co-authored-by: LemonBoy <thatlemon@gmail.com>
2024-08-06 21:19:12 +08:00
zeertzjq
28fbba2092
vim-patch:9.1.0465: missing filecopy() function (#29989)
Problem:  missing filecopy() function
Solution: implement filecopy() Vim script function
          (Shougo Matsushita)

closes: vim/vim#12346

60c8743ab6

Co-authored-by: Shougo Matsushita <Shougo.Matsu@gmail.com>
2024-08-06 12:49:59 +00:00
Christian Clason
3b58d93aae docs(filetype): consolidate comments in dev_vimpatch.txt 2024-08-03 14:14:42 +02:00
Evgeni Chasnovski
37910f2703 docs(filetype): add note about prefering explicit lists over pattern 2024-08-03 14:14:42 +02:00
Evgeni Chasnovski
95e0289cb2 refactor(filetype): use extension match instead of pattern if possible
Problem: some patterns are used as a replacement for several explicit
  extension matches (like '%.[Ss][Yy][Ss]$', '%.php%d$', etc.).
  They usually correspond to Vim's "ignore case" regexes (like
  '*.sys\c') and "convenience" patterns to not define many of them (like
  '*.php\d').
  As matching extension directly is faster and more explicit, it should
  be preferred.
Solution: move all such patterns to direct extension match.
2024-08-03 14:14:42 +02:00
Evgeni Chasnovski
66a74535d4 refactor(filetype): use file name match instead of pattern if possible
Problem: some patterns are used as a replacement for one-two explicit
  file matches (like '^[mM]akefile$'). As matching file name directly is
  faster and more explicit, it should be preferred.
Solution: move those patterns to direct file name match.
  NOTE: this is not strictly backwards compatible, because exact file
  name matching is done *before* pattern matching. If user has
  conflicting `vim.filetype.add()` call with high priority (like with
  `pattern='file$'` and `priority=100`), after this change it will be
  ignored (i.e. 'makefile' will match exactly).
  Judging by converted cases, it seems reasonable to prefer exact
  matches there.
2024-08-03 14:14:42 +02:00
Jaehwang Jung
eb629cce91
fix(lsp): redundant spaces in lsp log (#29970) 2024-08-03 11:14:34 +02:00
Mathias Fußenegger
6072153796
feat(lsp): announce codeLens resolveSupport (#29956)
The codelens implementation can resolve command via `codeLens/resolve`.

The spec added client capabilities for that:

https://github.com/microsoft/language-server-protocol/pull/1979
2024-08-03 11:14:12 +02:00
Christian Clason
e7f8349a2e vim-patch:9.1.0655: filetype: goaccess config file not recognized
Problem:  filetype: goaccess config file not recognized
Solution: detect 'goaccess.conf' as goaccess filetype, also
          include a basic syntax and ftplugin (Adam Monsen)

Add syntax highlighting for GoAccess configuration file.

GoAccess is a real-time web log analyzer and interactive viewer that
runs in a terminal in *nix systems or through your browser.

GoAccess home page: https://goaccess.io

closes: vim/vim#15414

0aa65b48fb

Co-authored-by: Adam Monsen <haircut@gmail.com>
2024-08-03 00:16:22 +02:00
zeertzjq
582bf4f1e1 vim-patch:9.0.0634: evaluating "expr" options has more overhead than needed
Problem:    Evaluating "expr" options has more overhead than needed.
Solution:   Use call_simple_func() for 'foldtext', 'includeexpr', 'printexpr',
            "expr" of 'spellsuggest', 'diffexpr', 'patchexpr', 'balloonexpr',
            'formatexpr', 'indentexpr' and 'charconvert'.

a4e0b9785e

vim-patch:9.0.0635: build error and compiler warnings

Problem:    Build error and compiler warnings.
Solution:   Add missing change.  Add type casts.

3292a22940

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2024-08-02 11:56:51 +08:00
Mathias Fußenegger
720b309c78
fix(lsp): don't send foreign diagnostics to servers in buf.code_action (#29501)
`buf.code_action` always included diagnostics on a given line from all
clients. Servers should only receive diagnostics they published, and in
the exact same format they sent it.

Should fix https://github.com/neovim/neovim/issues/29500
2024-08-01 16:01:15 +02:00
Manuel
32e128f209
fix(watch): exclude .git when using inotifywait (#29914)
inotifywait man page specifies:
The file must be specified with a relative or absolute path according to whether a relative or absolute path is given for watched directories.

So it would only work this way in case the path is relative (which at least for gopls it is not)
2024-08-01 16:00:48 +02:00
zeertzjq
2b4049719a
vim-patch:partial:f10911e: Update runtime files (#29936)
f10911e5db

Also cherry-pick E1142 and E1156 tags from Vim.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2024-08-01 03:50:38 +00:00
Jaehwang Jung
6bb40f3dbf
fix(lsp): prevent desync due to empty buffer (#29904)
Problem:
Some language servers (e.g., rust-analyzer, texlab) are desynced when
the user deletes the entire contents of the buffer. This is due to the
discrepancy between how nvim computes diff and how nvim treats empty
buffer.
* diff: If the buffer became empty, then the diff includes the last
  line's eol.
* empty buffer: Even if the buffer is empty, nvim regards it as having
  a single empty line with eol.

Solution:
Add special case for diff computation when the buffer becomes empty so
that it does not include the eol of the last line.
2024-07-31 16:18:24 +02:00
glepnir
4e90bc3023
feat(lsp): lsp.completion support set deprecated (#29882)
Problem: CompletionItem in lsp spec mentioned the deprecated attribute

Solution: when item has deprecated attribute set hl_group to DiagnosticDeprecated
          in complete function
2024-07-31 16:15:34 +02:00
zeertzjq
0af056ebce vim-patch:49cdd62: runtime(doc): list of new/changed features in version9.txt
closes: vim/vim#13753

49cdd629a3

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2024-07-30 12:18:44 +08:00
Riley Bruins
94d42a3e72 fix(treesitter): highlight anonymous nodes in inspect_tree
**Problem:** With anonymous nodes toggled in the inspect tree, only
named nodes will be highlighted when moving the cursor in the source
code buffer.

**Solution:** Retrieve the anonymous node at the cursor (when toggled on
in the inspect tree) and highlight them when appropriate, for better
clarity/specificity.
2024-07-29 17:15:46 +02:00