Commit Graph

5576 Commits

Author SHA1 Message Date
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
jdrouhard
385a1facf2
docs: semantic token methods in :h lsp-method #23991 2023-06-11 14:48:57 -07: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
zeertzjq
72de8fdeeb
vim-patch:f1dcd14fc5d4 (#23986)
Update runtime files

f1dcd14fc5

:autocmd-block is N/A (Vim9 script)

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-06-11 20:04:59 +08:00
Sean Dewar
473a216a21
vim-patch:10e8ff9b2607 (#23977)
Update runtime files

10e8ff9b26

Also:
- fix a missing `<` in builtin.txt.
- edit `:function` `{name}` wording to match the change made for the docs above
  by Justin in #10619.
- link to `*vimrc*` rather than `*init.vim*` in repeat.txt change (as `init.lua`
  may also be used).

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-06-11 12:40:22 +01: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
zeertzjq
b6d2f49b45
test: more tests for nvim_{set,del}_keymap with abbreviation (#23970) 2023-06-10 10:44:31 +08: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
bfredl
42bbc4fabc feat(api): support abbreviations in nvim_set_keymap
closes #19198
2023-06-09 21:25:43 +02:00
zeertzjq
106922898a
vim-patch:9.0.1617: charidx() result is not consistent with byteidx() (#23963)
Problem:    charidx() and utf16idx() result is not consistent with byteidx().
Solution:   When the index is equal to the length of the text return the
            lenght of the text instead of -1. (Yegappan Lakshmanan,
            closes vim/vim#12503)

577922b917

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-06-09 17:43:46 +08: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
Gregory Anders
fcfe535e98
refactor(defaults): do not use C specific default values for options (#22500)
The options 'path', 'include', and 'define' all use C-specific default
values. This may have made sense a long time ago when Vim was mostly
used just for writing C, but this is no longer the case, and we have
ample support for filetype specific configuration. Make the default
values of these options empty and move the C-specific values into a
filetype plugin where they belong.

Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2023-06-06 11:26:29 -05: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
Justin M. Keyes
21187e1c73
defaults: shortmess+=C #23907
Problem:
Completion messages such as "scanning tags" are noisy and generally not
useful on most systems. Most users probably aren't aware that this is
configurable.

Solution:
Set `shortmess+=C`.
2023-06-05 02:19:05 -07: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
zeertzjq
700cab0068
fix(events)!: trigger CursorMoved later on switching window (#23711) 2023-06-04 09:09:22 +08: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
4b60267f82
feat(:source): source current ft=lua buffer as Lua code (#23802) 2023-06-02 21:00:55 +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