Commit Graph

24080 Commits

Author SHA1 Message Date
Christian Clason
04da043244
feat(lsp): add function to get semantic tokens at cursor 2022-12-13 18:59:27 +01:00
bfredl
a442c9f556
Merge pull request #21375 from nojnhuh/highlight-test
fix(tests): initialize Screen.colors in API highlight tests
2022-12-12 22:11:39 +01:00
Christian Clason
54d6a32fbd
feat(lsp): highlight semantic token modifiers (#21390)
Apply semantic token modifiers as separate extmarks with corresponding
highlight groups (e.g., `@readonly`). This is a low-effort PR to enable
the most common use cases (applying, e.g., italics or backgrounds on top
of type highlights; language-specific fallbacks like `@global.lua` are
also available). This can be replaced by more complicated selector-style
themes later on.
2022-12-12 20:43:14 +01:00
jdrouhard
3869a2e0cf
perf(lsp): update semantic tokens algorithm for parsing modifiers (#21383)
Instead of testing for every possible modifier type, only test bits up
to the highest set in the token array. Saves many bit ops and
comparisons when there are no modifiers or when the highest set bit is a
lower bit than the highest possible in the legend on average.

Can be further simplified when non-luaJIT gets the full bit module (see #21222)
2022-12-12 18:42:37 +01:00
Lewis Russell
d40d34aaa5
fix(diff): handle long lines without crashing (#21389)
Fixes https://github.com/neovim/neovim/issues/21388
2022-12-12 16:44:11 +00:00
ii14
49c240d3a2
docs: add links to extmarks and namespaces (#21378)
Co-authored-by: ii14 <ii14@users.noreply.github.com>
2022-12-12 15:15:31 +00:00
Phelipe Teles
8b9bf3e3b9
fix: vim.opt_local:append ignoring global option value (#21382)
Closes https://github.com/neovim/neovim/issues/18225
2022-12-12 15:14:50 +00:00
Christian Clason
3217a31f9b
vim-patch:7db29e4b5c3a (#21380)
* vim-patch:7db29e4b5c3a

Update runtime files

7db29e4b5c

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2022-12-12 06:13:23 +01:00
Justin M. Keyes
1c324cb192
docs #20986
- https://github.com/neovim/tree-sitter-vimdoc v1.2.4 eliminates most
  errors in pi_netrw.txt, so we can remove that workaround from
  ignore_parse_error().
- improved codeblock
2022-12-11 18:41:26 -08:00
dundargoc
b12bb97fee
docs: fix typos (#21328) 2022-12-12 08:53:07 +08:00
zeertzjq
407eef4738
vim-patch:9.0.1047: matchparen is slow (#21379)
Problem:    Matchparen is slow.
Solution:   Actually use the position where the match started, not the
            position where the search started. (closes vim/vim#11644)

79336e19cb

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2022-12-11 23:02:41 +08:00
zeertzjq
3dadd3aca5
vim-patch:8.2.2870: CmdlineChange event triggered twice for CTRL-R (#21361)
Problem:    CmdlineChange event triggered twice for CTRL-R.
Solution:   Return CMDLINE_NOT_CHANGED from cmdline_insert_reg().
            (closes vim/vim#8219)

796139ae3a

Cherry-pick Test_cmdline_map_cmdlineChanged() from patch 8.2.2851.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2022-12-11 08:48:00 +08:00
Jon Huhn
ea8b828901 fix(tests): initialize Screen.colors in API highlight tests 2022-12-10 15:59:21 -06:00
zeertzjq
224473546c
fix(api): set correct curbuf when temporarily changing curwin (#21371)
This is the same code change as 6c87bbb4e4
2022-12-10 20:13:40 +08:00
fsouza
6d37d8cb17
fix(lsp): ignore null responses for semanticTokens request (#21364)
The spec indicates that the response may be `null`, but it doesn't
really say what a `null` response means. Since neovim raises an error if
the response is `null`, I figured that ignoring it would be the safest
bet.

Co-authored-by: Mathias Fussenegger <f.mathias@zignar.net>
2022-12-10 12:16:33 +01:00
James McCoy
f96fb23de6
Merge pull request #21363 from jamessan/fuse-vim-patches
fix(vim-patches): ensure libfuse is installed
2022-12-09 19:49:36 -05:00
zeertzjq
7faf8a45e8
fix(events): skip WinScrolled for newly-created float windows (#21333)
Unlike split windows, creating a new floating window does not cause
other windows to resize, so it doesn't make much sense to trigger
WinScrolled or WinResized when creating a new floating window.
2022-12-10 06:50:03 +08:00
Mathias Fußenegger
8b84a10db7
fix(lsp): fix get_active_clients bufnr parameter (#21366)
Follow up to https://github.com/neovim/neovim/pull/21337
2022-12-09 22:02:04 +01:00
Mathias Fußenegger
49df92da94
fix(lsp): correct some type annotations (#21365) 2022-12-09 19:18:31 +01:00
James McCoy
2ecb401f8b
fix(vim-patches): ensure libfuse is installed 2022-12-09 09:56:56 -05:00
zeertzjq
3cf0131c5c
vim-patch:9.0.1038: function name does not match what it is used for (#21359)
Problem:    Function name does not match what it is used for.
Solution:   Include the modifier in the name. (closes vim/vim#11679)

ffa4e9b43a
2022-12-09 20:09:03 +08:00
jdrouhard
5e6a288ce7
fix(lsp): followup fixes for semantic tokens support (#21357)
1. The algorithm for applying edits was slightly incorrect. It needs to
   preserve the original token list as the edits are applied instead of
   mutating it as it iterates. From the spec:

   Semantic token edits behave conceptually like text edits on
   documents: if an edit description consists of n edits all n edits are
   based on the same state Sm of the number array. They will move the
   number array from state Sm to Sm+1.

2. Schedule the semantic token engine start() call in the
   client._on_attach() function so that users who schedule_wrap() their
   config.on_attach() functions (like nvim-lspconfig does) can still
   disable semantic tokens by deleting the semanticTokensProvider from
   their server capabilities.
2022-12-09 11:54:09 +01:00
zeertzjq
b5edea6553
vim-patch:9.0.0238: Shift-Tab shows matches on cmdline when 'wildmenu' is off (#21355)
Problem:    Shift-Tab shows matches on cmdline when 'wildmenu' is off.
Solution:   Only show matches when 'wildmode' contains "list". (closes vim/vim#10951)

300175fd7f

Code change has already been ported.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2022-12-09 11:31:02 +08:00
zeertzjq
f69d531d84
test: convert another test in test_matchadd_conceal.vim to Lua (#21353) 2022-12-09 10:37:53 +08:00
zeertzjq
0483ee8254
vim-patch:8.2.4387: command line completion doesn't always work properly (#21352)
Problem:    Command line completion doesn't always work properly.
Solution:   Adjust triggering after a "|".  Add more tests. (Yegappan
            Lakshmanan, closes vim/vim#9779)

e3846cf1eb

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2022-12-09 09:45:45 +08:00
zeertzjq
ae5980ec79
Merge pull request #21350 from zeertzjq/vim-8.2.4366
vim-patch:8.2.{4366,4376}: cmdline completion tests
2022-12-09 08:18:07 +08:00
zeertzjq
98dc445767 vim-patch:8.2.4376: not enough tests for command line completion
Problem:    Not enough tests for command line completion.
Solution:   Add a few more tests. (Yegappan Lakshmanan, closes vim/vim#9771)

9773db6f9b

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2022-12-09 07:52:50 +08:00
zeertzjq
41282259ba vim-patch:8.2.4366: not enough tests for command line completion
Problem:    Not enough tests for command line completion.
Solution:   Add a few more tests. (Yegappan Lakshmanan, closes vim/vim#9760)

4d03d87000

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2022-12-09 07:52:50 +08:00
zeertzjq
8b3412636a
test(old): change $TMPDIR from Xtest-tmpdir to X-test-tmpdir (#21346)
I've noticed a patch 8.2.4376 that uses more Xtest directories.
Change $TMPDIR to X-test-tmpdir to avoid more future divergence.
2022-12-09 07:51:37 +08:00
zeertzjq
d82096edf8
Merge pull request #21348 from zeertzjq/vim-9.0.1036
vim-patch:9.0.1036: undo misbehaves when writing from an insert mode mapping
2022-12-09 07:24:09 +08:00
zeertzjq
95044991e6 test(undo_spec): add more tests for writing in Insert mode 2022-12-09 07:00:27 +08:00
zeertzjq
70d6c335b1 vim-patch:9.0.1036: undo misbehaves when writing from an insert mode mapping
Problem:    Undo misbehaves when writing from an insert mode mapping.
Solution:   Sync undo when writing. (closes vim/vim#11674)

3f8f827723

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2022-12-09 06:55:15 +08:00
Dave Lage
ea39fc2cad
docs: dark/light color/accessibilty pass for generated html docs #21345 2022-12-08 14:00:18 -08:00
Enan Ajmain
1e2cc68889
fix(chansend): sending lines to terminal in reverse order on Windows #19315
Problem: `chansend()` on Windows sends lines in reverse order.
Cause: Using \n instead of \r\n for newlines on Windows.
Solution: on Windows, use CRLF newline characters.

Fixes #18501
2022-12-08 12:55:50 -08:00
zeertzjq
9b2c790344
Merge pull request #21338 from zeertzjq/vim-9.0.1030
vim-patch:9.0.{1030,1032}: using freed memory with the cmdline popup menu
2022-12-09 02:40:50 +08:00
zeertzjq
95c655fedc vim-patch:9.0.1032: test fails when terminal feature is missing
Problem:    Test fails when terminal feature is missing.
Solution:   Use CheckRunVimInTerminal.

b9603f6498

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2022-12-09 02:16:57 +08:00
zeertzjq
4d22424d9e vim-patch:9.0.1030: using freed memory with the cmdline popup menu
Problem:    Using freed memory with the cmdline popup menu.
Solution:   Clear the popup menu when clearing the matches. (closes vim/vim#11677)

038e6d20e6

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2022-12-09 02:16:57 +08:00
Gregory Anders
9b14ad5fd9
Merge pull request #21100 from jdrouhard/lsp_semantic_tokens
LSP: semantic tokens support
2022-12-08 10:55:09 -07:00
John Drouhard
9f035559de feat(lsp): initial support for semantic token highlighting
* credit to @smolck and @theHamsta for their contributions in laying the
  groundwork for this feature and for their work on some of the helper
  utility functions and tests
2022-12-08 11:31:56 -06:00
John Drouhard
5e0c74cd82 refactor(test): create an lsp-specific helpers.lua file
* move the code for creating fake rpc servers there
2022-12-08 11:31:56 -06:00
Gregory Anders
42009ac7df
feat(treesitter): add 'lang' option to show_tree() (#21341)
This is necessary for now to support filetypes that use a parser with a
different name (e.g. the "terraform" filetype uses the "hcl" parser).
2022-12-08 09:51:46 -07:00
Gregory Anders
d44699800c
feat(treesitter): add vim.treesitter.show_tree() (#21322)
Add a "show_tree" function to view a textual representation of the
nodes in a language tree in a window. Moving the cursor in the
window highlights the corresponding text in the source buffer, and
moving the cursor in the source buffer highlights the corresponding
nodes in the window.
2022-12-08 09:22:57 -07:00
Christian Clason
3576776903
vim-patch:86b4816766d9 (#21314)
Update runtime files

86b4816766

vim-patch:9.0.1029: autoload directory missing from distribution

Problem:    Autoload directory missing from distribution.
Solution:   Add the autoload/zig directory to the list of distributed files.

84dbf855fb

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2022-12-08 16:33:38 +01:00
zeertzjq
7b9ad45178
vim-patch:8.2.1634: loop to handle keys for the command line is too long (#21340)
Problem:    Loop to handle keys for the command line is too long.
Solution:   Move a few more parts to separate functions. (Yegappan Lakshmanan,
            closes vim/vim#6895)

9c929713b7
2022-12-08 22:52:25 +08:00
Raphael
50ffb8d7f4
refactor(lsp): remove deprecated vim.lsp.buf_get_clients calls (#21337) 2022-12-08 13:28:28 +01:00
zeertzjq
e2c5b21e18
test(lsp): call clear() before willSave tests (#21336)
Otherwise these two tests cannot run alone and may fail on CI.
2022-12-08 19:22:40 +08:00
zeertzjq
4f64aef29f
vim-patch:8.2.3564: invalid memory access when scrolling without valid screen (#21335)
vim-patch:8.2.3564: invalid memory access when scrolling without valid screen

Problem:    Invalid memory access when scrolling without a valid screen.
Solution:   Do not set VALID_BOTLINE in w_valid.

777e7c21b7

Remove -Z flag when using RunVim().

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2022-12-08 18:58:06 +08:00
dundargoc
a27ed57ad0
docs(lua): add guide to using Lua in Neovim (#21137)
Add introductory guide explaining how to use Lua in Neovim:
where to put Lua files, how to set variables and options, how
to create mappings, autocommands, and user commands.

Adapted with kind permission from 
https://github.com/nanotee/nvim-lua-guide
2022-12-08 11:21:42 +01:00
Mathias Fußenegger
54305443b9
feat(lsp): support willSave & willSaveWaitUntil capability (#21315)
`willSaveWaitUntil` allows servers to respond with text edits before
saving a document. That is used by some language servers to format a
document or apply quick fixes like removing unused imports.
2022-12-08 10:55:01 +01:00
zeertzjq
a505c1acc3
vim-patch:9.0.1026: type of w_last_topfill is wrong (#21332)
Problem:    type of w_last_topfill is wrong.
Solution:   Use "int" instead of "linenr_T". (closes vim/vim#11670)

2e613453ee
2022-12-08 07:39:56 +08:00