Commit Graph

26577 Commits

Author SHA1 Message Date
Christian Clason
164370a4cb vim-patch:c2bd205254c8
Change "the" to "then" under ':help bufload()' (vim/vim#12662)

c2bd205254

N/A commits:
vim-patch:64dea84bb05a (we have our own manpager at home)
vim-patch:958e15bb1c7d (we have our own editorconfig syntax file)
vim-patch:c41b3c9f95ac (we don't have defaults.vim)

Co-authored-by: Daniel Steinberg <dstein64@users.noreply.github.com>
2023-08-09 20:43:45 +02:00
Christian Clason
c43c745a14
fix(lua): improve annotations for stricter luals diagnostics (#24609)
Problem: luals returns stricter diagnostics with bundled luarc.json
Solution: Improve some function and type annotations:

* use recognized uv.* types 
* disable diagnostic for global `vim` in shared.lua
* docs: don't start comment lines with taglink (otherwise LuaLS will interpret it as a type)
* add type alias for lpeg pattern
* fix return annotation for `vim.secure.trust`
* rename local Range object in vim.version (shadows `Range` in vim.treesitter)
* fix some "missing fields" warnings
* add missing required fields for test functions in eval.lua
* rename lsp meta files for consistency
2023-08-09 11:06:13 +02:00
zeertzjq
8afdc1f386
ci(labeler): run "type-scope" after "triage"
Problem:    When "triage" job is run after "type-scope" job, it may
            remove labels added by the "type-scope" job.
Solution:   Run "type-scope" job after "triage" job.
2023-08-09 09:27:51 +08:00
zeertzjq
fdb11888f5
vim-patch:9.0.1679: Cleanup Tests from leftover files (#24617)
Problem:    Tests may leave leftover files around
Solution:   Clean up tests and remove files

There were a few failures in 'linux (huge, gcc, testgui, true, true)'
e.g. here: https://github.com/vim/vim/actions/runs/5497376153/jobs/10018060156

,----
| Error detected while processing command line..script /home/runner/work/vim/vim/src/testdir/runtest.vim[585]..function RunTheTest[54]..Test_lvimgrep_crash[16]..TestTimeout[12]..VimLeavePre Autocommands for "*"..function EarlyExit[7]..FinishTesting:
| line   70:
| E445: Other window contains changes
| E937: Attempt to delete a buffer that is in use: Xtest_stable_xxd.txt
| E937: Attempt to delete a buffer that is in use: Xtest_stable_xxd.txt
| E937: Attempt to delete a buffer that is in use: Xtest_stable_xxd.txtmalloc(): unsorted double linked list corrupted
`----

Which is puzzling, because the Xtest_stable_xxd file should have been
long gone after test_crypt.vim is run (and definitely no longer be
staying around in test_quickfix.vim).

So try to clean up properly after a test script is run, just in case any
X<file> is still around. During testing, a found a few leftover files,
which I also fixed in the relevant test-file.

Unfortunately, the test workflow 'linux (huge, gcc, testgui, true,
true)' now seems to fail with 'E1230: Encryption: sodium_mlock()' in
test_crypt.vim. Hopefully this is only temporary.

84bc00e9b5

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-08-09 06:07:23 +08:00
Sean Dewar
4134cebb17
docs(builtin): fix some missing lines (#24615)
These two functions seem to have previously had their docs start on the same
line as the signature, which I guess contributed to the lines being lost (though
I checked all other such functions from before again and these were the only
two).
2023-08-08 21:25:22 +01:00
Lewis Russell
c6c21db82b
fix(filetype): add typing and dry (#24573) 2023-08-08 16:36:06 +01:00
Computer2340
61ed45486d
docs: Bram farewell #24589
ref #24579
2023-08-08 06:41:55 -07:00
Christian Clason
2e824e89c1
build(deps): bump tree-sitter to HEAD - 0a1c4d846 (#24607)
adapt to breaking change in `ts_query_cursor_set_max_start_depth`
https://github.com/tree-sitter/tree-sitter/pull/2278
2023-08-08 14:57:06 +02:00
Lewis Russell
37c58226a8
fix(lua): vim.fs typing (#24608) 2023-08-08 11:58:29 +01:00
bfredl
11ad8fa4cd
Merge pull request #24606 from bfredl/keysetnil
docs(lua): the keyset nilocalypse
2023-08-08 11:51:38 +02:00
bfredl
628763fbd8 docs(lua): the keyset nilocalypse
This is needed to give recent LuaLS the right idea about optional fields.
2023-08-08 10:42:59 +02:00
Lewis Russell
0211f889b9
fix(treesitter): make sure injections don't return empty ranges (#24595)
When an injection has not set include children, make sure not to add
the injection if no ranges are determined.

This could happen when there is an injection with a child that has the
same range as itself. e.g. consider this Makefile snippet

```make
foo:
  $(VAR)
```

Line 2 has an injection for bash and a make variable reference. If
include-children isn't set (default), then there is no range on line 2
to inject since the variable reference needs to be excluded.

This caused the language tree to return an empty range, which the parser
now interprets to mean the full buffer. This caused makefiles to have
completely broken highlighting.
2023-08-07 18:22:36 +01:00
ObserverOfTime
ce792db5b8
vim-patch:9.0.1678: blade files are not recognized (#24601)
Problem:    Blade files are not recognized.
Solution:   Add a pattern for Blade files. (closes vim/vim#12650)

ad34abee25

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-08-07 18:44:52 +02:00
Lewis Russell
c0beb8173f
feat: add .luarc.json (#24592) 2023-08-07 16:27:53 +01:00
Maria José Solano
832459219b
docs(lsp): fix references to protocol.constants #24578 2023-08-07 06:35:06 -07:00
ObserverOfTime
369f58797d
fix(treesitter): escape quotes in :InspectTree view #24582
Problem: Anonymous nodes containing double quotes break the highlighting.
Solution: Escape double quotes in anonymous nodes.
2023-08-07 06:16:12 -07:00
bfredl
3a21c3afe6
Merge pull request #24524 from bfredl/typed_keys
refactor(api): use typed keysets
2023-08-07 14:42:25 +02:00
bfredl
51c754b62e feat(lua): use keyset type information 2023-08-07 13:18:12 +02:00
bfredl
0b351c3740 test(api): update tests to new error messages 2023-08-07 13:18:11 +02:00
bfredl
6c0812d92e feat(lua): specific error messages for type checking opts params 2023-08-07 13:18:11 +02:00
bfredl
7bc93e0e2f refactor(api): use typed keysets
Initially this is just for geting rid of boilerplate,
but eventually the types could get exposed as metadata
2023-08-07 13:11:15 +02:00
zeertzjq
ef44e59729
fix(inccommand): don't set an invalid 'undolevels' value (#24575)
Problem:    Cannot break undo by setting 'undolevels' to itself in
            'inccommand' preview callback.
Solution:   Don't set an invalid 'undolevels' value.

Co-authored-by: Michael Henry <drmikehenry@drmikehenry.com>
2023-08-05 22:42:34 +08:00
Raphael
42630923fc
refactor(lsp): use protocol.Methods instead of strings #24570 2023-08-05 02:03:57 -07:00
zeertzjq
1f252a8ac0
docs(options): fix mistakes (#24568) 2023-08-05 07:55:45 +08:00
Lewis Russell
6fa17da39b
docs(options): take ownership of options.txt (#24528)
* docs(options): take ownership of options.txt

- `src/nvim/options.lua` is now the source of truth
- generate runtime/lua/vim/_meta/options.lua

* fixup! zeer comments

* fixup! zeer comments (2)

* fixup! re-enable luacheck

* fixup! regen
2023-08-04 21:26:53 +01:00
bfredl
c01e624b07 feat(lua): more specific error messages for vim.api type checking 2023-08-04 08:45:19 +02:00
Sean Dewar
cc87dda31a
fix(lsp): do not assume client capability exists in watchfiles check (#24550)
PR #23689 assumes `client.config.capabilities.workspace.didChangeWatchedFiles`
exists when checking `dynamicRegistration`, but thats's true only if it was
passed to `vim.lsp.start{_client}`.

This caused #23806 (still an issue in v0.9.1; needs manual backport), but #23681
fixed it by defaulting `config.capabilities` to `make_client_capabilities` if
not passed to `vim.lsp.start{_client}`.

However, the bug resurfaces on HEAD if you provide a non-nil `capabilities` to
`vim.lsp.start{_client}` with missing fields (e.g: not made via
`make_client_capabilities`).

From what I see, the spec says such missing fields should be interpreted as an
absence of the capability (including those indicated by missing sub-fields):
https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#clientCapabilities

Also, suggest `vim.empty_dict()` for an empty dict in
`:h vim.lsp.start_client()` (`{[vim.type_idx]=vim.types.dictionary}`
no longer works anyway, probably since the cjson switch).
2023-08-04 08:10:54 +02:00
zeertzjq
3d3ec27d51
test(options/defaults_spec): fix NVIM_APPNAME test flakiness (#24553)
Also avoid leaving directories behind.
2023-08-04 10:37:47 +08:00
zeertzjq
21d466c1b9
fix(terminal): forward horizontal mouse scrolling (#24552) 2023-08-04 10:24:27 +08:00
zeertzjq
0a7fda6fa0
fix(terminal): include modifiers when forwarding mouse (#24549) 2023-08-04 09:34:13 +08:00
zeertzjq
c4f775fa57
build(deps): bump libvterm to 0.3.3 (#24547)
Fix #21106
2023-08-04 07:08:43 +08:00
Justin M. Keyes
b034378cf5
docs: luaref cleanup #24541
- drop "luaref-" prefix in favor of "lua-" or nothing, where possible.
- remove redundant "luaref--lang…" and "luaref-api…" tags.
2023-08-03 08:35:10 -07:00
Justin M. Keyes
4d859d00d1
Merge #24351 docs 2023-08-03 06:14:15 -07:00
Justin M. Keyes
b1fb04475e docs: remove "#" comment char in @return
Everything after a "#" char is a "description" comment, i.e. luals won't
treat it as a type, name, etc. But "#" should not be present in the
generated docs (such as :help docs).
https://github.com/LuaLS/lua-language-server/wiki/Annotations#return
2023-08-03 14:01:53 +02:00
Justin M. Keyes
d2f8133024 docs: misc
Co-authored-by: Kevin Pham <keevan.pham@gmail.com>
2023-08-03 14:01:53 +02:00
Raphael
f1772272b4
refactor(lsp): use protocol.Methods instead of strings #24537 2023-08-03 04:03:48 -07:00
Raphael
214b125132
fix(gen_lsp.lua): no notifications in lsp.Methods #24530
Problem:
- Notifications are missing from `lsp.Methods`.
- Need a way to represent `$/` prefixed methods.

Solution:
- Generate notifications.
- Use "dollar_" prefix for `$/` methods.
2023-08-03 02:52:21 -07:00
Marc Jakobi
4a06de40e7
docs(lua): fix generated fname param annotations #24533 2023-08-02 11:22:44 -07:00
zeertzjq
1ee905a63a
docs(builtin): fix alignment of comments in code blocks (#24529) 2023-08-02 22:14:32 +08:00
Justin M. Keyes
d086bc1e85
docs: drop "Can also be used as a method" #24508
Now that we "own" builtin.txt, we cant remove the repetitive mention of
Vimscript's UFCS syntax. It's noisy to mention this for each function,
and it's also not a Vimscript feature that should be encouraged.

Also change the builtin.txt heading to "NVIM REFERENCE MANUAL", which
indicates when a help file is Nvim-owned.
2023-08-01 16:17:26 -07:00
Lewis Russell
6425869771
feat(lua): add meta file for vim submodules (#24525) 2023-08-01 18:03:33 +01:00
Tyler Miller
0804034c07
fix(loader): cache path ambiguity #24491
Problem: cache paths are derived by replacing each reserved/filesystem-
path-sensitive char with a `%` char in the original path. With this
method, two different files at two different paths (each containing `%`
chars) can erroneously resolve to the very same cache path in certain
edge-cases.

Solution: derive cache paths by url-encoding the original (path) instead
using `vim.uri_encode()` with `"rfc2396"`. Increment `Loader.VERSION` to
denote this change.
2023-08-01 08:28:28 -07:00
Justin M. Keyes
dfe19d6e00
Merge #24504 feat(lsp): protocol.Methods 2023-08-01 07:36:57 -07:00
Justin M. Keyes
f41496ce74 feat(gen_lsp.lua): sort by name, handle failure #24504 2023-08-01 16:13:22 +02:00
mathew
da09f9b551 feat(gen_lsp.lua): protocol.Methods #24504 2023-08-01 16:05:06 +02:00
Lewis Russell
48d533272e
feat(lua-types): types for vim.api.* (#24523) 2023-08-01 14:20:44 +01:00
Chris AtLee
e55e80d51c
fix(lsp): inlay hints: "Failed to delete autocmd" when closing buffer #24469
Problem:
"Failed to delete autocmd" error when deleting LspNotify autocmd. #24456

Solution:
Change a few things in the inlay_hint and diagnostic LSP code:
1. Re-introduce the `enabled` flag for the buffer state tables. Previously I was
   relying on the presence of an autocmd id in the state table to track whether
   inlay_hint / diagnostic was enabled for a buffer. There are two reasons why
   this doesn't work well:
  - Each time inlay_hint / diagnostic is enabled, we call `nvim_buf_attach` on
    the buffer, resulting in multiple `on_reload` or `on_detach` callbacks being
    registered.
  - Commands like `bwipeout` delete buffer local autocmds, sometimes before our
    `on_detach` callbacks have a chance to delete them first. This causes the
  - Use module local enabled state for diagnostic as well. bwipeout can race
    with on_detach callbacks for deleting autocmds. Error referenced in #24456.
2. Change the `LspDetach` autocmd to run each time (i.e., remove the `once`
   flag). Since we're only registering autocmds once per buffer now, we
   need to make sure that we set the enabled flag properly each time the LSP
   client detaches from the buffer.
  - Remove `once` from the LspDetach autocmds for inlay_hint and diagnostic.
    We only set up the autocmd once now. Gets removed when buffer is deleted.
3. Have the `LspNotify` handler also refresh the inlay_hint / diagnostics when
   receiving the `textDocument/didOpen` event. Before this point, the LSP
   backend doesn't have the contents of the buffer, so can't provide inlay hints
   or diagnostics.

Downsides of this approach:
* When inlay_hint / diagnostics are disabled on a buffer, it will continue to
  receive `LspNotify` events for that buffer. The callback exits early since the
  `enabled` flag is false.

Alternatives:
* Can we wrap the call to `nvim_del_autocmd` in `pcall` to swallow any errors
  resulting from trying to delete the autocmd?

Fixes #24456

Helped-by: Maria José Solano <majosolano99@gmail.com>
2023-08-01 05:13:52 -07:00
Lewis Russell
20bfdbe832
docs(builtin): right align tags (#24522) 2023-08-01 11:12:00 +01:00
zeertzjq
ccb5a76e5a
fix(defaults): don't use nvim_feedkeys in default mappings (#24520)
Problem:    Using nvim_feedkeys in default mappings makes it hard to use
            them as a part of another mapping.
Solution:   Use an expression mapping and stop Visual mode later.

Fix #24518.
2023-08-01 18:07:02 +08:00
Lewis Russell
9b5f58185e
docs(builtin): fix and annotate language blocks (#24506) 2023-08-01 09:57:52 +01:00