Commit Graph

4612 Commits

Author SHA1 Message Date
Quentin Rasmont
064ecb9ec5 feat(treesitter): upstream get_hl_groups_at_position()
Util from the nvim-treesitter project.
2022-08-26 13:57:31 +02:00
bfredl
030b422d1e feat(treesitter)!: use @foo.bar style highlight groups
This removes the support for defining links via
vim.treesitter.highlighter.hl_map (never documented, but plugins did
anyway), or the uppercase-only `@FooGroup.Bar` to `FooGroup` rule.

The fallback is now strictly `@foo.bar.lang` to `@foo.bar` to `@foo`,
and casing is irrelevant (as it already was outside of treesitter)

For compatibility, define default links to builting syntax groups
as defined by pre-existing color schemes
2022-08-26 13:57:31 +02:00
bfredl
8554164b1e fix(docs): update auto-generated documentation 2022-08-25 18:01:27 +02:00
Quentin Rasmont
244a115e49 feat(treesitter): clarify similar 'get_node_range' functions
The private 'get_node_range' function from the languagetree module has
been renamed and remains private as it serve a purpose that is only
relevant inside the languagetree module.

The 'get_node_range' upstreamed from nvim-treesitter in the treesitter
module has been made public as it is in itself a utlity function.
2022-08-25 18:01:15 +02:00
Quentin Rasmont
133ff6e11e feat(treesitter): upstream node_contains()
Util from the nvim-treesitter project.
2022-08-25 18:01:15 +02:00
Quentin Rasmont
6b2d42eb03 feat(treesitter): add ability to retreive a tree/node given a range 2022-08-25 18:01:14 +02:00
Quentin Rasmont
733b2e12b8 feat(treesitter): add opts.concat to query.get_text_node
As part of the upstream of utility functions from nvim-treesitter, this
option when set to false allows to return a table (downstream behavior).
Effectively making the switch from the downstream to the upstream
function much easier.
2022-08-25 18:01:14 +02:00
Quentin Rasmont
3aba4ba378 feat(treesitter): upstream is_parent()
Util from the nvim-treesitter project.
Renamed is_parent to is_ancestor for clarity.
2022-08-25 18:01:14 +02:00
zeertzjq
cd2d3aa48f
vim-patch:9.0.0261: bufload() reads a file even if the name is not a file name (#19944)
Problem:    bufload() reads a file even if the name is not a file name. (Cyker
            Way)
Solution:   Do not read the file when the buffer name is not a file name.
            (closes vim/vim#10975)
2eddbacd6d
2022-08-25 20:23:29 +08:00
Christian Clason
d3cd79709b
vim-patch:fd999452adaf (#19929)
Update runtime files
fd999452ad
2022-08-25 00:49:33 +02:00
bfredl
c545d514df
Merge pull request #19830 from lewis6991/hlgroup_name
feat(highlight)!: error on invalid names and allow '.' and '@'
2022-08-24 21:08:21 +02:00
Lewis Russell
61be343ec8 feat(highlight)!: error on invalid names and allow '.' and '@'
Previously if a highlight group with a name outside the regexp
[a-zA-Z0-9_] was defined, Nvim would emit an "invalid character"
warning message. This was annoying for Lua scripts, as it was very hard
to debug what line of code was triggering this message since it didn't
produce a stack trace.

This has now been promoted to an error with the code E5248.

Additionally the ASCII character period ('.') and at-sign ('@') have
been added to the allowed list of characters of a highlight group name
to support the application of defining hierarchical highlight groups,
e.g. 'TS.keyword'.

Co-authored-by: Christian Clason <christian.clason@uni-due.de>
2022-08-24 17:13:18 +01:00
Lewis Russell
b1eaa2b9a3
feat(lua): add vim.iconv (#18286)
Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
2022-08-24 14:41:31 +01:00
Thomas Vigouroux
9be4bfc5f4
Merge pull request #19496 from vigoux/ts_internal_lang
feat(treesitter): allow customizing language symbol name
2022-08-24 15:36:58 +02:00
Simon Wachter
e892b7b383
fix(inspect): escape identifiers that are lua keywords (#19898)
A lua keyword is not a valid table identifier
2022-08-23 13:02:55 +02:00
zeertzjq
7afc17dec1 vim-patch:8.2.4741: startup test fails
Problem:    Startup test fails.
Solution:   Avoid an error for verbose expansion.  Fix that the "0verbose"
            command modifier doesn't work.
60895f3e36

Most code changes has already been ported.
2022-08-23 17:48:12 +08:00
zeertzjq
a9e6cf0e64 vim-patch:8.2.4740: when expand() fails there is no error message
Problem:    When expand() fails there is no error message.
Solution:   When 'verbose' is set give an error message.
575445200b
2022-08-23 17:48:12 +08:00
zeertzjq
ffa1335047 vim-patch:8.2.4726: cannot use expand() to get the script name
Problem:    Cannot use expand() to get the script name.
Solution:   Support expand('<script>'). (closes vim/vim#10121)
6013d0045d

Use `.sn_name` instead of `->sn_name` as v8.2.0154 hasn't been ported.
Cherry-pick builtin.txt expand() doc from latest Vim.
2022-08-23 17:47:46 +08:00
zeertzjq
48a4657aee
vim-patch:8.1.{1915,1921,1953} (#19900)
vim-patch:8.1.1915: more functions can be used as methods

Problem:    More functions can be used as methods.
Solution:   Make various functions usable as a method.
1a3a89168d

Move debugbreak() to the right place.

vim-patch:8.1.1921: more functions can be used as methods

Problem:    More functions can be used as methods.
Solution:   Make various functions usable as a method.
a4208966fb

vim-patch:8.1.1953: more functions can be used as a method

Problem:    More functions can be used as a method.
Solution:   Allow more functions to be used as a method.
f9f24ce7a0

Omit test_termcodes.vim: cannot be used and superseded by later patches.
Cherry-pick test_bufline.vim change from patch 8.1.1993.
2022-08-23 08:36:22 +08:00
Thomas Vigouroux
3c1d70f20b
feat(treesitter): allow customizing language symbol name 2022-08-22 15:34:10 +02:00
zeertzjq
e3eb6967bc
vim-patch:8.2.4325: 'wildmenu' only shows few matches (#19876)
Problem:    'wildmenu' only shows few matches.
Solution:   Add the "pum" option: use a popup menu to show the matches.
            (Yegappan Lakshmanan et al., closes vim/vim#9707)
3908ef5017

Omit p_wmnu check in cmdline_pum_active() as it can cause problems.
Omit vim_strchr() flags as that isn't really better than bitmasks.
Omit key translations and document it in vim_diff.txt.
2022-08-21 21:31:25 +08:00
Christian Clason
1cc4706e94
vim-patch:e80086446cc2 (#19848)
* vim-patch:e80086446cc2

Update runtime files
e80086446c

Co-authored-by: Sean Dewar <seandewar@users.noreply.github.com>
2022-08-20 10:04:55 +02:00
zeertzjq
15ca01b649 vim-patch:8.2.4667: expandcmd() fails on an error
Problem:    expandcmd() fails on an error.
Solution:   On failure return the command unmodified. (yegappan Lakshmanan,
            closes vim/vim#10063)
5018a836c0
2022-08-20 07:25:22 +08:00
zeertzjq
e8618df7f8
vim-patch:8.2.3619: cannot use a lambda for 'operatorfunc' (#19846)
Problem:    Cannot use a lambda for 'operatorfunc'.
Solution:   Support using a lambda or partial. (Yegappan Lakshmanan,
            closes vim/vim#8775)
777175b0df

Omit duplicate docs. It's removed in patch 8.2.3623.
Nvim doesn't seem to need callback_set() as it was omitted when patch 8.1.1437
was first ported.
2022-08-20 06:12:02 +08:00
Christian Clason
b2f979b30b
fix(filetype): only check first 100 and last line of buffer (#19819)
fix(filetype): only pass first 100 and last lines to contents check

sufficient for current content checks and avoids performance issues for
buffers with a large number of lines

fixes #19817
2022-08-19 19:30:35 +02:00
Christian Clason
7e980a4df4
docs(lua): update vim.{g,b,w}o documentation (#19844)
docs(lua): update vim.{go,bo,wo} documentation

* document indexing by buffer/window handle
* correct wrapper information (`nvim_buf_{g,s}et_value` now)
* make clear what is considered "invalid key" (consistently)
2022-08-19 19:05:28 +02:00
bfredl
3c545b9c62
Merge pull request #19360 from famiu/feat/multibuffer-inccommand
feat: multibuffer preview support for inccommand
2022-08-19 17:21:18 +02:00
Famiu Haque
c2f7a2a18d feat: multibuffer preview support for inccommand
Allows preview callbacks to modify multiple buffers in order to show the
preview. Previously, if multiple buffers were modified, only the current
buffer would have its state restored. After this change, all buffers
have their state restored after preview.

Closes #19103.
2022-08-19 09:27:52 +06:00
Mathias Fußenegger
341ef46d00
docs(lsp): remove lsp.buf_request from docs (#19738)
This starts a soft phase-out of `buf_request`.

`buf_request` is quite error prone:

- Positional `params` depend on the client because of the
  `offset_encoding`. Currently if there is one client using UTF-8 offset
  encoding and another using UTF-16, the positions in the request are
  wrong for one of the clients. To solve this the params would need to
  be created per client instead of once for all of them.

- `handler` is called *per* client but many users of it assume it is
  only called once.

  This can lead to a "select n + 1"
  kind of problem, where the handler makes another call to `buf_request`,
  multiplying the amount of requests.
  (There are in fact still some places where this happens in core)

  Or it leads to erratic behavior if called multiple times (E.g. the
  quicklist list flickering & being overwritten)
  (See hover or references implementation)

  `buf_request_all` returns an aggregate of the responses which is more
  sensible as it avoids this problem.

  For off-spec extensions it also has the problem that it sends requests to
  clients which cannot handle a given request.

Given that `buf_request` is in use by a lot of plugins this starts a
soft-phase out. Planned Steps:

- Remove from docs
- Provide an alternative, either `buf_request_all`, maybe with
  extensions (params being a function), or an entirely new method.
- Mark as deprecated in 0.9
- Remove in 0.10

To note:

- `buf_request_all` currently isn't ideal either because it suffers from
the `params` problem as well.

- This implies that the `vim.lsp.with` pattern will die, because the
  global handlers as they are don't fit a multi-client model, as most of
  the time an aggregate is needed.
2022-08-18 10:57:17 +02:00
bfredl
d879331b0d feat(ui): allow to set the highlight namespace per window
- reimplement 'winhl' in terms of highlight namespaces
- check for EOF in screen tests (to indicate a likely crash)
2022-08-17 16:20:39 +02:00
Famiu Haque
f5588ee896
feat: allow :wincmd to accept a count (#19815)
Let :wincmd command accept a count like what its documentation suggests.
Previously it could only accept a range, which led to some ambiguity on
which attribute should be used when executing :wincmd using nvim_cmd.

Closes #19662.

Also fix a typo in a related Vim test:

vim-patch:9.0.0223: typo in diffmode test

Problem:    Typo in diffmode test.
Solution:   Fix the typo. (closes vim/vim#10932)
5fd6ab820b
2022-08-17 19:50:40 +08:00
Jonas Strittmatter
7a076306e4
docs(lsp): rename on-list-handler to lsp-on-list-handler (#19813)
This makes it easier to find documentation about the on-list-handler
when starting the search term with "lsp".
2022-08-17 12:39:38 +02:00
Christian Clason
e8caaab6bf
vim-patch:e1f3fd1d02e3 (#19796)
Update runtime files
e1f3fd1d02
2022-08-16 09:53:04 +02:00
zeertzjq
da13ed43cb
vim-patch:8.2.3888: the argument list may contain duplicates (#19795)
Problem:    The argument list may contain duplicates.
Solution:   Add the :argdedeupe command. (Nir Lichtman, closes vim/vim#6235)
73a024209c

Use latest index.txt :argdedupe doc from Vim.
2022-08-16 15:29:36 +08:00
Yegappan Lakshmanan
93ae183810
docs: update Vim differences (#19780)
Patch 8.2.4594 (36a5b6867b) added support for sourcing a buffer without a name.

Patch 8.2.4325 (3908ef5017) added support for using a popup menu for wildmode completion.
2022-08-15 10:40:41 +08:00
zeertzjq
98ab0bb5f7 vim-patch:8.2.1297: when a test fails it's often not easy to see where
Problem:    When a test fails it's often not easy to see what the call stack
            is.
Solution:   Add more entries from the call stack in the exception message.
a5d0423fa1

Use docs from latest Vim.
2022-08-15 10:14:52 +08:00
zeertzjq
b1faf5f0b9
vim-patch:8.2.4249: the timeout limit for spell suggestions is always 5000 (#19769)
Problem:    The timeout limit for spell suggestions is always 5000 milli
            seconds.
Solution:   Add the "timeout" entry to 'spellsuggest'.
585ee07cfe
2022-08-14 19:11:36 +08:00
Antoine Cotten
5854103dad
docs(lua): clarify vim.keymap.set() opts (#19761) 2022-08-14 06:38:31 +08:00
Christian Clason
33b49d5f55
vim-patch:9.0.0197: astro files are not detected (#19755)
Problem:    Astro files are not detected.
Solution:   Add a pattern to match Astro files. (Emilia Zapata, closes vim/vim#10904)
6a76e84f55
2022-08-13 15:11:03 +02:00
Christian Clason
a850b15e19
vim-patch:9.0.0195: metafun files are not recogized (#19746)
Problem:    Metafun files are not recogized.
Solution:   Add filetype detection patterns.
9032b9ceb6
2022-08-13 10:26:12 +02:00
zeertzjq
1de62b9ea1
fix(charclass): make behavior with empty str match latest Vim (#19749)
Later Vim patches changed to return 0 for empty string and null string.
Also update setcellwidth() docs to match latest Vim.
2022-08-13 12:25:01 +08:00
zeertzjq
754892e59d
vim-patch:8.2.{1536,1540}: charclass() (#19748)
vim-patch:8.2.1536: cannot get the class of a character; emoji widths are wrong

Problem:    Cannot get the class of a character; emoji widths are wrong in
            some environments.
Solution:   Add charclass(). Update some emoji widths.  Add script to check
            emoji widths.
4e4473c927

Use latest charclass() docs from Vim.
Rewrite DoIt() in emoji_list.vim in Lua.
Omit emoji table updates:
- emoji_width update looks wrong as these added ranges are only double-width when followed by 0xFE0F.
- Other updates are too old.

vim-patch:8.2.1540: the user cannot try out emoji character widths

Problem:    The user cannot try out emoji character widths.
Solution:   Move the emoji script to the runtime/tools directory.
98945560c1
2022-08-13 11:29:38 +08:00
Jonas Strittmatter
1cf3a4b409
docs: clarify that cursorline will be disabled before command preview (#19710) 2022-08-12 10:21:50 +02:00
Mathias Fußenegger
02289ab898
fix(lsp): fix nil value error in get_group (#19735)
`server_capabilities` can be nil until the server is initialized.
Reproduced with:

    vim.lsp.stop_client(vim.lsp.start_client {
      cmd = { vim.v.progpath, '-es', '-u', 'NONE', '--headless' };
    })
2022-08-12 10:10:03 +02:00
Mathias Fußenegger
33b77eb728
fix(lsp): handle nil client in onexit callback (#19722)
Follow up to https://github.com/neovim/neovim/pull/19658
2022-08-11 19:21:57 +02:00
Lewis Russell
a27756cc24
fix(signs): priority of extmark signs (#19718) 2022-08-11 17:26:17 +01:00
Mathias Fußenegger
996fc2256b
fix(lsp): avoid pipe leaks if lsp cmd isn't executable (#19717)
The `onexit` handler isn't called if `uv.spawn` doesn't return a handle.
2022-08-11 17:04:55 +02:00
Mathias Fußenegger
8b67f37798
fix(lsp): fix some type annotations in lsp.rpc (#19714) 2022-08-11 15:17:05 +02:00
Christian Clason
d1fb0dd8b9
Merge pull request #19685 from ii14/gen_vimdoc_indentation
docs: change gen_vimdoc indentation level
2022-08-11 14:34:00 +02:00
ii14
ea333badd2 docs: regenerate 2022-08-11 14:25:48 +02:00