Commit Graph

23106 Commits

Author SHA1 Message Date
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
Thomas Vigouroux
36faac6241
Merge pull request #20115 from glepnir/fix_doc
fix(docs): remove duplicate word
2022-09-08 08:43:20 +02:00
Raphael
4af04df844 fix(docs): remove duplicate word 2022-09-08 14:33:17 +08:00
Thomas Vigouroux
79afdae2f3
Merge pull request #20114 from zeertzjq/ts-docs
docs(treesitter): fix doxygen comment
2022-09-08 08:20:27 +02:00
zeertzjq
99e6e0f221 docs(treesitter): fix doxygen 2022-09-08 12:54:41 +08:00
zeertzjq
078e49b96a
Merge pull request #20112 from zeertzjq/vim-9.0.0410
vim-patch:9.0.{0410,0412}: unused cts_lnum
2022-09-08 09:22:38 +08:00
zeertzjq
06f9da547c vim-patch:9.0.0412: compiler warning for unused argument
Problem:    Compiler warning for unused argument.
Solution:   Add UNUSED.
e5a420fb33
2022-09-08 08:54:14 +08:00
zeertzjq
80a566b55f vim-patch:9.0.0410: struct member cts_lnum is unused
Problem:    Struct member cts_lnum is unused.
Solution:   Delete it.
d7633114af
2022-09-08 08:52:10 +08:00
zeertzjq
e93f22f28a
Merge pull request #20110 from ii14/vim-7c7e1e9b98d4
vim-patch:8.2.3702,9.0.0409
2022-09-08 08:47:01 +08:00
ii14
4a67f9d386 vim-patch:9.0.0409: #{g:x} was seen as a curly-braces expression
Problem:    #{g:x} was seen as a curly-braces expression.
Solution:   Do never see #{} as a curly-braces expression. (closes vim/vim#11075)
7c7e1e9b98
2022-09-08 08:17:30 +08:00
zeertzjq
93a0c2dd63 vim-patch:8.2.3702: first key in dict is seen as curly expression and fails
Problem:    First key in dict is seen as curly expression and fails.
Solution:   Ignore failure of curly expression. (closes vim/vim#9247)
98cb90ef86
2022-09-08 08:15:55 +08:00
luukvbaal
ead524656d
vim-patch:9.0.0403: 'equalalways' may be off when 'laststatus' is zero (#20109)
Problem:    'equalalways' may be off when 'laststatus' is zero.
Solution:   call last_status() before win_equal(). (Luuk van Baal,
            closes https://github.com/vim/vim/pull/11070)
fd7e60a33d
2022-09-07 18:08:00 +02: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
bfredl
ff9d2b17fb
Merge pull request #20100 from bfredl/luafunc
refactor(typval): change FC_CFUNC abstraction into FC_LUAREF
2022-09-07 09:08:05 +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
bfredl
db9b8b08e7 refactor(typval): change FC_CFUNC abstraction into FC_LUAREF
"cfuncs" was only ever used to wrap luarefs. As vim8script is
finished and will not be developed further, support for "cfuncs"
for other usecases are not planned. This abstraction was immediately
broken anyway in order to get luarefs out of userfuncs again.

Even if a new kind of userfunc needs to be invented in the future,
likely just extending the FC_... flag union directy, instead of
invoking unnecessary heap object and c function pointer indirection,
will be a more straightforward design pattern.
2022-09-07 00:52:58 +02:00
bfredl
b17c5c3d9c
Merge pull request #20102 from e-kwsm/treesitter-c99
build(treesitter): set CMAKE_C_STANDARD to C99
2022-09-07 00:49:08 +02:00
Eisuke Kawashima
c77bb5a528
build(treesitter): set CMAKE_C_STANDARD to C99 2022-09-07 06:33:58 +09:00
Christian Clason
694ac26946
Merge pull request #17329 from cryptomilk/asn-vterm-0-2
build(deps): bump libvterm to 0.3-RC1
2022-09-06 22:41:37 +02:00
Andreas Schneider
b76e33b598 fix(terminal): adopt altscreen test for libvterm 0.2 changes
Due to a rewrite of the resize handling logic in libvterm, the behavior
changed. It's actually fixing a bug.

16b8574575
2022-09-06 21:48:22 +02:00
Andreas Schneider
9ecaa35f55 build(deps): use libvterm 0.3-rc1 2022-09-06 21:48:14 +02:00
Andreas Schneider
2aeb8d976f feat(term): add support for libvterm >= 0.2
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2022-09-06 21:19:55 +02:00
bfredl
74a8b5982a
Merge pull request #20031 from dundargoc/refactor/char_u/8
refactor: replace char_u with char 8: remove `vim_strsave`
2022-09-06 20:38:26 +02:00
Lewis Russell
707edfc9e6
fix(ts): do not clobber spelloptions (#20095) 2022-09-06 19:22:05 +01:00
bfredl
aaa54a8b3e
Merge pull request #20097 from clason/ts-syntax-off
fix(treesitter): don't support legacy syntax in start()
2022-09-06 19:57:07 +02:00
Christian Clason
d01cadd82f fix(treesitter): don't support legacy syntax in start() 2022-09-06 17:33:44 +02:00
dundargoc
6e3a69b4cf
build: consistently set build type regardless of generator or platform #19760
Change the default build type to always be Debug, and allow only four
predefined build types: Debug, Release, RelWithDebInfo and MinRelSize.
Furthermore, flags meant for single-configuration generator (make,
ninja) will not be used for multi-configuration generators (visual
studio, Xcode), and flags meant for multi-configuration generators will
not be used for single-configuration generators.

This will allow Debug builds to be built with MSVC which requires that
all dependencies are also built with the Debug build type to avoid
runtime library mismatch.

The correct way to specify build type (for example Release) for
single-configuration generators (Make and Ninja) is to run

cmake -B build -D CMAKE_BUILD_TYPE=Release
cmake --build build

while for multi-configuration generators (Visual Studio, Xcode and Ninja
Multi-Config) is to run

cmake -B build
cmake --build build --config Release

Passing CMAKE_BUILD_TYPE for multi-config generators will now not only
not be used, but also generate a warning for the user.

Co-authored-by: dundargoc <gocundar@gmail.com>
2022-09-06 07:52:39 -07:00
Dundar Göc
73207cae61 refactor: replace char_u with char
Work on https://github.com/neovim/neovim/issues/459
2022-09-06 16:44:37 +02:00
Shougo
87e037e26c
fix(cmdheight=0): various issues part3 #19816
And fixed in https://github.com/neovim/neovim/pull/19801 regression.

Fix #19834
Fix #19184
2022-09-06 07:33:25 -07:00
dundargoc
12afc344de
refactor: migrate comment style 2 #20080 2022-09-06 07:23:00 -07:00
Andreas Schneider
74db632c97 refactor(term): use const for title and add len to buf_set_term_title() 2022-09-06 13:23:50 +02:00
Lewis Russell
84d1094958
Merge pull request #19419 from vigoux/extmark_spell
Co-authored-by: Lewis Russell <lewis6991@gmail.com>
Co-authored-by: Björn Linse <bjorn.linse@gmail.com>
2022-09-06 11:23:01 +01: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
Lewis Russell
5b7213ad7f
docs: update .mailmap (#20086)
Co-authored-by: dundargoc <33953936+dundargoc@users.noreply.github.com>
2022-09-06 08:57:03 +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
97f38f0a9b fix(treesitter): do not link @error by default
The @error capture is used for tree-sitter's ERROR node, which indicates
a parsing error -- which can be quite frequent (and jarring) while typing.

Users can still manually `hi link @error Error` in their config.
2022-09-06 07:57:46 +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
Christian Clason
6254b0fd3b ci(tests): don't skip parsers on functionaltest
Treesitter parsers are now a mandatory part of the installation and
should be tested on all platforms. Remove `pending_c_parser` helper.
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
Dundar Goc
da34833fdf fix: assertion failure when requiring missing module in autocmd
Closes https://github.com/neovim/neovim/issues/15348
2022-09-05 19:11:25 +02:00