Commit Graph

4795 Commits

Author SHA1 Message Date
zeertzjq
907fc8ac37
vim-patch:9.0.0449: there is no easy way to translate a key code into a string (#20168)
Problem:    There is no easy way to translate a string with a key code into a
            readable string.
Solution:   Add the keytrans() function. (closes vim/vim#11114)
cdc839353f

vim-patch:7b2d87220c6c

Add missing part of patch
7b2d87220c
2022-09-13 06:23:33 +08:00
Christian Clason
fd70e2bff2
Merge pull request #20141 from vigoux/ts-self-inherits
fix(treesitter): prevent endless loop on self-inheritence

docs(treesitter): suggest using extends to extend queries
2022-09-12 17:35:49 +02:00
Thomas Vigouroux
a3272cf452
docs(treesitter): suggest using extends to extend queries 2022-09-12 17:14:27 +02:00
Christian Clason
afe01842ef
vim-patch:9.0.0448: SubRip files are not recognized (#20167)
Problem:    SubRip files are not recognized.
Solution:   Add a pattern for SubRip. (closes vim/vim#11113)
5a4eb55122
2022-09-12 15:12:39 +02:00
zeertzjq
245ac6f263 vim-patch:8.2.5034: there is no way to get the byte index from a virtual column
Problem:    There is no way to get the byte index from a virtual column.
Solution:   Add virtcol2col(). (Yegappan Lakshmanan, closes vim/vim#10477,
            closes vim/vim#10098)
5a6ec10cc8

Cherry-pick tv_check_for_number_arg() from Vim.
Cherry-pick pathshorten() doc change.
2022-09-12 17:28:07 +08:00
Christian Clason
f98cff9575
vim-patch:9.0.0443: blueprint files are not recognized (#20155)
Problem:    Blueprint files are not recognized.
Solution:   Add a pattern for blueprint files. (Gabriele Musco, closes vim/vim#11107)
cce82a55b8
2022-09-11 16:07:54 +02:00
Thomas Vigouroux
1939518eba
fix(treesitter): prevent endless loop on self-inheritence
Fixes #20139
2022-09-11 08:16:50 +02:00
Gregory Anders
9b4cab0126
fix(lsp): schedule removal of client object (#20148)
The execution of the LspDetach autocommands in the LSP client's on_exit
function are scheduled on the event loop to avoid making API calls in a
fast context; however, this means that by the time the LspDetach
autocommands finally run the client object has already been deleted.

To address this, we also schedule the deletion of the client on the
event loop so that it is guaranteed to occur after all of the LspDetach
autocommands have fired.
2022-09-10 18:56:29 -06:00
Christian Clason
91a2e7a571
vim-patch:71b6d3397649 (#20144)
Update runtime files
71b6d33976
2022-09-10 14:54:13 +02:00
Christian Clason
40f9f479b7
vim-patch:9.0.0434: gitignore files are not recognized (#20143)
Problem:    gitignore files are not recognized.
Solution:   Add patterns for the gitignore filetype. (closes vim/vim#11102)
9ba2786f15
2022-09-10 13:30:54 +02:00
Christian Clason
9b0e1256e2
vim-patch:9.0.0427: Drupal theme files are not recognized (#20138)
Problem:    Drupal theme files are not recognized.
Solution:   Use php filetype for Drupl theme files.  Remove trailing spaces.
            (Rodrigo Aguilera, closes vim/vim#11096)
8995c4cd4e
2022-09-09 18:48:12 +02:00
Christian Clason
ad2d6a624b
vim-patch:9.0.0424: gitattributes files are not recognized (#20134)
Problem:    gitattributes files are not recognized.
Solution:   Add patterns to match gitattributes files. (closes vim/vim#11085)
7d56cfc861
2022-09-09 17:53:15 +02:00
Lewis Russell
038c711539 refactor(vim.opt): de-nest code 2022-09-09 12:38:15 +01:00
Lewis Russell
9272d20ea4 refactor(vim.opt): use local function syntax 2022-09-09 12:38:15 +01:00
Lewis Russell
ad972990ad refactor(vim.opt): optimize append/prepend/remove 2022-09-09 12:38:15 +01:00
Lewis Russell
b364bc2c34 refactor(vim.opt): dry up and tidy 2022-09-09 12:38:10 +01:00
Lewis Russell
925a811990 refactor(vim.opt): remove value_mutator() 2022-09-09 09:54:54 +01:00
Lewis Russell
7533ceec13 refactor(vim.opt): unify vim.bo/wo building 2022-09-09 09:54:53 +01:00
Christian Clason
79a9b00671
build(deps): bump tree-sitter-viml to 0.2.0 (#20121) 2022-09-08 19:46:40 +02:00
Mathias Fußenegger
19a3b2c26e
docs(lsp): update rpc.start stdio limitations (#20120) 2022-09-08 10:25:16 -07:00
Lewis Russell
164752b380 refactor(vim.opt): remove make_meta_accessor() 2022-09-08 17:24:17 +01:00
Raphael
30ca6d23a9
fix(lsp): when buffer detach remove buffer from client attached buffers (#20081)
Co-authored-by: Mathias Fussenegger <f.mathias@zignar.net>
2022-09-08 17:09:32 +02:00
Lewis Russell
514a1679dc refactor(vim.opt): simplify get_option_metatype 2022-09-08 15:44:00 +01:00
Lewis Russell
b8de5ada80 refactor(vim.opt): replace _setup with lazy table 2022-09-08 15:42:17 +01:00
Lewis Russell
f21e2a51ba refactor(vim.opt): remove enums 2022-09-08 15:32:26 +01:00
Lewis Russell
bc88691dbd refactor(vim.opt): remove del arg 2022-09-08 15:32:26 +01:00
Christian Clason
08602ec1ab
vim-patch:9.0.0417: Jsonnet files are not recognized (#20119)
Problem:    Jsonnet files are not recognized.
Solution:   Add a pattern for Jsonnet files. (Cezary Drożak, closes vim/vim#11073,
            closes vim/vim#11081)
2a4c885d54
2022-09-08 16:06:00 +02:00
Mathias Fußenegger
11167ab6d5
feat(lsp): add range option to lsp.buf.format (#19998) 2022-09-08 11:33:04 +02:00
Christian Clason
8c59d7e6a7
Merge pull request #20093 from neovim/upstream-ts-util
* feat(treesitter): upstream get_{node,captures} utility functions
* refactor(treesitter): get_{nodes,captures}_at_{position,cursor}
2022-09-08 11:23:26 +02:00
bfredl
893b659e88
fix(treesitter): use the right loading order for base queries (#20117)
Use the first, not last, query for a language on runtimepath. Typically,
this implies that a user query will override a site plugin query, which 
will override a bundled runtime query.
2022-09-08 11:17:29 +02:00
Thomas Vigouroux
0405594399
feat(treesitter)!: do not merge queries by default (#20105)
Problem: Treesitter queries for a given language in runtime were merged together, 
leading to errors if they targeted different parser versions (e.g., bundled viml queries 
and those shipped by nvim-treesitter).
Solution:  Runtime queries now work as follows:
* The last query in the rtp without `; extends` in the header will be used as the base query
* All queries (without a specific order) with `; extends` are concatenated with the base query

BREAKING CHANGE: queries need to be updated if they are meant to extend other queries
2022-09-08 09:47:36 +02:00
Raphael
4af04df844 fix(docs): remove duplicate word 2022-09-08 14:33:17 +08:00
zeertzjq
99e6e0f221 docs(treesitter): fix doxygen 2022-09-08 12:54:41 +08:00
ii14
4dc4cf3467
fix(options): mark winhighlight as list style (#19477)
Also add missing fcs, lcs and winhighlight to list of key-value options for `vim.opt`.

Co-authored-by: ii14 <ii14@users.noreply.github.com>
2022-09-07 17:59:27 +02:00
Christian Clason
9d1d3a6707
vim-patch:9.0.0402: javascript module files are not recoginzed (#20108)
Problem:    Javascript module files are not recoginzed.
Solution:   Recognize "*.jsm" files as Javascript. (Brett Holman,
            closes vim/vim#11069)
bb6c4073e7
2022-09-07 15:55:39 +02:00
Thomas Vigouroux
fd1595514b
Use weak tables in tree-sitter code (#17117)
feat(treesitter): use weak tables when possible

Also add the defaulttable function to create a table whose values are created when a key is missing.
2022-09-07 08:39:56 +02:00
Sean Dewar
f32fd19f1e
fix(diagnostic): remove buf from cache on BufWipeout (#20099)
Doing so on `BufDelete` has issues:
  - `BufDelete` is also fired for listed buffers that are made unlisted.
  - `BufDelete` is not fired for unlisted buffers that are deleted.

This means that diagnostics will be lost for a buffer that becomes unlisted.

It also means that if an entry exists for an unlisted buffer, deleting that
buffer later will not remove its entry from the cache (and you may see "Invalid
buffer id" errors when using diagnostic functions if it was wiped).

Instead, remove a buffer from the cache if it is wiped out.
This means simply `:bd`ing a buffer will not clear its diagnostics now.
2022-09-06 20:55:03 -06:00
Lewis Russell
707edfc9e6
fix(ts): do not clobber spelloptions (#20095) 2022-09-06 19:22:05 +01:00
Christian Clason
d01cadd82f fix(treesitter): don't support legacy syntax in start() 2022-09-06 17:33:44 +02:00
Thomas Vigouroux
75adfefc85 feat(extmarks,ts,spell): full support for spelling
- Added 'spell' option to extmarks:

  Extmarks with this set will have the region spellchecked.

- Added 'noplainbuffer' option to 'spelloptions':

  This is used to tell Neovim not to spellcheck the buffer. The old
  behaviour was to spell check the whole buffer unless :syntax was set.

- Added spelling support to the treesitter highlighter:

  @spell captures in highlights.scm are used to define regions which
  should be spell checked.

- Added support for navigating spell errors for extmarks:

  Works for both ephemeral and static extmarks

- Added '_on_spell_nav' callback for decoration providers:

  Since ephemeral callbacks are only drawn for the visible screen,
  providers must implement this callback to instruct Neovim which
  regions in the buffer need can be spell checked.

  The callback takes a start position and an end position.

  Note: this callback is subject to change hence the _ prefix.

- Added spell captures for built-in support languages

Co-authored-by: Lewis Russell <lewis6991@gmail.com>
Co-authored-by: Björn Linse <bjorn.linse@gmail.com>
2022-09-06 10:14:11 +01:00
bfredl
05893aea39
Merge pull request #20039 from zeertzjq/cmod-tab
fix(api)!: correctly deal with number before :tab
2022-09-06 10:32:23 +02:00
Christian Clason
95fd1ad83e refactor(treesitter): get_{nodes,captures}_at_{position,cursor} 2022-09-06 10:15:23 +02:00
Quentin Rasmont
ffe98531b9 feat(treesitter): upstream get_node_at_cursor()
Util from the nvim-treesitter project.
2022-09-06 10:14:05 +02:00
bfredl
5b8d6e0b32
Merge pull request #15391 from vigoux/ts-lua-builtin
feat(treesitter): highlighting for core languages, enabled for Lua
2022-09-06 10:10:01 +02:00
Christian Clason
4bf005e9fd
vim-patch:partial 0daafaa7d99e (#20083)
Update runtime files
0daafaa7d9

skip vim9script ftplugin
create userfunc.txt from Neovim content (skip section 3, needs 9.0.0379)
2022-09-06 08:57:53 +02:00
Christian Clason
0822896efc feat(treesitter): add vim.treesitter.start(), enable for Lua
* Add vim.treesitter.start() for starting treesitter highlighting via
  ftplugin or autocommand (can be extended later for fold, indent,
  matchpairs, ...)
* Add vim.treesitter.stop() for manually stopping treesitter
  highlighting
* Enable treesitter highlighting for Lua if
  `vim.g.ts_highlight_lua = true` is set in `init.lua`
2022-09-06 08:08:29 +02:00
Christian Clason
64cc78c9f3 feat(treesitter): add injections 2022-09-06 07:57:46 +02:00
Christian Clason
e85b8aa768 feat(treesitter): add viml parser and queries 2022-09-06 07:57:46 +02:00
Thomas Vigouroux
905dd49fec feat(treesitter): bundle Lua parser and queries
parser from https://github.com/MunifTanjim/tree-sitter-lua
queries from nvim-treesitter
2022-09-06 07:57:46 +02:00
zeertzjq
ceb09701f2 feat(api): add "move" to nvim_input_mouse 2022-09-04 21:18:23 +08:00
zeertzjq
04bd700ac3 feat(tui): support 'mousemoveevent' 2022-09-04 21:18:22 +08:00
zeertzjq
a5fe7940c8 feat(ui-ext): make 'mousemoveevent' a ui_option 2022-09-04 21:18:22 +08:00
zeertzjq
00b49dd8dd vim-patch:8.2.4674: cannot force getting MouseMove events
Problem:    Cannot force getting MouseMove events.
Solution:   Add the 'mousemoveevent' option with implementaiton for the GUI.
            (Ernie Rael, closes vim/vim#10044)
c4cb544cd5

This only ports the docs and the option variable.
The following commits will actually implement it as a UI option.
2022-09-04 21:18:08 +08:00
zeertzjq
21dad0dcf3 vim-patch:088e8e344352
Update runtime files.
088e8e3443

Also cherry-pick "partial" tag from a later runtime update.
2022-09-04 18:39:55 +08:00
zeertzjq
6f7d55d3d9 vim-patch:7.4.{1578,1624}
975b5271ee
03602ec28e
2022-09-04 18:39:55 +08:00
Christian Clason
927d4d2a15
fix(filetype): run filetype.match on StdinReadPost (#20070)
Problem: filetype detection does not run on piped input
Solution: add `StdinReadPost` to main filetype.lua autocommand

Rationale: legacy filetype detection checked contents by sourcing
`scripts.vim` in separate autocommands, including on `StdinReadPost`.
For Lua filetype detection, this was moved into the main autocommand,
with bundled `scripts.vim` gated behind `g:do_legacy_filetype` (i.e.,
only user `scripts.vim` are sourced for compatibility by default). Adding
`StdinReadPost` to the main autocommand again runs content checks on
piped input without requiring code duplication and low-payoff
refactoring.
2022-09-03 19:27:57 +02:00
zeertzjq
1ef7720567 fix(api)!: correctly deal with number before :tab
Now nvim_parse_cmd and nvim_create_user_command use a "tab" value which
is the same as the number passed before :tab modifier instead of the
number plus 1, and "tab" value is -1 if :tab modifier is not used.
2022-09-02 22:28:57 +08:00
Lewis Russell
2afcdbd63a
feat(Man): port to Lua (#19912)
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2022-09-02 15:20:29 +01:00
Jonas Strittmatter
ce80b8f50d
vim-patch:9.0.0349: filetype of *.sil files not well detected (#20050)
Problem:    Filetype of *.sil files not well detected.
Solution:   Inspect the file contents to guess the filetype.
be807d5824
2022-09-02 08:16:17 +02:00
zeertzjq
689f5d604e feat(api): add support for :horizontal modifier 2022-09-01 20:53:43 +08:00
zeertzjq
56bf026dea vim-patch:9.0.0346: :horizontal modifier not fully supported
Problem:    :horizontal modifier not fully supported.
Solution:   Also use :horizontal for completion and user commands.
            (closes vim/vim#11025)
d3de178e53
2022-09-01 20:28:23 +08:00
zeertzjq
c65b1f3e15 vim-patch:9.0.0342: ":wincmd =" equalizes in two directions
Problem:    ":wincmd =" equalizes in two directions.
Solution:   Make ":vertical wincmd =" equalize vertically only and
            ":horizontal wincmd =" equalize horizontally only.
21c3a80a7f
2022-09-01 20:25:29 +08:00
zeertzjq
0c6b39894f
feat(mapset): support restoring Lua callback (#20024)
vim-patch:9.0.0341: mapset() does not restore <Nop> mapping properly

Problem:    mapset() does not restore <Nop> mapping properly.
Solution:   Use an empty string for <Nop>. (closes vim/vim#11022)
92a3d20682
2022-09-01 06:19:49 +08:00
bfredl
f31db30975 feat(lua): vim.ui_attach to get ui events from lua
Co-authored-by: Famiu Haque <famiuhaque@protonmail.com>
2022-08-31 20:40:17 +02:00
Christian Clason
0903702634
vim-patch:9b03d3e75b42 (#20013)
Update runtime files
9b03d3e75b
2022-08-31 08:08:51 +02:00
Christian Clason
6b7eed1884
Vim 9.0.{0314,0319}: some filetypes are not recognized (#20005)
* vim-patch:9.0.0314: VDM files are not recognized

Problem:    VDM files are not recognized.
Solution:   Add patterns for VDM files. (Alessandro Pezzoni, closes vim/vim#11004)
bf26941f40

* vim-patch:9.0.0319: Godot shader files are not recognized

Problem:    Godot shader files are not recognized.
Solution:   Add patterns for "gdshader". (Maxim Kim, closes vim/vim#11006)
d5c8f11905
2022-08-30 21:16:03 +02:00
Christian Clason
9397e70b9e
docs(lua): present vim.o as default and vim.opt as special-purpose #19982
Problem: People are confused about `vim.o` and `vim.opt`
Solution: Clarify that `vim.o` is the default interface, with `vim.opt`
          specifically meant for interacting with list-style options.
2022-08-30 05:46:38 -07:00
Mathias Fußenegger
981ae83fad
fix(docs): update lsp.rpc.start docs to match return value changes (#20003)
Follow up to https://github.com/neovim/neovim/pull/19916
2022-08-30 13:14:27 +02:00
Mathias Fußenegger
0368ca70c4
docs(lsp): replace formatting_sync example in lsp-faq (#19994)
`formatting_sync` is deprecated
2022-08-30 13:14:09 +02:00
Raphael
efacb6e974
fix(lsp): clean the diagnostic cache when buffer delete (#19449)
Co-authored-by: Gregory Anders <greg@gpanders.com>
2022-08-29 19:09:14 +02:00
Mathias Fußenegger
126fe7fbc9
Merge pull request #19916 from mfussenegger/lsp-tcp
Adds TCP support for lsp.
Usage example:

```
vim.lsp.start({ name = 'godot', cmd = vim.lsp.rpc.connect('127.0.0.1', 6008) })
```
2022-08-29 18:26:14 +02:00
Shougo
253f0ffd8d
vim-patch:9.0.0285: it is not easy to change the command line from a plugin (#19979)
vim-patch:9.0.0285: it is not easy to change the command line from a plugin

Problem:    It is not easy to change the command line from a plugin.
Solution:   Add setcmdline(). (Shougo Matsushita, closes vim/vim#10869)
07ea5f1509
2022-08-29 13:11:52 +08:00
Mathias Fussenegger
60ec6e34d5 feat(lsp): add tcp support 2022-08-28 14:07:53 +02:00
Mathias Fussenegger
46bb34e26b refactor(lsp): extract rpc client from rpc.start
Makes the previously inner functions re-usable for a TCP client
2022-08-28 14:07:53 +02:00
Mathias Fussenegger
7d3e4aee6a refactor(lsp): encapsulate rpc uv handle
To prepare for different transports like TCP where the handle won't have
a kill method.
2022-08-28 14:07:53 +02:00
Mathias Fussenegger
f9641d1ac6 refactor(lsp): factor out read_loop function 2022-08-28 14:07:53 +02:00
dundargoc
09c6ce8c4e
docs: fix typos (#19798)
Co-authored-by: adrian5 <adrian5@users.noreply.github.com>
Co-authored-by: Eisuke Kawashima <e-kwsm@users.noreply.github.com>
2022-08-27 15:56:58 +08:00
zeertzjq
cc2c8be481 vim-patch:9.0.0279: the tiny version has the popup menu but not 'wildmenu'
Problem:    The tiny version has the popup menu but not 'wildmenu'.
Solution:   Graduate the wildmenu feature.
5416232707

N/A patches for version.c:

vim-patch:9.0.0281: build failure without the +eval feature

Problem:    Build failure without the +eval feature.
Solution:   Add #ifdef.
58dcbf1c65
2022-08-27 07:03:07 +08:00
Christian Clason
6a13b8fa54
vim-patch:7dd543246a4c (#19960)
Update runtime files
7dd543246a
2022-08-26 19:58:10 +02:00
bfredl
2ecb4076df
Merge pull request #19931 from bfredl/scopedhl
feat(highlight)!: use scoped @foo.bar.special groups for tree-sitter highlight
2022-08-26 14:43:58 +02:00
bfredl
b04ef7f6b9 fix(treesitter): make it get_captures_at_position 2022-08-26 13:57:31 +02:00
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
Lewis Russell
2498e9feb0 refactor: change FALSE/TRUE to false/true
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2022-08-26 09:36:55 +01:00
zeertzjq
fa1c761d62 vim-patch:9.0.0036: 'fillchars' cannot have window-local values
Problem:    'fillchars' cannot have window-local values.
Solution:   Make 'fillchars' global-local. (closes vim/vim#5206)
96ba25ac01

Cherry-pick g:run_nr from patch 8.2.0454.

N/A patches for version.c:

vim-patch:9.0.0037: build error

Problem:    Build error.
Solution:   Add missing change.
510f03738d
2022-08-26 10:14:59 +08: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
Jonas Strittmatter
ff1266aaaa
vim-patch:9.0.0182: quarto files are not recognized (#19702)
Problem:    Quarto files are not recognized.
Solution:   Recognize quarto files by the extension. (Jonas Strittmatter,
            closes vim/vim#10880)
3a9687fb27
2022-08-10 13:44:57 +02:00
zeertzjq
512e0441f1
docs: fix some mistakes and missing docs (#19699) 2022-08-10 12:47:38 +08:00
Mathias Fußenegger
bebfbfab3b
fix(lsp): handle multiple clients with incremental sync (#19658)
The change tracking used a single lines/lines_tmp table to track
changes to a buffer.

If multiple clients using incremental sync are connected to a buffer,
they both made changes to the same lines table. That resulted in an
inconsistent state.

This commit changes the didChange handling to group clients by
synchronization scheme and offset encoding.
This avoids computing the diff multiple times for clients using the
same scheme and resolves the lines/lines_tmp conflicts.

Fixes https://github.com/neovim/neovim/issues/19325
2022-08-09 22:20:40 +02:00
Christian Clason
33ddca6fa0
docs(lua): add luv (vim.loop) reference manual (#19679)
Upstreamed from https://github.com/nanotee/luv-vimdocs with kind
permission from @nanotee.
2022-08-09 13:21:50 +02:00
Christian Clason
a5e846b996
vim-patch:partial: 48c3f4e0bff7 (#19684)
vim-patch:partial:48c3f4e0bff7

Update runtime files
48c3f4e0bf

partially skip `options.txt` (needs 9.0.0138)
2022-08-09 10:43:28 +02:00
dundargoc
e6680ea7c3
docs(lua): add Lua 5.1 reference manual (#19663)
based on http://www.vim.org/scripts/script.php?script_id=1291
reformatted to match Nvim documentation style; removed irrelevant sections

Co-authored-by: dundargoc <gocundar@gmail.com>
Co-authored-by: Christian Clason <c.clason@uni-graz.at>
Co-authored-by: Lewis Russell <lewis6991@gmail.com>
2022-08-08 18:58:32 +02:00
Mathias Fußenegger
68c674af0f
feat(lsp): set formatexpr by default (#19677)
Follow up to https://github.com/neovim/neovim/pull/19003
2022-08-08 18:30:17 +02:00
zeertzjq
9fedb6fd78 vim-patch:8.2.3545: setcellwidths() may make 'listchars' or 'fillchars' invalid
Problem:    setcellwidths() may make 'listchars' or 'fillchars' invalid.
Solution:   Check the value and give an error. (closes vim/vim#9024)
94358a1e6e

Cherry-pick f_setcellwidths() change from patch 9.0.0036.
Cherry-pick 'ambiwidth' docs update from runtime update 079ba76ae7a7.
2022-08-08 20:03:40 +08:00
zeertzjq
53c9500c1d vim-patch:8.2.1535: it is not possible to specify cell widths of characters
Problem:    It is not possible to specify cell widths of characters.
Solution:   Add setcellwidths().
08aac3c619

Co-Authored-By: delphinus <me@delphinus.dev>
2022-08-08 20:03:40 +08:00
Mathias Fußenegger
a46e6afb8b
fix(lsp): set end_col in formatexpr (#19676)
The last line was excluded from formatting via formatexpr because the
character in the params was set to 0 instead of the end of line.
2022-08-08 13:02:15 +02:00
Mathias Fußenegger
2d5fce2cdb
feat(lsp): disable exit_timeout by default (#19672)
The lsp client used to wait up to 500ms for a language server to
shutdown before sending a TERM signal.

The intention behind the 500ms grace period was to ensure the language
server exits to prevent stale processes, but it has the side-effect that
it can interrupt language-servers which are too slow to shutdown within
500ms. Language servers tend to write out index files or project files
on shutdown, and being interrupted during this process can cause
corruption of those files.

This changes the default to not wait at all, at the risk of leaving
stale processes around if the language server isn't well behaved.

An alternative would be to wait indefinitely, but that can cause neovim
to take several seconds to exit.
2022-08-08 12:34:37 +02:00
zeertzjq
5f0fbe7c2f
vim-patch:8.1.0942: options window still checks for the multi_byte feature (#19652)
Problem:    Options window still checks for the multi_byte feature.
Solution:   Remove the unnecessary check. (Dominique Pelle, closes vim/vim#3990)
76cbe811da
2022-08-06 08:29:57 +08:00
Cai.MY
85ad0e6b43
fix(lsp): avoid ^M character in hover window on Windows (#19640) 2022-08-05 15:23:01 +02:00
Christian Clason
21f5aee777
vim-patch:9.0.0141: "delmenu" does not remove autocmmands (#19646)
Problem:    "delmenu" does not remove autocmmands. Running menu test function
            alone fails.
Solution:   Delete autocommands Make sure there is at least one menu.
            (closes vim/vim#10848)
206fce307b
2022-08-05 12:23:41 +02:00
Jonas Strittmatter
7ebcb9b333
docs: improve example in incremental preview section (#19613)
- Separate preview and callback functions to make the example easier to understand
- Use false instead of 0 for boolean arguments in API function calls
- Remove explicit nil checks for consistency
- Format with stylua
2022-08-05 10:16:26 +08:00
zeertzjq
57fbcc6929 vim-patch:8.2.0478: new buffers are not added to the Buffers menu
Problem:    New buffers are not added to the Buffers menu.
Solution:   Turn number into string. (Yee Cheng Chin, closes vim/vim#5864)
5908fdf72f
2022-08-05 07:56:56 +08:00
zeertzjq
d985323c55 vim-patch:8.2.0413: buffer menu does not handle special buffers properly
Problem:    Buffer menu does not handle special buffers properly.
Solution:   Keep a dictionary with buffer names to reliably keep track of
            entries.
            Also trigger BufFilePre and BufFilePost for command-line and
            terminal buffers when the name changes.
5e94a29ebb
2022-08-05 07:53:54 +08:00