Commit Graph

1800 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
smjonas
fdf5013e21 fix(filetype): correctly detect bash-fc-{id} files as "sh" 2023-06-23 18:18:33 +02:00
Raphael
4dc86477b6
build(luarc.json): disable luadoc-miss-see-name #24108 2023-06-23 04:54:47 -07:00
Chinmay Dalal
94a904b453
fix(lsp): reapplying already-applied hints #24114
Problem:
The decoration provider clears the whole buffer then redraws all the hints every
time the window was redrawn. This may lead to an infinite loop.

Solution:
Store the last applied version for a line and only clear and redraw the line if
the buffer version has changed.
2023-06-23 04:49:54 -07: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
Mathias Fußenegger
134b9ec483
feat(lsp): soft deprecate vim.lsp.for_each_buffer_client (#24104)
There is no need for two ways to access all clients of a buffer.

This doesn't add a `vim.deprecate` call yet, as the function is probably
used a lot, but removes it from the documentation and annotates it with
`@deprecated`
2023-06-22 13:54:35 +02: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
Mathias Fußenegger
4d3a04279d
perf(lsp): remove grouping logic from lsp.status (#24096)
With the title carry-over logic in the `$/progress` handler it's not
necessary to group again in vim.lsp.status
2023-06-22 10:18:49 +02:00
Julian Grinblat
43e76cc346
fix: tostring(vim.version()) fails if build is NIL #24097
Problem:
Since #23925, Version.build may be vim.NIL, which causes tostring() to fail:
    E5108: Error executing lua E5114: Error while converting print argument #1: …/version.lua:129:
    attempt to concatenate field 'build' (a userdata value)
    stack traceback:
            [C]: in function 'print'
            [string ":lua"]:1: in main chunk

Solution:
Handle vim.NIL in Version:__tostring().
2023-06-22 00:36:38 -07:00
Gregory Anders
08db61b19b
feat(man): respect 'wrapmargin' when wrapping man pages (#24091) 2023-06-21 14:42:23 -05:00
Justin M. Keyes
21b074feb0 refactor(lsp): report full Nvim version string in clientInfo 2023-06-21 12:16:26 +02:00
Akin
e42fdaad21
fix(lsp): add spacing for inlay hints separately #24079
Problem:
Spacing around inlay hints has the same highlight as the hint itself.
The LSP spec for inlay hints specifically mentions the padding should not be
coloured:

    /**
    Render padding before the hint.
    Note: Padding should use the editor's background color, not the
    background color of the hint itself. That means padding can be used
    to visually align/separate an inlay hint.
    */
    paddingLeft?: boolean;
    /**
    Render padding after the hint.
    Note: Padding should use the editor's background color, not the
    background color of the hint itself. That means padding can be used
    to visually align/separate an inlay hint.
    */
    paddingRight?: boolean;

Solution:
Add the space as separate parts of the virtual text, don't add the space to the
text itself.
2023-06-21 00:55:19 -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
Chinmay Dalal
d3e0352574
fix(lsp): check if inlay hints are enabled for a buffer before disabling (#24074)
disabling before enabling throws an error otherwise, because bufstate[bufnr]
doesn't exist
2023-06-20 18:36:31 +02:00
Mathias Fußenegger
64f2691a98
refactor(lsp): extract common execute command functionality (#24065) 2023-06-20 18:36:18 +02:00
Chinmay Dalal
96b94f8d77
fix(lsp): duplicate on_detach, on_reload callbacks #24067
M.enable already clears bufstate[bufnr] and the namespace,
the duplicate callbacks cause an error (indexing bufstate[bufnr] fails)
2023-06-20 02:36:06 -07: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
72a6643b13
docs #24061
- nvim requires rpc responses in reverse order. https://github.com/neovim/neovim/issues/19932
- NVIM_APPNAME: UIs normally should NOT set this.

ref #23520
fix #24050
fix #23660
fix #23353
fix #23337
fix #22213
fix #19161
fix #18088
fix #20693
2023-06-19 08:40:33 -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
Santos Gallegos
8c9dab3e0d
fix(treesitter): use vim.highlight.priorities instead of hardcoded 100 (#24052)
Problem: Treesitter highlighting base priority cannot be customized.

Solution: Use `vim.highlight.priorities.treesitter` instead of hard-coded value.
2023-06-18 16:42:17 +02: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
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
Rohit Sukumaran
bc67bbe446
fix(codelens): add buffer and line checks before displaying codelens (#23887)
Co-authored-by: Rohit Sukumaran <rohit.sukumaran@kredx.com>
2023-06-13 16:17:35 +01:00
Mathias Fußenegger
91f67fabe6
fix(lsp): handle stale bufnr on LspRequest autocmd trigger (#24013)
Fixes a `Invalid buffer id: 123` race when the buffer gets deleted before
the callback triggered.

Alternative to https://github.com/neovim/neovim/pull/23981
2023-06-13 16:53:13 +02:00
zeertzjq
0eb02ea90a
docs: various clarifications (#23999)
Close #18907
Close #20314
Close #23749
2023-06-12 20:08:08 +08:00
Justin M. Keyes
6e1fa16dde
Merge #23954 vim.version() returns Version object 2023-06-11 16:32:37 -07:00
Justin M. Keyes
e688793253 feat: tostring(vim.version())
Problem:
tostring(vim.version()) returns "table: 0x…".

Solution:
Modify vim.version() to return a string prerelease instead of a boolean.

Fix #23863
2023-06-12 01:14:33 +02:00
Stanislav Asunkin
d3b9feccb3
docs: fix vim.tbl_get type annotations #23992 2023-06-11 15:48:13 -07:00
Gianmaria Bajo
ecdb6465e2 feat: vim.version() returns a Version object
- vim.version() returns a Version object.
  Makes it printable and removes the need of workarounds when passing it
  to other vim.version methods.
2023-06-12 00:09:10 +02:00
Stephan Seitz
ceb37ff1d8
refactor(treesitter): use npcall in _query_linter.lua #23985 2023-06-11 14:46:22 -07:00
zeertzjq
bde59e8147
fix(remote): restore previous --remote-expr output formatting (#23988)
- Use tostring() as that's what print() uses internally.
- Do not append trailing new line.
2023-06-11 22:12:32 +08:00
Chinmay Dalal
643546b82b
feat(lsp): add handlers for inlay hints (#23736)
initial support; public API left for a follow-up PR
2023-06-11 11:53:37 +02:00
zeertzjq
cce9460524
fix(remote): make --remote-expr print to stdout (#23980) 2023-06-11 15:29:51 +08:00
Mathias Fußenegger
302d3cfb96
feat(lua): use callable table as iterator in vim.iter (#23957)
A table passed to `vim.iter` can be a class instance with a `__call`
implementation for the iterator protocol.
2023-06-10 20:33:23 +02:00
Raphael
b302da9ad2
fix(lsp): use percentage format on lsp.status (#23971) 2023-06-10 20:32:41 +02:00
Jonas Strittmatter
7154f0c986
docs: fix typos (#23917) 2023-06-10 09:37:05 +08:00
Christian Clason
5959b3c922
vim-patch:9.0.1622: filetype name t32 is a bit obscure (#23967)
Problem:    Filetype name t32 is a bit obscure.
Solution:   Rename t32 to trace32. (Christoph Sax, closes vim/vim#12512)

740df76c90

Co-authored-by: Christoph Sax <christoph.sax@mailbox.org>
2023-06-09 23:48:31 +02:00
Mathias Fußenegger
e5e0bda41b
feat(lsp)!: add vim.lsp.status, client.progress and promote LspProgressUpdate (#23958)
`client.messages` could grow unbounded because the default handler only
added new messages, never removing them.

A user either had to consume the messages by calling
`vim.lsp.util.get_progress_messages` or by manually removing them from
`client.messages.progress`. If they didn't do that, using LSP
effectively leaked memory.

To fix this, this deprecates the `messages` property and instead adds a
`progress` ring buffer that only keeps at most 50 messages. In addition
it deprecates `vim.lsp.util.get_progress_messages` in favour of a new
`vim.lsp.status()` and also promotes the `LspProgressUpdate` user
autocmd to a regular autocmd to allow users to pattern match on the
progress kind.

Also closes https://github.com/neovim/neovim/pull/20327
2023-06-09 11:32:43 +02:00
Christian Clason
f31dba93f9
vim-patch:9.0.1620: Nix files are not recognized from the hashbang line (#23961)
Problem:    Nix files are not recognized from the hashbang line.
Solution:   Add a hashbang check. (issue vim/vim#12507)

19548c6a74

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-06-09 08:59:28 +02:00
Christian Clason
be539f5fa8
vim-patch:9.0.1618: Trace32 files are not recognized (#23960)
Problem:    Trace32 files are not recognized.
Solution:   Add patterns for the t32 filetype. (Christoph Sax, closes vim/vim#12505)

7fbcee6f92

Co-authored-by: Christoph Sax <christoph.sax@mailbox.org>
2023-06-08 21:53:16 +02:00
Mathias Fußenegger
7c661207cc
feat(lua): add ringbuffer (#22894)
https://en.wikipedia.org/wiki/Circular_buffer
2023-06-08 12:11:24 +02:00
Christian Clason
0329f5c2f4
vim-patch:9.0.1615: URL shortcut files are not recognized (#23950)
Problem:    URL shortcut files are not recognized.
Solution:   Add a pattern for URL shortcut files. (closes vim/vim#12474)

cdb7b4c508

Co-authored-by: ObserverOfTime <chronobserver@disroot.org>
2023-06-07 20:53:02 +02:00
Lewis Russell
c0952e62fd
feat(lua): add vim.system()
feat(lua): add vim.system()

Problem:

  Handling system commands in Lua is tedious and error-prone:
  - vim.fn.jobstart() is vimscript and comes with all limitations attached to typval.
  - vim.loop.spawn is too low level

Solution:

  Add vim.system().
  Partly inspired by Python's subprocess module
  Does not expose any libuv objects.
2023-06-07 13:52:23 +01:00
Lewis Russell
4ecc71f6fc
fix(lsp): reduce diagnostics and add more types (#23948) 2023-06-07 13:39:41 +01:00
max397574
5f4895200a
feat(scripts): add lsp_types.lua (#23750) 2023-06-07 12:32:39 +01:00
Alexandre Teoi
4382d2ed56
feat(health): fold successful healthchecks #22866
Problem:
checkhealth can be noisy, but we don't want to omit info.

Solution:
Fold OK results by default, if 'foldenable' is enabled.
Resolves #22796
2023-06-06 08:42:26 -07:00
Justin M. Keyes
c48b1421af
refactor!: rename "playground" => "dev" #23919
Problem:
"playground" is new jargon that overlaps with existing concepts:
"dev" (`:help dev`) and "view" (also "scratch" `:help scratch-buffer`) .

Solution:
We should consistently use "dev" as the namespace for where "developer
tools" live. For purposes of a "throwaway sandbox object", we can use
the name "view".
- Rename `TSPlayground` => `TSView`
- Rename `playground.lua` => `dev.lua`
2023-06-06 08:23:20 -07:00
Gianmaria Bajo
ca887b80a9
fix: version-range < and <= #23539
vim.version.range() couldn't parse them correctly.
For example, vim.version.range('<0.9.0'):has('0.9.0') returned `true`.

fix: range:has() accepts vim.version()
So that it's possible to compare a range with:

    vim.version.range(spec):has(vim.version())
2023-06-06 06:38:45 -07:00
Gregory Anders
cbbda3bcd7
fix(editorconfig): check that buffer is valid (#23922)
Fixes: https://github.com/neovim/neovim/issues/23921
2023-06-05 11:53:13 -05:00
Gregory Anders
ca26ec3438
fix(lsp): use only utf-16 in default client positionEncodings (#23903)
The Nvim client does not yet support multiple offset encodings for
clients in the same buffer. Until it does, stick to utf-16 by default.
2023-06-05 08:21:23 -05:00
Jon Huhn
416fe8d185
refactor(lsp): use LPeg for watchfiles matching (#23788) 2023-06-05 07:19:31 +02:00
Raphael
3c6d971e54
fix(lsp): set extra info only when it has a value (#23868) 2023-06-05 07:17:38 +02:00
Folke Lemaitre
5282d3299c
fix(lsp): restore marks after apply_text_edits() #14630
PROBLEM:
Whenever any text edits are applied to the buffer, the `marks` part of those
lines will be lost. This is mostly problematic for code formatters that format
the whole buffer like `prettier`, `luafmt`, ...

When doing atomic changes inside a vim doc, vim keeps track of those changes and
can update the positions of marks accordingly, but in this case we have a whole
doc that changed. There's no simple way to update the positions of all marks
from the previous document state to the new document state.

SOLUTION:
* save marks right before `nvim_buf_set_lines` is called inside `apply_text_edits`
* check if any marks were lost after doing `nvim_buf_set_lines`
* restore those marks to the previous positions

TEST CASE:
* have a formatter enabled
* open any file
* create a couple of marks
* indent the whole file to the right
* save the file
Before this change: all marks will be removed.
After this change: they will be preserved.

Fixes #14307
2023-06-04 16:45:01 -07:00
Artyom Andreev
96e19533f6
feat(lsp): set kind in select call for codelens #23889 2023-06-03 18:03:25 -07:00
Christian Clason
0a439e3863
vim-patch:9.0.1601: filetype detection fails for *.conf file without comments (#23896)
Problem:    Filetype detection fails for *.conf file without comments.
            (Dmitrii Tcyganok)
Solution:   Use "conf" filetype as a fallback for an empty .conf file.
            (closes vim/vim#12487, closes vim/vim#12483)

664fd12aa2

Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2023-06-04 00:39:46 +02:00
Lewis Russell
40db569014
perf(iter): make ListIter.totable more efficient (#23714) 2023-06-03 12:06:10 +02:00
Lewis Russell
2db719f6c2
feat(lua): rename vim.loop -> vim.uv (#22846) 2023-06-03 12:06:00 +02:00
Sebastian Lyng Johansen
c65e2203f7
docs(iter): add emmylua type to iter module (#23845) 2023-06-03 09:18:05 +02:00
dundargoc
aa130d0c7e
docs: small fixes (#23619)
Co-authored-by: Evgeni Chasnovski <evgeni.chasnovski@gmail.com>
Co-authored-by: Gustavo Ferreira <gustavo.ferreira@imaginecurve.com>
Co-authored-by: Kai Moschcau <mail@kmoschcau.de>
Co-authored-by: Lampros <hauahx@gmail.com>
2023-06-02 22:59:58 +08:00
zeertzjq
843c1bed95
fix(health): stop job properly on timeout (#23877) 2023-06-02 17:23:45 +08:00
Gregory Anders
15641f38cf feat(lsp): include positionEncodings in default client capabilities 2023-06-01 11:46:37 -05:00
Gregory Anders
fb54e6980e feat(lsp): set client offset_encoding if server supports positionEncoding
If the server sends the positionEncoding capability in its
initialization response, automatically set the client's offset_encoding
to use the value provided.
2023-06-01 11:34:23 -05:00
Raphael
be5e361154
fix(lsp): add param assert in client_is_stopped (#23857) 2023-06-01 08:38:38 +02:00
jdrouhard
58618d208a
feat(lsp)!: promote LspRequest to a full autocmd and enrich with additional data (#23694)
BREAKING CHANGE: LspRequest is no longer a User autocmd but is now a
first class citizen.

LspRequest as a User autocmd had limited functionality. Namely, the only
thing you could do was use the notification to do a lookup on all the
clients' requests tables to figure out what changed.

Promoting the autocmd to a full autocmd lets us set the buffer the
request was initiated on (so people can set buffer-local autocmds for
listening to these events).

Additionally, when used from Lua, we can pass additional metadata about
the request along with the notification, including the client ID, the
request ID, and the actual request object stored on the client's
requests table. Users can now listen for these events and act on them
proactively instead of polling all of the requests tables and looking
for changes.
2023-05-30 20:56:29 +02:00
Folke Lemaitre
dd3fa64573
fix(lsp): fix dynamic registration of code actions (#23826) 2023-05-30 19:15:07 +02:00
Omar El Halabi
e8776074f5
vim-patch:9.0.1591: some "gomod" files are not recognized (#23820)
Problem:    Some "gomod" files are not recognized.
Solution:   Check for "go.mod" file name before checking out the contents.
            (Omar El Halabi, closes vim/vim#12462)

c9fbd2560f
2023-05-30 06:44:23 +08:00
Christian Clason
b8a2220f5e
vim-patch:9.0.1587: Corn config files are not recognized (#23807)
Problem:    Corn config files are not recognized.
Solution:   Add a pattern for Corn config files. (Jake Stanger, closes vim/vim#12449)

05843e8960

Co-authored-by: Jake Stanger <mail@jstanger.dev>
2023-05-29 10:25:05 +02:00
Christian Clason
8e17054a23
vim-patch:9.0.1584: not all meson files are recognized (#23797)
Problem:    Not all meson files are recognized.
Solution:   Add "meson.options". (Liam Beguin, closes vim/vim#12444)

1ba0b9e36f

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-05-28 11:47:07 +02:00
Folke Lemaitre
ddd92a70d2
feat(lsp): initial support for dynamic capabilities (#23681)
- `client.dynamic_capabilities` is an object that tracks client register/unregister
- `client.supports_method` will additionally check if a dynamic capability supports the method, taking document filters into account. But only if the client enabled `dynamicRegistration` for the capability
- updated the default client capabilities to include dynamicRegistration for:
    - formatting
    - rangeFormatting
    - hover
    - codeAction
    - hover
    - rename
2023-05-28 07:51:28 +02:00
Matthieu Coudron
44d4ae448d
fix: function was renamed (#23772) 2023-05-26 21:51:18 +02:00
Lewis Russell
1fe1bb084d refactor(options): deprecate nvim[_buf|_win]_[gs]et_option
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Co-authored-by: famiu <famiuhaque@protonmail.com>
2023-05-21 15:14:01 +06:00
Christian Clason
e3e6fadfd8
feat(fs): expose join_paths as vim.fs.joinpath (#23685)
This is a small function but used a lot in some plugins.
2023-05-20 17:30:48 +02:00
Jon Huhn
073035a030
fix(lsp): don't register didChangeWatchedFiles when capability not set (#23689)
Some LSP servers (tailwindcss, rome) are known to request registration
for `workspace/didChangeWatchedFiles` even when the corresponding client
capability does not advertise support. This change adds an extra check
in the `client/registerCapability` handler not to start a watch unless
the client capability is set appropriately.
2023-05-20 07:45:39 +02:00
Christian Clason
201f366b37
vim-patch:9.0.1565: json lines files are not recognized (#23677)
Problem:    Json lines files are not recognized.
Solution:   Add a pattern to detect "jsonl" files. (issue vim/vim#7520)

6fadbc1e8c

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-05-19 09:11:22 +02:00
Lewis Russell
ef64e225f6
fix(treesitter): allow foldexpr without highlights (#23672)
Ref nvim-treesitter/nvim-treesitter#4748
2023-05-18 10:52:01 +01:00
Lewis Russell
189fb62032
feat(treesitter): improved logging (#23638)
- Add bindings to Treesitter ts_parser_set_logger and ts_parser_logger
- Add logfile with path STDPATH('log')/treesitter.c
- Rework existing LanguageTree loggin to use logfile
- Begin implementing log levels for vim.g.__ts_debug
2023-05-17 11:42:18 +01:00
Lewis Russell
6b19170d44
fix(treesitter): correctly calculate bytes for text sources (#23655)
Fixes #20419
2023-05-16 16:41:47 +01:00
Christian Clason
9ff59517cb fix(treesitter): update c queries 2023-05-15 14:13:42 +02:00
dundargoc
08991b0782
docs: small fixes
Co-authored-by: Christian Clason <c.clason@uni-graz.at>
Co-authored-by: Gregory Anders <greg@gpanders.com>
Co-authored-by: HiPhish <hiphish@posteo.de>
Co-authored-by: Julio B <julio.bacel@gmail.com>
Co-authored-by: T727 <74924917+T-727@users.noreply.github.com>
Co-authored-by: camoz <camoz@users.noreply.github.com>
Co-authored-by: champignoom <66909116+champignoom@users.noreply.github.com>
2023-05-13 21:33:22 +02:00
Christian Clason
6f29c68928
vim-patch:9.0.1549: USD filetype is not recognized (#23608)
Problem:    USD filetype is not recognized.
Solution:   Add patterns for USD filetype. (Colin Kennedy, closes vim/vim#12370)

b848ce6b7e

Co-authored-by: Colin Kennedy <colinvfx@gmail.com>
2023-05-13 15:00:08 +02:00
Christian Clason
32dc484ec9
fix(treesitter): support subfiletypes in get_lang (#23605) 2023-05-13 13:29:11 +02:00
Raphael
512a90520e
refactor(lsp): mark server_ready function as deprecated (#23520) 2023-05-13 11:27:05 +02:00
Lewis Russell
af040c3a07
feat(treesitter): add support for setting query depths 2023-05-11 11:13:32 +01:00
Gaétan Lepage
e90b506903
vim-patch:9.0.1539: typst filetype is not recognized (#23578)
Problem:    Typst filetype is not recognized.
Solution:   Distinguish between sql and typst. (Gaetan Lepage, closes vim/vim#12363)

4ce1bda869
2023-05-11 15:43:02 +08:00
hituzi no sippo
4e5061dba7
docs(lsp): fix config.cmd argument for vim.lsp.start_client (#23560) 2023-05-09 21:00:29 +02:00
Jon Huhn
075a72d5ff
fix(lsp): fix relative patterns for workspace/didChangeWatchedFiles (#23548) 2023-05-09 18:12:54 +02:00
hituzi no sippo
02f92978fe
docs(lsp): fix type of config.cmd argument for vim.lsp.start_client (#23550) 2023-05-09 17:24:49 +02:00
Vadim A. Misbakh-Soloviov
209ed16f57
fix(man.lua): return support of all sections
Current behaviour of `:Man` is to only work with "number" sections.
This is caused by wrong assumptions about man sections naming.

Also, there was similar assumption about length of section dirs
in `paths` variable.

fixes #23485

Signed-off-by: Vadim Misbakh-Soloviov <git@mva.name>
2023-05-07 17:31:33 +07:00
marcoSven
9248dd77ac
feat(lua): add hl priority opts on yank (#23509)
feat(lua): add hl priority opts on_yank

Signed-off-by: marcoSven <me@marcosven.com>
2023-05-06 21:53:36 +02:00
jdrouhard
648f777931
perf(lsp): load buffer contents once when processing semantic tokens responses (#23484)
perf(lsp): load buffer contents once when processing semantic token responses

Using _get_line_byte_from_position() for each token's boundaries was a
pretty huge bottleneck, since that function would load individual buffer
lines via nvim_buf_get_lines() (plus a lot of extra overhead). So each
token caused two calls to nvim_buf_get_lines() (once for the start
position, and once for the end position).

For semantic tokens, we only attach to buffers that have already been
loaded, so we can safely just get all the lines for the entire buffer at
once, and lift the rest of the _get_line_byte_from_position()
implementation directly while bypassing the part that loads the buffer
line.

While I was looking at get_lines (used by _get_line_byte_from_position),
I noticed that we were checking for non-file URIs before we even looked
to see if we already had the buffer loaded. Moving the buffer-loaded
check to be the first thing done in get_lines() more than halved the
average time spent transforming the token list into highlight ranges vs
when it was still using _get_line_byte_from_position. I ended up
improving that loop more by not using get_lines, but figured the
performance improvement it provided was worth leaving in.
2023-05-05 07:41:36 +02:00
Bogdan Grigoruță
143a178332
fix(editorconfig): add missing root validation (#23462) 2023-05-03 12:26:40 -06:00
Lewis Russell
3ba930844c
perf(treesitter): insert/remove items efficiently (#23443) 2023-05-02 22:27:14 +01:00
Lewis Russell
fba18a3b62
fix(treesitter): do not calc folds on unloaded buffers
Fixes #23423
2023-05-02 10:07:18 +01:00
Lewis Russell
26cc946226
fix(treesitter): foldexpr tweaks
Some small general fixes found working on developing async parsing.
2023-05-01 10:32:29 +01:00
Christian Clason
37dd818722
vim-patch:9.0.1503: Luau files are not recognized (#23412)
Problem:    Luau files are not recognized.
Solution:   Add a patter for Luau files. (Amaan Qureshi, closes vim/vim#12317)

2dcfe9ae1d

Co-authored-by: Amaan Qureshi <amaanq12@gmail.com>
2023-05-01 10:55:51 +02:00
jdrouhard
edf05b005f
perf(lsp): process semantic tokens response in a coroutine that yields every 5ms (#23375) 2023-05-01 07:15:32 +02:00
Lewis Russell
19a793545f
fix(treesitter): redraw added/removed injections properly (#23287)
When injections are added or removed make sure to:
- invoke 'changedtree' callbacks for when new trees are added.
- invoke 'changedtree' callbacks for when trees are invalidated
- redraw regions when languagetree children are removed
2023-04-30 17:11:38 +02:00
Christian Clason
668f16bac7
feat(treesitter): upstream query omnifunc from playground (#23394)
and set by default in `ftplugin/query.lua`
2023-04-30 11:01:54 +02:00
Gregory Anders
2d54f5e903
Merge pull request #23382 from gpanders/iter-benchmark
Add vim.iter benchmark to benchmark test suite
2023-04-29 20:33:27 -06:00
Stephan Seitz
c194acbfc4
feat(treesitter): add query_linter from nvim-treesitter/playground (#22784)
Co-authored-by: clason <clason@users.noreply.github.com>
Co-authored-by: lewis6991 <lewis6991@users.noreply.github.com>
2023-04-29 18:22:26 +02:00
Gregory Anders
ef1801cc7c perf(iter): reduce number of table allocations
Packing and unpacking return values impairs performance considerably.
In an attempt to avoid creating tables as much as possible we can
instead pass return values between functions (which does not require
knowing the number of values a function might return). This makes the
code more complex, but improves benchmark numbers non-trivially.
2023-04-28 15:38:50 -06:00
bfredl
45bcf83869 refactor(build): include lpeg as a library 2023-04-27 11:40:00 +02:00
Gregory Anders
cacc2dc419
Merge pull request #23303 from gpanders/more-vim-iter
Create iter_spec and vim.iter module
2023-04-25 09:17:46 -06:00
ii14
7e70ca0b48
feat(lua): vim.keycode (#22960)
Using nvim_replace_termcodes is too verbose, add vim.keycode for
translating keycodes.

Co-authored-by: ii14 <ii14@users.noreply.github.com>
2023-04-25 16:52:44 +02:00
Gregory Anders
1e73891d69 refactor(iter): move helper functions under vim.iter
vim.iter is now both a function and a module (similar to vim.version).
2023-04-25 08:23:16 -06:00
Christian Clason
f17bb4f411
vim-patch:9.0.1478: filetypes for *.v files not detected properly (#23282)
* vim-patch:9.0.1478: filetypes for *.v files not detected properly

Problem:    Filetypes for *.v files not detected properly.
Solution:   Use the file contents to detect the filetype. (Turiiya,
            closes vim/vim#12281)

80406c2618

Co-authored-by: Turiiya <34311583+tobealive@users.noreply.github.com>
Co-authored-by: Jonas Strittmatter <40792180+smjonas@users.noreply.github.com>
2023-04-23 14:15:52 +02:00
zeertzjq
1cb46abff1
vim-patch:9.0.1475: busted configuration files are not recognized (#23266)
Problem:    Busted configuration files are not recognized.
Solution:   Recognize busted configuration files as Lua. (Craig MacEachern,
            closes vim/vim#12209)

Co-authored-by: C.D. MacEachern <craig.daniel.maceachern@gmail.com>
2023-04-22 23:51:53 +08:00
Jon Huhn
e9b85acfbb
feat(lsp): enable workspace/didChangeWatchedFiles by default (#23190) 2023-04-22 09:37:38 +02:00
Gregory Anders
f68af3c3bc
refactor(iter): use metatable as packed table tag (#23254)
This is a more robust method for tagging a packed table as it completely
eliminates the possibility of mistaking an actual table key as the
packed table tag.
2023-04-21 16:13:39 -06:00
Justin M. Keyes
824766612d refactor(lua): simplify vim.gsplit impl 2023-04-21 13:50:22 +02:00
Justin M. Keyes
622b1ae38a fix(lua): vim.split may trim inner empty items
Problem:
`vim.split('a:::', ':', {trimempty=true})` trims inner empty items.
Regression from 9c49c10470

Solution:
Set `empty_start=false` when first non-empty item is found.
close #23212
2023-04-21 13:50:22 +02:00
William
ab2811746e
fix(treesitter playground): fix the wrong range of a node displayed i… (#23209)
fix(treesitter playground): wrong range of a node displayed in playground

The call parameters order of the function `get_range_str` is flipped for the last two arguments compared to the declaration.
2023-04-20 07:42:49 -06:00
Gregory Anders
0ad5237162
Merge pull request #23198 from gpanders/iter-fix
fix(iter): allow table values in iterator pipelines
2023-04-19 08:23:42 -06:00
Gregory Anders
9489406879 fix(iter): remove special case totable for map-like tables
This was originally meant as a convenience but prevents possible
functionality. For example:

  -- Get the keys of the table with even values
  local t = { a = 1, b = 2, c = 3, d = 4 }
  vim.iter(t):map(function(k, v)
    if v % 2 == 0 then return k end
  end):totable()

The example above would not work, because the map() function returns
only a single value, and cannot be converted back into a table (there
are many such examples like this).

Instead, to convert an iterator into a map-like table, users can use
fold():

  vim.iter(t):fold({}, function(t, k, v)
    t[k] = v
    return t
  end)
2023-04-19 07:52:04 -06:00
Gregory Anders
6b96122453 fix(iter): add tag to packed table
If pack() is called with a single value, it does not create a table; it
simply returns the value it is passed. When unpack is called with a
table argument, it interprets that table as a list of values that were
packed together into a table.

This causes a problem when the single value being packed is _itself_ a
table. pack() will not place it into another table, but unpack() sees
the table argument and tries to unpack it.

To fix this, we add a simple "tag" to packed table values so that
unpack() only attempts to unpack tables that have this tag. Other tables
are left alone. The tag is simply the length of the table.
2023-04-19 07:04:49 -06:00
Christian Clason
cff02e993d
vim-patch:9.0.1467: Jenkinsfiles are not recognized as groovy (#23195)
Problem:    Jenkinsfiles are not recognized as groovy.
Solution:   Add a pattern for Jenkinsfiles. (closes vim/vim#12236)

142ffb024d

Co-authored-by: dundargoc <gocdundar@gmail.com>
2023-04-19 10:19:33 +02:00
Christian Clason
6d9f5b6bf0
vim-patch:9.0.1464: strace filetype detection is expensive (#23175)
Problem:    Strace filetype detection is expensive.
Solution:   Match with a cheap pattern first. (Federico Mengozzi,
            closes vim/vim#12220)

6e5a9f9482

Co-authored-by: Federico Mengozzi <19249682+fedemengo@users.noreply.github.com>
2023-04-19 09:41:26 +02:00
Gregory Anders
ab1edecfb7
feat(lua): add vim.iter (#23029)
vim.iter wraps a table or iterator function into an `Iter` object with
methods such as `filter`, `map`, and `fold` which can be chained to
produce iterator pipelines that do not create new tables at each step.
2023-04-17 12:54:19 -06:00
Jon Huhn
6cc76011ca
fix(watchfiles): skip Created events when poll starts (#23139) 2023-04-17 18:50:05 +02:00
Isak Samsten
07b60efd80
feat(diagnostic): specify diagnostic virtual text prefix as a function
- vim.diagnostic.config() now accepts a function for the virtual_text.prefix
  option, which allows for rendering e.g., diagnostic severities differently.
2023-04-17 12:53:34 +01:00
JingMatrix
7f94a032e1
fix(checkhealth): shell_error and cpanm module
shell_error is a function, the code missed parentheses

The actual module for perl module version is App::cpanminus::script, not
App::cpanminus::fatscript.
2023-04-16 12:39:48 +02:00
dundargoc
b0978fca6b
fix(checkhealth): fix crash due to incorrect argument type 2023-04-16 12:26:13 +02:00
Raphael
2f779b94e7
fix(lua): inspect_pos respect bufnr when get syntax info (#23098) 2023-04-16 17:50:32 +08:00
Christian Clason
d9e9dc3a06
vim-patch:9.0.1455: C++ 20 modules are not recognized (#23124)
Problem:    C++ 20 modules are not recognized.
Solution:   Add patterns to recognize C++ 20 modules as "cpp". (Ben Jackson,
            closes vim/vim#12261)

732d69e191

Co-authored-by: Ben Jackson <puremourning@gmail.com>
2023-04-16 10:59:04 +02:00
dundargoc
c08b030761
refactor: deprecate checkhealth functions
The following functions are deprecated and will be removed in
Nvim v0.11:

- health#report_start()
- health#report_info()
- health#report_ok()
- health#report_warn()
- health#report_error()
- vim.health.report_start()
- vim.health.report_info()
- vim.health.report_ok()
- vim.health.report_warn()
- vim.health.report_error()

Users should instead use these:

- vim.health.start()
- vim.health.info()
- vim.health.ok()
- vim.health.warn()
- vim.health.error()
2023-04-15 23:40:48 +02:00
zeertzjq
8c6f97bef8
fix(health): properly use the value of $PYENV_VERSION (#23109) 2023-04-16 00:16:50 +08:00
NAKAI Tsuyoshi
7caf0eafd8
feat(lua)!: add stricter vim.tbl_islist() and rename old one to vim.tbl_isarray() (#16440)
feat(lua)!: add stricter vim.tbl_islist(), rename vim.tbl_isarray()

Problem: `vim.tbl_islist` allows gaps in tables with integer keys
("arrays").

Solution: Rename `vim.tbl_islist` to `vim.tbl_isarray`, add new
`vim.tbl.islist` that checks for consecutive integer keys that start
from 1.
2023-04-14 12:01:08 +02:00
Christian Clason
4d04feb662
feat(lua): vim.tbl_contains supports general tables and predicates (#23040)
* feat(lua): vim.tbl_contains supports general tables and predicates

Problem: `vim.tbl_contains` only works for list-like tables (integer
keys without gaps) and primitive values (in particular, not for nested
tables).

Solution: Rename `vim.tbl_contains` to `vim.list_contains` and add new
`vim.tbl_contains` that works for general tables and optionally allows
`value` to be a predicate function that is checked for every key.
2023-04-14 10:39:57 +02:00
Gregory Anders
bfb28b62da
refactor: remove modelines from Lua files
Now that we have builtin EditorConfig support and a formatting check in
CI, these are not necessary.
2023-04-13 23:29:13 +02:00
Lewis Russell
66c66d8db8
fix(loader): reset hashes when running the loader 2023-04-13 17:34:47 +01:00
Mathias Fußenegger
37011bc45e
fix(diagnostic): rename buffer → bufnr in type annotation (#23042)
See `:h diagnostic-structure`, the property name is `bufnr`, not
`buffer`.
2023-04-12 15:16:15 +02:00
NAKAI Tsuyoshi
9e86f473e0
feat(lua): vim.region accepts getpos() arg (#22635) 2023-04-11 16:28:46 +02:00
Scott Ming
ccc0980f86
fix(treesitter): Use the correct replacement args for #gsub! directive (#23015)
fix(treesitter): use the correct replacement args for #gsub! directive
2023-04-11 10:26:03 +02:00
zeertzjq
7ffe450173
fix(health): check for _host_prog variables properly (#23014) 2023-04-11 10:20:25 +08:00
zeertzjq
c8d1d8b254
fix(man.lua): don't continue on command error (#23009)
Fix #21169
2023-04-11 09:35:01 +08:00
Gregory Anders
03a021f378
fix(health): combine python and virtualenv healthchecks (#23004)
fix(health): combine python and virtualenv health checks
2023-04-10 15:46:22 -06:00
Gregory Anders
cde4892b49
fix(health): fix typo in function name 2023-04-10 22:37:25 +02:00
dundargoc
bd98ef6ac6
refactor: rewrite perl healthcheck in lua
This is required to remove the vimscript checkhealth functions.
2023-04-10 15:59:50 +02:00
dundargoc
b5c0e7137c
refactor: rewrite node healthcheck in lua
This is required to remove the vimscript checkhealth functions.
2023-04-10 15:26:22 +02:00
dundargoc
7801ffc38a
refactor: rewrite ruby healthcheck in lua
This is required to remove the vimscript checkhealth functions.
2023-04-10 14:06:10 +02:00
dundargoc
5ed7ede1f5
refactor: rewrite virtualenv healthcheck in lua
This is required to remove the vimscript checkhealth functions.
2023-04-10 11:28:42 +02:00
dundargoc
71225228fc
refactor: rewrite python provider healthcheck in Lua
This is required to remove the vimscript checkhealth functions.
2023-04-09 22:28:00 +02:00
dundargoc
41b7586cbb
refactor: rewrite clipboard provider healthchecks in Lua
This is required to remove the vimscript checkhealth functions.
2023-04-09 20:46:53 +02:00
Gregory Anders
d675bd01b1
feat(lua): allow vim.F.if_nil to take multiple arguments (#22903)
The first argument which is non-nil is returned. This is useful when
using nested default values (e.g. in the EditorConfig plugin).

Before:

  local enable = vim.F.if_nil(vim.b.editorconfig, vim.F.if_nil(vim.g.editorconfig, true))

After:

  local enable = vim.F.if_nil(vim.b.editorconfig, vim.g.editorconfig, true)
2023-04-07 08:22:47 -06:00
Lewis Russell
e29bc03c04
fix(treesitter): do not track ranges of the root tree (#22912)
Fixes #22911
2023-04-06 15:16:44 +01:00
Lewis Russell
34ac75b329
refactor: rename local API alias from a to api
Problem:
  Codebase inconsistently binds vim.api onto a or api.

Solution:
  Use api everywhere. a as an identifier is too short to have at the
  module level.
2023-04-05 17:19:53 +01:00
Michal Liszcz
999cb36c2b
refactor(lsp): do not parse verbose output when overwriting options (#22810) 2023-04-05 14:02:08 +02:00
dundargoc
e826d09c18
fix(windows): consistent normalization in fs.find
vim.fs.find(".luacheckrc")

```
c:\\projects\\neovim/.luacheckrc # before

c:/projects/neovim/.luacheckrc   # after
```

Co-authored-by: kylo252 <59826753+kylo252@users.noreply.github.com>
2023-04-04 23:37:46 +02:00
dundargoc
743860de40
test: replace lfs with luv and vim.fs
test: replace lfs with luv

luv already pretty much does everything lfs does, so this duplication
of dependencies isn't needed.
2023-04-04 21:59:06 +02:00
Lewis Russell
b1de4820b7 refactor(treesitter): move inspect_tree impl 2023-04-04 20:47:15 +01:00
dundargoc
a5c572bd44
docs: fix typos
Co-authored-by: Gregory Anders <greg@gpanders.com>
Co-authored-by: Raphael <glephunter@gmail.com>
Co-authored-by: C.D. MacEachern <craig.daniel.maceachern@gmail.com>
Co-authored-by: himanoa <matsunoappy@gmail.com>
2023-04-04 19:07:33 +02:00
Lewis Russell
b75acd2f94
fix(treesitter): disable folding in inspect_tree() (#22885) 2023-04-04 14:07:27 +02:00
Lewis Russell
090ade4af6
refactor(treesitter): delegate region calculation to treesitter (#22576) 2023-04-04 13:58:16 +02:00
danilax999
469e6bfc56
fix(treesitter): use capture metadata range if exists
use `treesitter.get_range` instead of inline expression
2023-04-04 12:26:21 +01:00
Christian Clason
e30cc8be19
vim-patch:9.0.1438: .fs files are falsely recognized as forth files (#22871)
Problem:    .fs files are falsely recognized as forth files.
Solution:   Check 100 lines for something that looks like forth. (Johan
            Kotlinski, closes vim/vim#12219, closes vim/vim#11988)

065088d554

Co-authored-by: Johan Kotlinski <kotlinski@gmail.com>
2023-04-03 16:27:49 +02:00
Luuk van Baal
a930245557 refactor(lua): get all marks instead of iterating over namespaces
Inspector now also includes highlights set in anonymous namespaces.

Close #22732
2023-04-02 19:14:23 +02:00
Gregory Anders
643c0ed571
feat: allow function passed to defaulttable to take an argument (#22839)
Pass the value of the key being accessed to the create function, to
allow users to dynamically generate default values.
2023-04-01 08:02:58 -06:00
Sizhe Zhao
6a4ebf894f
fix(health): stop using deprecated ts.language.inspect_language() (#22850) 2023-04-01 15:47:20 +02:00
Christian Clason
d7f7450017 refactor(treesitter)!: rename help parser to vimdoc 2023-04-01 15:07:16 +02:00
Lewis Russell
83bfd94d1d
refactor(loader): cache hash information
Whenever we run fs_stat() on a path, save this information in the loader
so it can be re-used.

- Loader.loadfile: Remove arguments `hash` as it is no longer needed.

- Loader.loader: Use _G.loadstring instead of Loader.load
  This allows plugins to wrap loadstring to inspection and profiling

- factor out read file logic
2023-03-31 13:05:22 +01:00
Akin
ed10e4ef60
fix(diagnostic): use correct field name for tags (#22835)
LSP tags are added to the diagnostic as "tags" but referred to as "_tags"
in the diagnostic underline handler
2023-03-31 11:23:19 +01:00
Lewis Russell
4cff3aceea
fix(loader): disable profiling by default 2023-03-31 09:43:13 +01:00
Lewis Russell
226a6c3eae
feat(diagnostic): add support for tags
The LSP spec supports two tags that can be added to diagnostics:
unnecessary and deprecated. Extend vim.diagnostic to be able to handle
these.
2023-03-30 14:49:58 +01:00
Lewis Russell
8fa7d833cf
Merge pull request #22791 from lewis6991/refactor/loadermisc
refactor(loader): changes
2023-03-30 13:57:59 +01:00
Lewis Russell
61e54f2636
feat: add vim.treesitter.language.get_filetypes() (#22643) 2023-03-30 10:26:28 +01:00
Christian Clason
196f69909d
vim-patch:9.0.1430: Livebook files are not recognized (#22808)
Problem:    Livebook files are not recognized.
Solution:   Add a pattern for Livebook files. (Mathias Jean Johansen,
            closes vim/vim#12203)

6400203517

Co-authored-by: Mathias Jean Johansen <mathias@mjj.io>
2023-03-29 10:23:52 +02:00
Lewis Russell
fd70a9dca1 refactor(loader): simplify tracking logic 2023-03-26 14:11:43 +01:00
Lewis Russell
25fa051fa1 feat(vim.fs): improve normalize
- Add options argument with an option to expand env vars
- Resolve '//' -> '/'
- Use in vim.loader
2023-03-26 13:30:11 +01:00
Lewis Russell
ffd8cd1a96 refactor(loader): add typing for package.loaders 2023-03-26 12:51:56 +01:00
Lewis Russell
fab8dab6b6 refactor(loader): remove BufWritePost autocmd 2023-03-26 12:47:06 +01:00
Lewis Russell
3c82ce0d62 refactor(loader): use vim.fs 2023-03-26 12:46:24 +01:00
Folke Lemaitre
2257ade3dc
feat(lua): add vim.loader
feat: new faster lua loader using byte-compilation
2023-03-26 11:42:15 +01:00
zeertzjq
4863ca6b89
test: use exec_capture() in more places (#22787)
Problem:
Using `meths.exec2("code", { output = true })` is too verbose.

Solution:
Use exec_capture() in more places.
2023-03-26 10:49:32 +08:00
Evgeni Chasnovski
fe9cbcb3a5
feat(api): nvim_exec2(), deprecate nvim_exec() #19032
Problem:
The signature of nvim_exec() is not extensible per ":help api-contract".

Solution:
Introduce nvim_exec2() and deprecate nvim_exec().
2023-03-25 09:58:48 -07:00
Roberto Pommella Alegro
257d894d75
feat(lsp): render markdown in docs hover #22766
Problem:
LSP docs hover (textDocument/hover) doesn't handle HTML escape seqs in markdown.

Solution:
Convert common HTML escape seqs to a nicer form, to display in the float.
closees #22757

Signed-off-by: Kasama <robertoaall@gmail.com>
2023-03-25 12:46:07 -04:00
Micah Halter
36ee10057a
fix(lsp): add missing silent check in lsp hover handler (#22763)
Fixup to #21531.
2023-03-25 21:01:39 +08:00
Jakub Łuczyński
42876ddc7a
docs: more details about vim.region (#21116) 2023-03-25 16:28:59 +08:00
Lewis Russell
ac7397f4a0
fix(treesitter): add missing deprecate 2023-03-24 16:31:30 +00:00
Lewis Russell
cbbf8bd666
feat(treesitter)!: deprecate top level indexes to modules (#22761)
The following top level Treesitter functions have been moved:
  - vim.treesitter.inspect_language() -> vim.treesitter.language.inspect()
  - vim.treesitter.get_query_files() -> vim.treesitter.query.get_files()
  - vim.treesitter.set_query() -> vim.treesitter.query.set()
  - vim.treesitter.query.set_query() -> vim.treesitter.query.set()
  - vim.treesitter.get_query() -> vim.treesitter.query.get()
  - vim.treesitter.query.get_query() -> vim.treesitter.query.get()
  - vim.treesitter.parse_query() -> vim.treesitter.query.parse()
  - vim.treesitter.query.parse_query() -> vim.treesitter.query.parse()
  - vim.treesitter.add_predicate() -> vim.treesitter.query.add_predicate()
  - vim.treesitter.add_directive() -> vim.treesitter.query.add_directive()
  - vim.treesitter.list_predicates() -> vim.treesitter.query.list_predicates()
  - vim.treesitter.list_directives() -> vim.treesitter.query.list_directives()
  - vim.treesitter.query.get_range() -> vim.treesitter.get_range()
  - vim.treesitter.query.get_node_text() -> vim.treesitter.get_node_text()
2023-03-24 14:43:14 +00:00
Christian Clason
ee5008f878
vim-patch:9.0.1425: "wat" and "wast" files are one filetype (#22774)
Problem:    "wat" and "wast" files are one filetype.
Solution:   Add a separate filetype for "wat" files. (Amaan Qureshi,
            closes vim/vim#12165)

3ea62381c5

Co-authored-by: Amaan Qureshi <amaanq12@gmail.com>
2023-03-24 14:06:04 +01:00
Lewis Russell
4e4203f71b
fix(treesitter): annotations
- Begin using `@package` in place of `@private` for functions
that are accessed internally but outside their defined class.

- Rename Node -> TSP.Node
2023-03-23 11:23:51 +00:00
meredith
ea0b66d208
fix(lsp): Jump to tag locations reliably when :ltag is used (#22750) 2023-03-23 08:27:53 +01:00
Justin M. Keyes
410dc3349f
Merge #22736 from justinmk/gsplit
feat(vim.gsplit): gain features of vim.split
2023-03-22 20:12:40 -04:00
Lewis Russell
28cfcf5126
fix(api): vim.filetype.get_option() (#22753)
- Fix a bug in the cache
- Set some buffer options on the dummy buffer
2023-03-22 16:49:04 +00:00
Justin M. Keyes
e51139f5c1 refactor(vim.gsplit): remove "keepsep"
string.gmatch() is superior, use that instead.
2023-03-22 17:46:01 +01:00
Justin M. Keyes
8a70adbde0 fix(vim.version): prerelease compare
Problem:
semver specifies that digit sequences in a prerelease string should be
compared as numbers, not lexically: https://semver.org/#spec-item-11
> Precedence for two pre-release versions with the same major, minor,
> and patch version MUST be determined by comparing each dot separated
> identifier from left to right until a difference is found as follows:
> 1. Identifiers consisting of only digits are compared numerically.
> 2. Identifiers with letters or hyphens are compared lexically in ASCII sort order.
> 3. Numeric identifiers always have lower precedence than non-numeric identifiers.
> 4. A larger set of pre-release fields has a higher precedence than a smaller set, if all of the preceding identifiers are equal.
Example:
1.0.0-alpha < 1.0.0-alpha.1 < 1.0.0-alpha.beta < 1.0.0-beta < 1.0.0-beta.2 < 1.0.0-beta.11 < 1.0.0-rc.1 < 1.0.0.

Solution:
cmp_prerel() treats all digit sequences in a prerelease string as
numbers. This doesn't _exactly_ match the spec, which specifies that
only dot-delimited digit sequences should be treated as numbers...
2023-03-22 17:46:01 +01:00
Justin M. Keyes
9c49c10470 feat(vim.gsplit): gain features of vim.split
Problem:
- vim.split has more features than vim.gsplit.
- Cannot inspect the "separator" segments of vim.split or vim.gsplit.

Solution:
- Move common implementation from vim.split into vim.gsplit.
  - TODO: deprecate vim.split in favor of vim.totable(vim.gsplit())?
- Introduce `keepsep` parameter.

Related: 84f66909e4
2023-03-22 17:46:01 +01:00
Amaan Qureshi
48ce2ef912
vim-patch:9.0.{1419,1421,1422,1423}: some files are not recognized (#22749)
vim-patch:9.0.1419: Lean files are not recognized

Problem:    Lean files are not recognized.
Solution:   Add a pattern for Lean files. (Amaan Qureshi, closes vim/vim#12177)

4a5c39fc52

vim-patch:9.0.1421: Nu files are not recognized

Problem:    Nu files are not recognized.
Solution:   Add a pattern for Nu files. (Amaan Qureshi, closes vim/vim#12172)

8aa2a37f89

vim-patch:9.0.1422: Sage files are not recognized

Problem:    Sage files are not recognized.
Solution:   Add a pattern for Sage files. (Amaan Qureshi, closes vim/vim#12176)

d0639d717b

vim-patch:9.0.1423: WebAssembly Interface Type files are not recognized

Problem:    WebAssembly Interface Type files are not recognized.
Solution:   Add a pattern for WIT files. (Amaan Qureshi, closes vim/vim#12173)

890c772036
2023-03-22 16:19:56 +08:00