[vim/vim] feat: treesitter integration (PR #18869)

133 views
Skip to first unread message

Foxe Chen

unread,
Dec 5, 2025, 10:21:30 PMDec 5
to vim/vim, Subscribed

This PR doesn't actually do anything useful for the end user, all it does is just expose the treesitter C API through vimscript, which is what Neovim does except they use Lua. I suppose the end game plan is to create a vim9 script pack plugin that uses the API to actually do useful things.

To expose the treesitter API to vimscript, I created a new type called "opaque", which is similar to Lua's userdata if you know what that is. All they do is just bring reference counting to a block of memory + I also added properties to them (which are essentially the same as class members). They have full type checking at both runtime and compile time (for vim9 script), including the properties.

I haven't added tests yet so be mindful that it may be a little buggy/segfaulty.

Here's a demo script that highlights string literals using the C parser (just run g:RunParse(<buffer number>), also ignore the red highlighting on the function names, the syntax files have not been updated):

vim9script

ts_load("c", "/usr/lib/tree_sitter/c.so") # Update to where the parser library is

var parser: opaque<TSParser> = tsparser_new()

tsparser_set_language(parser, "c")

prop_type_add('literal', {'highlight': 'ErrorMsg'})

def g:RunParse(buf: number): opaque<TSQueryCursor>
    var res: opaque<TSTree>

    # There is a timeout limit for parsing (here 3 milliseconds), meaning we can implement async parsing: 
    while true
        var tree: opaque<TSTree> = tsparser_parse_buf(parser, buf, 3)

        if tree == null_opaque
            continue
        endif

        res = tree
        break
    endwhile

    var node: opaque<TSNode> = tstree_root_node(res)

    var querystr: list<string> =<< trim END
    (string_literal) @string
    END

    var query: opaque<TSQuery> = tsquery_new("c", join(querystr, "\n"))
    var cursor: opaque<TSQueryCursor> = tsquerycursor_new()

    tsquerycursor_exec(cursor, query, node)

    while tsquerycursor_next_match(cursor)
        for i in range(0, len(cursor.match_captures) - 1)
            var capture: opaque<TSNode> = cursor.match_captures[i][0]
            var start: tuple<number, number> = capture.start_point
            var end: tuple<number, number> = capture.end_point

            prop_add(start[0] + 1, start[1] + 1, {
                type: 'literal',
                end_lnum: end[0] + 1,
                end_col: end[1] + 1
            })
        endfor
    endwhile

    return cursor
enddef

TODO:

  • Add ability to load WASM parser modules
  • Add tests
  • Add more API functions

You can view, comment on, or merge this pull request online at:

  https://github.com/vim/vim/pull/18869

Commit Summary

File Changes

(41 files)

Patch Links:


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869@github.com>

Foxe Chen

unread,
Dec 8, 2025, 12:42:48 AMDec 8
to vim/vim, Push

@64-bitman pushed 1 commit.


View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/before/26c49b2402224443af36f194c0a405f29179b0b9/after/e45791c95b15c743b0f6c49d34b45c160a9b4ca5@github.com>

Foxe Chen

unread,
Dec 8, 2025, 12:44:30 AMDec 8
to vim/vim, Push

@64-bitman pushed 1 commit.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/before/e45791c95b15c743b0f6c49d34b45c160a9b4ca5/after/85d4c2c437cd88ed4b1ff18452dac70f94856841@github.com>

Foxe Chen

unread,
Dec 8, 2025, 12:50:41 AMDec 8
to vim/vim, Push

@64-bitman pushed 1 commit.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/before/85d4c2c437cd88ed4b1ff18452dac70f94856841/after/b926151a190bb6436c8f3532aed9e2ed4c0e56e9@github.com>

Foxe Chen

unread,
Dec 8, 2025, 12:55:43 AMDec 8
to vim/vim, Push

@64-bitman pushed 1 commit.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/before/b926151a190bb6436c8f3532aed9e2ed4c0e56e9/after/f41ece7b2a680580eff3338276445f6ca58cd57d@github.com>

Foxe Chen

unread,
Dec 8, 2025, 1:00:38 AMDec 8
to vim/vim, Push

@64-bitman pushed 1 commit.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/before/f41ece7b2a680580eff3338276445f6ca58cd57d/after/b68cdb93ea56106e9c28a1a2eb1bc1559123c564@github.com>

Foxe Chen

unread,
Dec 8, 2025, 1:04:06 AMDec 8
to vim/vim, Push

@64-bitman pushed 1 commit.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/before/b68cdb93ea56106e9c28a1a2eb1bc1559123c564/after/ab0a676d602814332fbe2e1f3491c3099d9ea403@github.com>

Foxe Chen

unread,
Dec 8, 2025, 1:04:38 AMDec 8
to vim/vim, Push

@64-bitman pushed 1 commit.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/before/ab0a676d602814332fbe2e1f3491c3099d9ea403/after/a869a023296329e73ca309252d0907290f910430@github.com>

Foxe Chen

unread,
Dec 8, 2025, 1:10:35 AMDec 8
to vim/vim, Push

@64-bitman pushed 1 commit.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/before/a869a023296329e73ca309252d0907290f910430/after/51013cdac22793244cac46d0715fba3176338b3b@github.com>

Foxe Chen

unread,
Dec 8, 2025, 1:13:52 AMDec 8
to vim/vim, Push

@64-bitman pushed 1 commit.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/before/51013cdac22793244cac46d0715fba3176338b3b/after/5d14a8689cd5b9a06793338aad1b752dc1632620@github.com>

Foxe Chen

unread,
Dec 8, 2025, 1:24:29 AMDec 8
to vim/vim, Push

@64-bitman pushed 1 commit.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/before/5d14a8689cd5b9a06793338aad1b752dc1632620/after/c2c7e0cde3afa7bb0e37f448495e0e1fa52385ec@github.com>

Foxe Chen

unread,
Dec 8, 2025, 1:27:05 AMDec 8
to vim/vim, Push

@64-bitman pushed 1 commit.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/before/c2c7e0cde3afa7bb0e37f448495e0e1fa52385ec/after/e44b17f68274197ac616671bfdfef1332589520e@github.com>

Dominique Pelle

unread,
Dec 8, 2025, 1:30:07 AMDec 8
to vim/vim, Subscribed

@DominiquePelle-TomTom commented on this pull request.


In src/vim9expr.c:

> + */
+    static int
+compile_opaque_index(cctx_T *cctx, char_u **arg, type_T *type)
+{
+    opaque_type_T	*ot;
+    opaque_property_T	*prop;
+    char_u  *name;
+    char_u  *name_end;
+    size_t  len;
+    int	    idx;
+
+    if (VIM_ISWHITE((*arg)[1]))
+    {
+	semsg(_(e_no_white_space_allowed_after_str_str), ".", *arg);
+	return FAIL;
+    }

Indentation does not look right.

The same remark applies to several other places in this file and other files.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/review/3550319868@github.com>

Foxe Chen

unread,
Dec 8, 2025, 1:33:59 AMDec 8
to vim/vim, Subscribed

@64-bitman commented on this pull request.


In src/vim9expr.c:

> + */
+    static int
+compile_opaque_index(cctx_T *cctx, char_u **arg, type_T *type)
+{
+    opaque_type_T	*ot;
+    opaque_property_T	*prop;
+    char_u  *name;
+    char_u  *name_end;
+    size_t  len;
+    int	    idx;
+
+    if (VIM_ISWHITE((*arg)[1]))
+    {
+	semsg(_(e_no_white_space_allowed_after_str_str), ".", *arg);
+	return FAIL;
+    }

That is just github being weird with displaying code. It looks fine viewed otherwise


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/review/3550328297@github.com>

Foxe Chen

unread,
Dec 8, 2025, 10:01:31 PMDec 8
to vim/vim, Push

@64-bitman pushed 1 commit.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/before/c935f1ea508d3b757cef1cdbd535f5144d83cf7f/after/320fa1fea7b961a27c025ee8fe0ce005eb6631ff@github.com>

Foxe Chen

unread,
Dec 8, 2025, 10:29:19 PMDec 8
to vim/vim, Push

@64-bitman pushed 1 commit.

  • 2b9ff2d add decode function for parsing

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/before/320fa1fea7b961a27c025ee8fe0ce005eb6631ff/after/2b9ff2d5f200a111bd0cd0f91c64f3c1cd8afbee@github.com>

Foxe Chen

unread,
Dec 8, 2025, 10:31:20 PMDec 8
to vim/vim, Push

@64-bitman pushed 1 commit.

  • 6d5ca9b add decode function for parsing

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/before/2b9ff2d5f200a111bd0cd0f91c64f3c1cd8afbee/after/6d5ca9b652cf1530d85f894e972cfbd4d13e684d@github.com>

Foxe Chen

unread,
Dec 8, 2025, 10:35:50 PMDec 8
to vim/vim, Push

@64-bitman pushed 1 commit.

  • 8373842 add decode function for parsing

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/before/6d5ca9b652cf1530d85f894e972cfbd4d13e684d/after/837384274c062fc656e16e19d0fd004e22f25616@github.com>

Foxe Chen

unread,
Dec 8, 2025, 10:37:22 PMDec 8
to vim/vim, Push

@64-bitman pushed 1 commit.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/before/837384274c062fc656e16e19d0fd004e22f25616/after/72e3c1810b5d67ef30bf92ca2fe8afc6b7e58f8b@github.com>

Foxe Chen

unread,
Dec 8, 2025, 10:39:03 PMDec 8
to vim/vim, Push

@64-bitman pushed 1 commit.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/before/72e3c1810b5d67ef30bf92ca2fe8afc6b7e58f8b/after/e8209676905922da8ba03d793df346e24be45576@github.com>

Foxe Chen

unread,
Dec 8, 2025, 10:41:00 PMDec 8
to vim/vim, Push

@64-bitman pushed 1 commit.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/before/e8209676905922da8ba03d793df346e24be45576/after/4df81f974b99db1304de826e89af0fb14ed65e5a@github.com>

Foxe Chen

unread,
Dec 8, 2025, 10:46:42 PMDec 8
to vim/vim, Push

@64-bitman pushed 1 commit.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/before/4df81f974b99db1304de826e89af0fb14ed65e5a/after/f0f0353355e71e5a0f066053c139cd993977ecf2@github.com>

Foxe Chen

unread,
Dec 8, 2025, 10:49:44 PMDec 8
to vim/vim, Push

@64-bitman pushed 1 commit.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/before/f0f0353355e71e5a0f066053c139cd993977ecf2/after/4f76e4a7f5341d4d04b62eb254cdb5edf5d91bc9@github.com>

Foxe Chen

unread,
Dec 8, 2025, 11:15:43 PMDec 8
to vim/vim, Push

@64-bitman pushed 1 commit.

  • 59b93ce build treesitter library instead of distro pkg for ci

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/before/4f76e4a7f5341d4d04b62eb254cdb5edf5d91bc9/after/59b93ced5b72339f498e0440feb263b950b6a5ec@github.com>

Foxe Chen

unread,
Dec 8, 2025, 11:19:35 PMDec 8
to vim/vim, Push

@64-bitman pushed 1 commit.

  • d59edd2 build treesitter library instead of distro pkg for ci

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/before/59b93ced5b72339f498e0440feb263b950b6a5ec/after/d59edd24415ff511f97616ac6c197f2237190704@github.com>

Foxe Chen

unread,
Dec 8, 2025, 11:20:24 PMDec 8
to vim/vim, Push

@64-bitman pushed 1 commit.

  • 7b36492 build treesitter library instead of distro pkg for ci

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/before/d59edd24415ff511f97616ac6c197f2237190704/after/7b36492e0a7a7a53f654e201fa155c64b5a4d0b4@github.com>

Foxe Chen

unread,
Dec 8, 2025, 11:39:25 PMDec 8
to vim/vim, Push

@64-bitman pushed 1 commit.

  • 65faa4d build treesitter library instead of distro pkg for ci

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/before/7b36492e0a7a7a53f654e201fa155c64b5a4d0b4/after/65faa4da088d17c67b5633f2bcbddb78f23fbcdb@github.com>

Foxe Chen

unread,
Dec 8, 2025, 11:46:56 PMDec 8
to vim/vim, Push

@64-bitman pushed 1 commit.

  • b64106c build treesitter library instead of distro pkg for ci

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/before/65faa4da088d17c67b5633f2bcbddb78f23fbcdb/after/b64106c0a27fa980cf6c1b4a4bf79b4d78ff2f37@github.com>

Foxe Chen

unread,
Dec 8, 2025, 11:57:21 PMDec 8
to vim/vim, Push

@64-bitman pushed 1 commit.

  • 7fc285c build treesitter library instead of distro pkg for ci

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/before/b64106c0a27fa980cf6c1b4a4bf79b4d78ff2f37/after/7fc285ca25ae3a1c086fc3fdf012a24dfef90203@github.com>

Foxe Chen

unread,
Dec 9, 2025, 12:49:30 AMDec 9
to vim/vim, Push

@64-bitman pushed 2 commits.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/before/7fc285ca25ae3a1c086fc3fdf012a24dfef90203/after/3dccc23855d4c78c6b31401f5b53f142eeb62eef@github.com>

ubaldot

unread,
Dec 9, 2025, 7:57:33 AMDec 9
to vim/vim, Subscribed
ubaldot left a comment (vim/vim#18869)

So far I remember there have been discussions around treesitter and if I remember correctly it was a no-no. But I am aging badly and I may remember it wrongly.


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/c3632134118@github.com>

Foxe Chen

unread,
Dec 9, 2025, 8:01:53 AMDec 9
to vim/vim, Subscribed
64-bitman left a comment (vim/vim#18869)

So far I remember there have been discussions around treesitter and if I remember correctly it was a no-no. But I am aging badly and I may remember it wrongly.

Treesitter has improved greatly since then.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/c3632151647@github.com>

Foxe Chen

unread,
Dec 9, 2025, 9:05:50 AMDec 9
to vim/vim, Push

@64-bitman pushed 2 commits.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/before/3dccc23855d4c78c6b31401f5b53f142eeb62eef/after/d28548d9d7e75a7348c351673da4645f5451c933@github.com>

Foxe Chen

unread,
Dec 9, 2025, 10:17:56 AMDec 9
to vim/vim, Push

@64-bitman pushed 1 commit.

  • 372731f init decode callback to NULL

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/before/d28548d9d7e75a7348c351673da4645f5451c933/after/372731f107f76866d91e6431b8b1748ae595dcfb@github.com>

Foxe Chen

unread,
Dec 9, 2025, 10:28:07 AMDec 9
to vim/vim, Subscribed
64-bitman left a comment (vim/vim#18869)

@chrisbra Would you agree to adding the treesitter library as a submodule? Treesitter packages for non rolling linux distros are too old (treesitter development moves fast) and we would have to statically link it for Windows I'm pretty sure. Or we could include the treesitter source code directly in the repo, but I don't think that is the best way. Thanks.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/c3632857726@github.com>

Christian Clason

unread,
Dec 9, 2025, 10:41:42 AMDec 9
to vim/vim, Subscribed
clason left a comment (vim/vim#18869)

I could say something about tree-sitter development but will refrain from doing so here. My unsolicited (but hard-won) advice would be to

  1. Avoid submodules at all cost.
  2. Pin and statically link treesitter into Vim. (Tree-sitter uses semver but is at zerover, so patch updates should be safe but minor updates may be breaking.)
  3. Be prepared that distros will care little about what you do and link Vim against their shared system tree-sitter library at all costs.

@chrisbra In case you want to proceed with this; feel free to ping me with questions. I have some experience with the tree-sitter ecosystem...


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/c3632922171@github.com>

Christian Brabandt

unread,
Dec 9, 2025, 11:54:43 AMDec 9
to vim/vim, Subscribed
chrisbra left a comment (vim/vim#18869)

I'll take any advice I can 🙇‍♂️

I'd like to avoid submodules if possible, and your suggestions to link treesitter statically sounds good to me. Other than that, I am expecting a lot of issues from packaging side, especially on Windows systems and more exotic ones (like OpenVMS).

But I am basically blank with regard to tree-sitter. So any other suggestions from the other maintainers and power users are more than welcome!


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/c3633262497@github.com>

Christian Clason

unread,
Dec 9, 2025, 12:00:34 PMDec 9
to vim/vim, Subscribed
clason left a comment (vim/vim#18869)

Tree-sitter is battle-tested on Windows (although you may need CMake for that -- a fate worse than death; maybe Zig would be a more palatable approach due to its strong C interop). More "exotic" platforms are an issue, though; these are not officially supported, and no promises about the compiler requirements.


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/c3633292447@github.com>

BenYip

unread,
Dec 9, 2025, 9:49:49 PMDec 9
to vim/vim, Subscribed
bennyyip left a comment (vim/vim#18869)

Treesitter has improved greatly since then.

Can you elaborate this?

I am expecting a lot of issues from packaging side, especially on Windows systems and more exotic ones (like OpenVMS).

Treesitter is a C library with no external deps. They officially have a makefile that does amalgamated build. I suppose it's not very difficult to integrate.

https://github.com/tree-sitter/tree-sitter/blob/8b8199775f96ca8642cf7860da46100875b38453/Makefile#L12-L21


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/c3635129272@github.com>

BenYip

unread,
Dec 10, 2025, 1:38:55 AMDec 10
to vim/vim, Subscribed
bennyyip left a comment (vim/vim#18869)

I don't agree with the "disadvantages" skywind3000 gave at the first place. Some of them are objectively false.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/c3635617682@github.com>

Foxe Chen

unread,
Dec 10, 2025, 2:35:38 AMDec 10
to vim/vim, Push

@64-bitman pushed 25 commits.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/before/372731f107f76866d91e6431b8b1748ae595dcfb/after/c4c740bd0579769c8868a5a9f1c1dfe58d3f3f6a@github.com>

Foxe Chen

unread,
Dec 10, 2025, 2:40:29 AMDec 10
to vim/vim, Subscribed
64-bitman left a comment (vim/vim#18869)

Edit: Treesitter is build with std=c11 and vim is c99. But it still compiles under c99 with some warnings.

% make -B
cc -O3 -Wall -Wextra -Wshadow -Wpedantic -Werror=incompatible-pointer-types -std=c99 -fPIC -fvisibility=hidden -D_POSIX_C_SOURCE=200112L -D_DEFAULT_SOURCE -D_DARWIN_C_SOURCE -Ilib/src -Ilib/src/wasm -Ilib/include   -c -o lib/src/alloc.o lib/src/alloc.c
cc -O3 -Wall -Wextra -Wshadow -Wpedantic -Werror=incompatible-pointer-types -std=c99 -fPIC -fvisibility=hidden -D_POSIX_C_SOURCE=200112L -D_DEFAULT_SOURCE -D_DARWIN_C_SOURCE -Ilib/src -Ilib/src/wasm -Ilib/include   -c -o lib/src/get_changed_ranges.o lib/src/get_changed_ranges.c
In file included from lib/src/././tree_cursor.h:4,
                 from lib/src/./get_changed_ranges.h:8,
                 from lib/src/get_changed_ranges.c:1:
lib/src/./././subtree.h:35:4: warning: ISO C99 doesn’t support unnamed structs/unions [-Wpedantic]
   35 |   };
      |    ^
lib/src/./././subtree.h:146:6: warning: ISO C99 doesn’t support unnamed structs/unions [-Wpedantic]
  146 |     };
      |      ^
lib/src/./././subtree.h:153:4: warning: ISO C99 doesn’t support unnamed structs/unions [-Wpedantic]
  153 |   };
      |    ^
cc -O3 -Wall -Wextra -Wshadow -Wpedantic -Werror=incompatible-pointer-types -std=c99 -fPIC -fvisibility=hidden -D_POSIX_C_SOURCE=200112L -D_DEFAULT_SOURCE -D_DARWIN_C_SOURCE -Ilib/src -Ilib/src/wasm -Ilib/include   -c -o lib/src/language.o lib/src/language.c
In file included from lib/src/./language.h:8,
                 from lib/src/language.c:1:
lib/src/././subtree.h:35:4: warning: ISO C99 doesn’t support unnamed structs/unions [-Wpedantic]
   35 |   };
      |    ^
lib/src/././subtree.h:146:6: warning: ISO C99 doesn’t support unnamed structs/unions [-Wpedantic]
  146 |     };
      |      ^
lib/src/././subtree.h:153:4: warning: ISO C99 doesn’t support unnamed structs/unions [-Wpedantic]
  153 |   };
      |    ^
cc -O3 -Wall -Wextra -Wshadow -Wpedantic -Werror=incompatible-pointer-types -std=c99 -fPIC -fvisibility=hidden -D_POSIX_C_SOURCE=200112L -D_DEFAULT_SOURCE -D_DARWIN_C_SOURCE -Ilib/src -Ilib/src/wasm -Ilib/include   -c -o lib/src/lexer.o lib/src/lexer.c
In file included from lib/src/./lexer.h:9,
                 from lib/src/lexer.c:2:
lib/src/././subtree.h:35:4: warning: ISO C99 doesn’t support unnamed structs/unions [-Wpedantic]
   35 |   };
      |    ^
lib/src/././subtree.h:146:6: warning: ISO C99 doesn’t support unnamed structs/unions [-Wpedantic]
  146 |     };
      |      ^
lib/src/././subtree.h:153:4: warning: ISO C99 doesn’t support unnamed structs/unions [-Wpedantic]
  153 |   };
      |    ^
cc -O3 -Wall -Wextra -Wshadow -Wpedantic -Werror=incompatible-pointer-types -std=c99 -fPIC -fvisibility=hidden -D_POSIX_C_SOURCE=200112L -D_DEFAULT_SOURCE -D_DARWIN_C_SOURCE -Ilib/src -Ilib/src/wasm -Ilib/include   -c -o lib/src/node.o lib/src/node.c
In file included from lib/src/node.c:3:
lib/src/./subtree.h:35:4: warning: ISO C99 doesn’t support unnamed structs/unions [-Wpedantic]
   35 |   };
      |    ^
lib/src/./subtree.h:146:6: warning: ISO C99 doesn’t support unnamed structs/unions [-Wpedantic]
  146 |     };
      |      ^
lib/src/./subtree.h:153:4: warning: ISO C99 doesn’t support unnamed structs/unions [-Wpedantic]
  153 |   };
      |    ^
cc -O3 -Wall -Wextra -Wshadow -Wpedantic -Werror=incompatible-pointer-types -std=c99 -fPIC -fvisibility=hidden -D_POSIX_C_SOURCE=200112L -D_DEFAULT_SOURCE -D_DARWIN_C_SOURCE -Ilib/src -Ilib/src/wasm -Ilib/include   -c -o lib/src/parser.o lib/src/parser.c
In file included from lib/src/././tree_cursor.h:4,
                 from lib/src/./get_changed_ranges.h:8,
                 from lib/src/parser.c:9:
lib/src/./././subtree.h:35:4: warning: ISO C99 doesn’t support unnamed structs/unions [-Wpedantic]
   35 |   };
      |    ^
lib/src/./././subtree.h:146:6: warning: ISO C99 doesn’t support unnamed structs/unions [-Wpedantic]
  146 |     };
      |      ^
lib/src/./././subtree.h:153:4: warning: ISO C99 doesn’t support unnamed structs/unions [-Wpedantic]
  153 |   };
      |    ^
cc -O3 -Wall -Wextra -Wshadow -Wpedantic -Werror=incompatible-pointer-types -std=c99 -fPIC -fvisibility=hidden -D_POSIX_C_SOURCE=200112L -D_DEFAULT_SOURCE -D_DARWIN_C_SOURCE -Ilib/src -Ilib/src/wasm -Ilib/include   -c -o lib/src/point.o lib/src/point.c
cc -O3 -Wall -Wextra -Wshadow -Wpedantic -Werror=incompatible-pointer-types -std=c99 -fPIC -fvisibility=hidden -D_POSIX_C_SOURCE=200112L -D_DEFAULT_SOURCE -D_DARWIN_C_SOURCE -Ilib/src -Ilib/src/wasm -Ilib/include   -c -o lib/src/query.o lib/src/query.c
In file included from lib/src/./language.h:8,
                 from lib/src/query.c:13:
lib/src/././subtree.h:35:4: warning: ISO C99 doesn’t support unnamed structs/unions [-Wpedantic]
   35 |   };
      |    ^
lib/src/././subtree.h:146:6: warning: ISO C99 doesn’t support unnamed structs/unions [-Wpedantic]
  146 |     };
      |      ^
lib/src/././subtree.h:153:4: warning: ISO C99 doesn’t support unnamed structs/unions [-Wpedantic]
  153 |   };
      |    ^
cc -O3 -Wall -Wextra -Wshadow -Wpedantic -Werror=incompatible-pointer-types -std=c99 -fPIC -fvisibility=hidden -D_POSIX_C_SOURCE=200112L -D_DEFAULT_SOURCE -D_DARWIN_C_SOURCE -Ilib/src -Ilib/src/wasm -Ilib/include   -c -o lib/src/stack.o lib/src/stack.c
In file included from lib/src/./language.h:8,
                 from lib/src/stack.c:2:
lib/src/././subtree.h:35:4: warning: ISO C99 doesn’t support unnamed structs/unions [-Wpedantic]
   35 |   };
      |    ^
lib/src/././subtree.h:146:6: warning: ISO C99 doesn’t support unnamed structs/unions [-Wpedantic]
  146 |     };
      |      ^
lib/src/././subtree.h:153:4: warning: ISO C99 doesn’t support unnamed structs/unions [-Wpedantic]
  153 |   };
      |    ^
cc -O3 -Wall -Wextra -Wshadow -Wpedantic -Werror=incompatible-pointer-types -std=c99 -fPIC -fvisibility=hidden -D_POSIX_C_SOURCE=200112L -D_DEFAULT_SOURCE -D_DARWIN_C_SOURCE -Ilib/src -Ilib/src/wasm -Ilib/include   -c -o lib/src/subtree.o lib/src/subtree.c
In file included from lib/src/subtree.c:9:
lib/src/./subtree.h:35:4: warning: ISO C99 doesn’t support unnamed structs/unions [-Wpedantic]
   35 |   };
      |    ^
lib/src/./subtree.h:146:6: warning: ISO C99 doesn’t support unnamed structs/unions [-Wpedantic]
  146 |     };
      |      ^
lib/src/./subtree.h:153:4: warning: ISO C99 doesn’t support unnamed structs/unions [-Wpedantic]
  153 |   };
      |    ^
cc -O3 -Wall -Wextra -Wshadow -Wpedantic -Werror=incompatible-pointer-types -std=c99 -fPIC -fvisibility=hidden -D_POSIX_C_SOURCE=200112L -D_DEFAULT_SOURCE -D_DARWIN_C_SOURCE -Ilib/src -Ilib/src/wasm -Ilib/include   -c -o lib/src/tree.o lib/src/tree.c
In file included from lib/src/././tree_cursor.h:4,
                 from lib/src/./get_changed_ranges.h:8,
                 from lib/src/tree.c:3:
lib/src/./././subtree.h:35:4: warning: ISO C99 doesn’t support unnamed structs/unions [-Wpedantic]
   35 |   };
      |    ^
lib/src/./././subtree.h:146:6: warning: ISO C99 doesn’t support unnamed structs/unions [-Wpedantic]
  146 |     };
      |      ^
lib/src/./././subtree.h:153:4: warning: ISO C99 doesn’t support unnamed structs/unions [-Wpedantic]
  153 |   };
      |    ^
cc -O3 -Wall -Wextra -Wshadow -Wpedantic -Werror=incompatible-pointer-types -std=c99 -fPIC -fvisibility=hidden -D_POSIX_C_SOURCE=200112L -D_DEFAULT_SOURCE -D_DARWIN_C_SOURCE -Ilib/src -Ilib/src/wasm -Ilib/include   -c -o lib/src/tree_cursor.o lib/src/tree_cursor.c
In file included from lib/src/./tree_cursor.h:4,
                 from lib/src/tree_cursor.c:2:
lib/src/././subtree.h:35:4: warning: ISO C99 doesn’t support unnamed structs/unions [-Wpedantic]
   35 |   };
      |    ^
lib/src/././subtree.h:146:6: warning: ISO C99 doesn’t support unnamed structs/unions [-Wpedantic]
  146 |     };
      |      ^
lib/src/././subtree.h:153:4: warning: ISO C99 doesn’t support unnamed structs/unions [-Wpedantic]
  153 |   };
      |    ^
cc -O3 -Wall -Wextra -Wshadow -Wpedantic -Werror=incompatible-pointer-types -std=c99 -fPIC -fvisibility=hidden -D_POSIX_C_SOURCE=200112L -D_DEFAULT_SOURCE -D_DARWIN_C_SOURCE -Ilib/src -Ilib/src/wasm -Ilib/include   -c -o lib/src/wasm_store.o lib/src/wasm_store.c
ar rcs libtree-sitter.a lib/src/alloc.o lib/src/get_changed_ranges.o lib/src/language.o lib/src/lexer.o lib/src/node.o lib/src/parser.o lib/src/point.o lib/src/query.o lib/src/stack.o lib/src/subtree.o lib/src/tree.o lib/src/tree_cursor.o lib/src/wasm_store.o
cc  -shared -Wl,-soname,libtree-sitter.so.0.26 lib/src/alloc.o lib/src/get_changed_ranges.o lib/src/language.o lib/src/lexer.o lib/src/node.o lib/src/parser.o lib/src/point.o lib/src/query.o lib/src/stack.o lib/src/subtree.o lib/src/tree.o lib/src/tree_cursor.o lib/src/wasm_store.o  -o libtree-sitter.so
sed -e 's|@PROJECT_VERSION@|0.26.2|' \
	-e 's|@CMAKE_INSTALL_LIBDIR@|lib|' \
	-e 's|@CMAKE_INSTALL_INCLUDEDIR@|include|' \
	-e 's|@PROJECT_DESCRIPTION@|An incremental parsing system for programming tools|' \
	-e 's|@PROJECT_HOMEPAGE_URL@|https://tree-sitter.github.io/tree-sitter/|' \
	-e 's|@CMAKE_INSTALL_PREFIX@|/usr/local|' lib/tree-sitter.pc.in > tree-sitter.pc

That looks like a problem, I guess we just disable the treesitter feature on non C11 compliant compilers?


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/c3635786714@github.com>

BenYip

unread,
Dec 10, 2025, 3:20:07 AMDec 10
to vim/vim, Subscribed
bennyyip left a comment (vim/vim#18869)

It still compiles in C99. The only feature they use is unnamed structs/unions in a few structs. We can give them names to suppress warnings.


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/c3635903559@github.com>

Foxe Chen

unread,
Dec 10, 2025, 11:38:19 PMDec 10
to vim/vim, Subscribed
64-bitman left a comment (vim/vim#18869)

I'm quite confused on how to go forward with statically linking Vim with Treesitter. The only thing I can think of is copying the Treesitter library files into src/treesitter/, and modifying our src/Makefile to build the library.

However, if we want to include WASM support, then it looks like we need rust (cargo) installed? I couldn't find any packages containing wasmtime development files on Arch Linux + how would this be done on Windows or MacOS? I'm not sure how accessible this wasmtime library is other then getting it through Cargo using this crate (from what I could find).


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/c3640073161@github.com>

Foxe Chen

unread,
Dec 11, 2025, 2:11:08 AMDec 11
to vim/vim, Push

@64-bitman pushed 1 commit.

  • f56f14e add tsquery_inspect() function

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/before/c4c740bd0579769c8868a5a9f1c1dfe58d3f3f6a/after/f56f14e4331e372431eb9317faf0085647712d55@github.com>

Foxe Chen

unread,
Dec 11, 2025, 2:13:24 AMDec 11
to vim/vim, Push

@64-bitman pushed 1 commit.

  • a9942e6 add tsquery_inspect() function

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/before/f56f14e4331e372431eb9317faf0085647712d55/after/a9942e637209b32f06fca4559a4e52abb78b6f58@github.com>

Christian Clason

unread,
Dec 11, 2025, 4:22:41 AMDec 11
to vim/vim, Subscribed
clason left a comment (vim/vim#18869)

Or we could use the Treesitter provided Makefile, but not sure if that is the best way.

Yes, that would be the best way. The lib itself is a fairly simple project, and so is the makefile (make static, and then include that in the linker step). Of course, if this is your first external dependency, this will require significant changes to your build process. (That's not something I can much help with; I can only say that the tree-sitter makefile is relatively footgun-free.)

However, if we want to include WASM support, then it looks like we need rust (cargo) installed?

Yes, for WASM parsers you (currently) need wasmtime-c-api, which is a rust dependency; see https://github.com/neovim/neovim/blob/master/cmake.deps/cmake/BuildWasmtime.cmake

However, we pretty much abandoned this for Neovim, not least because wasmtime is a fast-moving target (monthly major releases). I don't want to spoil things, but there may be a lighter-weight wasm runtime in Zig coming...

For now, I'd recommend ignoring WASM parsers and require native parsers.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/c3641006871@github.com>

Foxe Chen

unread,
Dec 11, 2025, 4:22:40 PMDec 11
to vim/vim, Push

@64-bitman pushed 1 commit.

  • 873390e add treesitter library in-tree

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/before/a9942e637209b32f06fca4559a4e52abb78b6f58/after/873390ecf4b5a82a65294094aff7dee28fe99edb@github.com>

Foxe Chen

unread,
Dec 11, 2025, 4:25:48 PMDec 11
to vim/vim, Push

@64-bitman pushed 1 commit.

  • fbd8068 add treesitter library in-tree

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/before/873390ecf4b5a82a65294094aff7dee28fe99edb/after/fbd8068d70866443e919d890b451e8919141f9ba@github.com>

Foxe Chen

unread,
Dec 11, 2025, 4:31:19 PMDec 11
to vim/vim, Push

@64-bitman pushed 27 commits.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/before/fbd8068d70866443e919d890b451e8919141f9ba/after/b160b0d572bb7b7aae54140b1f54546a49d2b066@github.com>

Foxe Chen

unread,
Dec 11, 2025, 4:35:11 PMDec 11
to vim/vim, Push

@64-bitman pushed 1 commit.

  • 8d6bcb5 add treesitter library in-tree

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/before/b160b0d572bb7b7aae54140b1f54546a49d2b066/after/8d6bcb5b0d8c2dbb770837f20c6613465503c559@github.com>

Foxe Chen

unread,
Dec 11, 2025, 4:36:46 PMDec 11
to vim/vim, Push

@64-bitman pushed 1 commit.

  • cc9eb9a add treesitter library in-tree

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/before/8d6bcb5b0d8c2dbb770837f20c6613465503c559/after/cc9eb9a85009dfbe4e2fd1bcbfe734c22fc5eb2c@github.com>

Foxe Chen

unread,
Dec 11, 2025, 4:39:06 PMDec 11
to vim/vim, Push

@64-bitman pushed 1 commit.

  • ebfea7f add treesitter library in-tree

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/before/cc9eb9a85009dfbe4e2fd1bcbfe734c22fc5eb2c/after/ebfea7f0e20a6411d342cba75feb78f67f17ec84@github.com>

Foxe Chen

unread,
Dec 11, 2025, 4:45:25 PMDec 11
to vim/vim, Push

@64-bitman pushed 1 commit.

  • 3b765f4 add treesitter library in-tree

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/before/ebfea7f0e20a6411d342cba75feb78f67f17ec84/after/3b765f4630993122f606d73dd93affbeea087735@github.com>

Foxe Chen

unread,
Dec 11, 2025, 8:34:14 PMDec 11
to vim/vim, Push

@64-bitman pushed 1 commit.

  • 781cd4a add treesitter library in-tree

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/before/3b765f4630993122f606d73dd93affbeea087735/after/781cd4a510cc0873d1341b7df397b4c1b12ba797@github.com>

Foxe Chen

unread,
Dec 11, 2025, 8:42:10 PMDec 11
to vim/vim, Push

@64-bitman pushed 1 commit.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/before/781cd4a510cc0873d1341b7df397b4c1b12ba797/after/e218f580ad458e0a882f2a87b8cf5212c9054044@github.com>

Foxe Chen

unread,
Dec 12, 2025, 12:01:34 AMDec 12
to vim/vim, Push

@64-bitman pushed 1 commit.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/before/e218f580ad458e0a882f2a87b8cf5212c9054044/after/84e7297b8a50f94c95f7b2c12a50a987cfbb9638@github.com>

D. Ben Knoble

unread,
Dec 12, 2025, 3:57:01 PMDec 12
to vim/vim, Subscribed
benknoble left a comment (vim/vim#18869)

I think @ubaldot was thinking of #9087. I do think we still have to have some kind of plan to address concerns raised in that discussion about the build process for language parsers that need compilation. It doesn't have to be perfect, but I think we need at least some notion of a vision/goal for how this will come together.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/c3648116995@github.com>

Foxe Chen

unread,
Dec 12, 2025, 5:25:54 PMDec 12
to vim/vim, Subscribed
64-bitman left a comment (vim/vim#18869)

I think @ubaldot was thinking of #9087. I do think we still have to have some kind of plan to address concerns raised in that discussion about the build process for language parsers that need compilation. It doesn't have to be perfect, but I think we need at least some notion of a vision/goal for how this will come together.

I believe all language parsers need compilation? As for the problem on how users will somehow get these parsers, I guess that can be implemented in community plugins? I don't think some users would like Vim having a builtin plugin that accesses the internet. We already offload actual LSP support onto community plugins, so this sounds reasonable as well.

As for needing a compiler, that is straightforward on Linux (just install the distro's devel package whatever) and I'm guessing other Unix OSes too, but I'm not sure about Windows.

The solution to this would be precompiled parsers, but looking the parser repo's of major programming languages, all they seem to provide is the source code in their releases. I read somewhere that nvim-treesitter provides precompiled artifacts of parsers and uses those, but that is sorta an official plugin which I'm not sure is feasible with Vim's ecosystem.

I think we should start simple for the initial builtin Treesitter plugin. Maybe the first iteration should have:

  • Async parsing
  • Syntax highlighting
  • Provided functions for for foldexpr, indentexpr
  • Utility functions (execute queries, visualize AST tree, ...)

Performance optimizations/other stuff can come later. This should be enough for most users


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/c3648357089@github.com>

Christian Clason

unread,
Dec 12, 2025, 5:30:31 PMDec 12
to vim/vim, Subscribed
clason left a comment (vim/vim#18869)

I read somewhere that nvim-treesitter provides precompiled artifacts of parsers and uses those

You read that wrong. Long-term, the answer is WASM, but that is not yet feasible today. (Again, it's not like other editors haven't been working on this for 5+ years.)

I think we should start simple for the initial builtin Treesitter plugin. Maybe the first iteration should have:

I think you need to focus first and foremost on (efficiently) handling "language trees", i.e., injections (which is arguably the biggest selling point for tree-sitter over other highlighting solutions.)


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/c3648367188@github.com>

Foxe Chen

unread,
Dec 12, 2025, 9:45:50 PMDec 12
to vim/vim, Push

@64-bitman pushed 2 commits.

  • 1c0e33e more opaque type tests
  • e553ca0 build treesitter library using src/Makefile

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/before/84e7297b8a50f94c95f7b2c12a50a987cfbb9638/after/e553ca072fc71bf0cfd47b26e2685da5c7039682@github.com>

Foxe Chen

unread,
Dec 13, 2025, 11:10:55 PMDec 13
to vim/vim, Push

@64-bitman pushed 32 commits.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/before/e553ca072fc71bf0cfd47b26e2685da5c7039682/after/e45b9016cff354a3c6585bc9419651105153e406@github.com>

Foxe Chen

unread,
Dec 14, 2025, 12:55:14 AMDec 14
to vim/vim, Push

@64-bitman pushed 3 commits.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/before/e45b9016cff354a3c6585bc9419651105153e406/after/04be69fe63f70232d68185be7b265c1fa04cc90a@github.com>

Foxe Chen

unread,
Dec 14, 2025, 12:56:15 AMDec 14
to vim/vim, Push

@64-bitman pushed 1 commit.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/before/04be69fe63f70232d68185be7b265c1fa04cc90a/after/30d1dcac139bcaaeba2998bd6098949f92fcc224@github.com>

Foxe Chen

unread,
Dec 14, 2025, 2:00:15 AMDec 14
to vim/vim, Push

@64-bitman pushed 1 commit.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/before/30d1dcac139bcaaeba2998bd6098949f92fcc224/after/87e8133034874511d9dca2ee6decf4050eb6ab7a@github.com>

Foxe Chen

unread,
Dec 14, 2025, 1:40:39 PM (14 days ago) Dec 14
to vim/vim, Push

@64-bitman pushed 1 commit.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/before/87e8133034874511d9dca2ee6decf4050eb6ab7a/after/52dde4e3b2d58ea3569fec2bff1ca44980bae8e8@github.com>

D. Ben Knoble

unread,
Dec 14, 2025, 5:27:59 PM (14 days ago) Dec 14
to vim/vim, Subscribed
benknoble left a comment (vim/vim#18869)

Can we make tree-sitter a submodule? That might simplify vendoring changes (and makes it easier to verify this PR isn't sneaking in a close-but-not-actually tree-sitter source file that turns out to be some kind of backdoor or whatever).


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/c3652319807@github.com>

Christian Clason

unread,
Dec 14, 2025, 5:30:25 PM (14 days ago) Dec 14
to vim/vim, Subscribed
clason left a comment (vim/vim#18869)

Have you looked at the tree-sitter repository? Let that man cook, sheesh.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/c3652321420@github.com>

D. Ben Knoble

unread,
Dec 14, 2025, 5:57:17 PM (14 days ago) Dec 14
to vim/vim, Subscribed
benknoble left a comment (vim/vim#18869)

Have you looked at the tree-sitter repository? Let that man cook, sheesh.

I don't follow: I assume this was in reply to my comment, but I'm not sure what I'm supposed to get from this.

A brief glance at tree-sitter/tree-sitter didn't cause anything to jump out, except maybe that we're only taking the relevant part of the tree-sitter code (which is admittedly hard to do in an easy-to-verify way with Git).


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/c3652343042@github.com>

Foxe Chen

unread,
Dec 14, 2025, 6:16:44 PM (14 days ago) Dec 14
to vim/vim, Push

@64-bitman pushed 1 commit.

  • 923cbae refactor tsparser_parse_buf()

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/before/52dde4e3b2d58ea3569fec2bff1ca44980bae8e8/after/923cbaeb4e6a4843fe038d50a2946befeee0245e@github.com>

Foxe Chen

unread,
Dec 14, 2025, 7:25:07 PM (14 days ago) Dec 14
to vim/vim, Subscribed
64-bitman left a comment (vim/vim#18869)

Can we make tree-sitter a submodule? That might simplify vendoring changes (and makes it easier to verify this PR isn't sneaking in a close-but-not-actually tree-sitter source file that turns out to be some kind of backdoor or whatever).

The same could be said for the xdiff dependency we have. I don't think a submodule is necessary, since its just a matter of copying the library source files from a Tree-sitter release tar into the src/treesitter. Additionally, the Tree-sitter Makefile doesn't seem to work with BSD make, so I had to use our src/Makefile


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/c3652439569@github.com>

Foxe Chen

unread,
Dec 14, 2025, 7:57:37 PM (14 days ago) Dec 14
to vim/vim, Push

@64-bitman pushed 1 commit.

  • 5ffaeda refactor tsparser_parse_buf()

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/before/923cbaeb4e6a4843fe038d50a2946befeee0245e/after/5ffaeda5884d69a47c2a3f83ca7a15b1404fe2e2@github.com>

Foxe Chen

unread,
Dec 14, 2025, 11:32:58 PM (13 days ago) Dec 14
to vim/vim, Push

@64-bitman pushed 2 commits.

  • 133aafa refactor ts_query_cursor_next_match
  • c6fec05 add ts_query_cursor_remove_match

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/before/5ffaeda5884d69a47c2a3f83ca7a15b1404fe2e2/after/c6fec055d0fa93a8befb7fa97758df0a8988803e@github.com>

Foxe Chen

unread,
Dec 14, 2025, 11:55:58 PM (13 days ago) Dec 14
to vim/vim, Push

@64-bitman pushed 1 commit.

  • 983e21d add ts_query_cursor_remove_match

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/before/c6fec055d0fa93a8befb7fa97758df0a8988803e/after/983e21d17e403c200077f87c182ffce36e4be2ec@github.com>

Foxe Chen

unread,
Dec 14, 2025, 11:56:13 PM (13 days ago) Dec 14
to vim/vim, Push

@64-bitman pushed 1 commit.

  • b4d3b92 add ts_query_cursor_remove_match

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/before/983e21d17e403c200077f87c182ffce36e4be2ec/after/b4d3b92b7edfa7e186a37b705f90cceba1731133@github.com>

Foxe Chen

unread,
Dec 14, 2025, 11:57:17 PM (13 days ago) Dec 14
to vim/vim, Push

@64-bitman pushed 1 commit.

  • de3179e add ts_query_cursor_remove_match

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/before/b4d3b92b7edfa7e186a37b705f90cceba1731133/after/de3179e1bc650eb216c467b923b11357528bc218@github.com>

Foxe Chen

unread,
Dec 15, 2025, 12:20:41 AM (13 days ago) Dec 15
to vim/vim, Push

@64-bitman pushed 1 commit.

  • 19a8216 add tsquerymatch_get_capture()

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/before/de3179e1bc650eb216c467b923b11357528bc218/after/19a8216081e2843c8b75219c8bd359db3cd31b2e@github.com>

Foxe Chen

unread,
Dec 15, 2025, 12:27:53 AM (13 days ago) Dec 15
to vim/vim, Push

@64-bitman pushed 1 commit.

  • 0502d02 refactor tsquerycursor_next_capture

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/before/19a8216081e2843c8b75219c8bd359db3cd31b2e/after/0502d02abdbb511000cea508c0ebc7852bd80e38@github.com>

Foxe Chen

unread,
Dec 15, 2025, 12:31:19 AM (13 days ago) Dec 15
to vim/vim, Push

@64-bitman pushed 0 commits.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/before/0502d02abdbb511000cea508c0ebc7852bd80e38/after/19a8216081e2843c8b75219c8bd359db3cd31b2e@github.com>

Foxe Chen

unread,
Dec 15, 2025, 12:37:11 AM (13 days ago) Dec 15
to vim/vim, Push

@64-bitman pushed 1 commit.

  • 5b2d010 refactor tsquerycursor_next_capture

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/before/19a8216081e2843c8b75219c8bd359db3cd31b2e/after/5b2d0108063e73796192fa5fb651791e544eb028@github.com>

Foxe Chen

unread,
Dec 15, 2025, 12:42:07 AM (13 days ago) Dec 15
to vim/vim, Push

@64-bitman pushed 0 commits.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/before/5b2d0108063e73796192fa5fb651791e544eb028/after/de3179e1bc650eb216c467b923b11357528bc218@github.com>

Foxe Chen

unread,
Dec 15, 2025, 1:10:27 AM (13 days ago) Dec 15
to vim/vim, Push

@64-bitman pushed 1 commit.

  • 85ca832 return false for value comparisons of tsquerymatch

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/before/de3179e1bc650eb216c467b923b11357528bc218/after/85ca83267385dfb162b38ec119f9767280102c0f@github.com>

Christian Clason

unread,
Dec 15, 2025, 5:39:54 AM (13 days ago) Dec 15
to vim/vim, Subscribed
clason left a comment (vim/vim#18869)

Note that there are version compatibility constraints between the tree-sitter library and the tree-sitter CLI used to generate the individual parsers. This effectively prevents you from fully vendoring the code. And compared to xdiff, tree-sitter is still under heavy development and will see breaking changes.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/c3654943603@github.com>

James McCoy

unread,
Dec 15, 2025, 12:22:57 PM (13 days ago) Dec 15
to vim/vim, Subscribed
jamessan left a comment (vim/vim#18869)

Would you agree to bundling the treesitter library in repo? Treesitter packages for non rolling linux distros are too old (treesitter development moves fast)

I don't see how "treesitter packages on old distro releases are old" leads to "bundle treesitter in Vim's repo". Vim packages are also old on old distro releases. If someone wants to build a newer Vim there, then they can do the work to also build the new Vim's dependencies.

Bundling a third-party dependency shouldn't be a light decision. It's fine to say "Vim depends on this specific range of versions for dependency X" and let packagers figure out how to do that. Don't try to solve their problem for them by bundling the code in Vim.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/c3656784113@github.com>

Foxe Chen

unread,
Dec 15, 2025, 1:05:23 PM (13 days ago) Dec 15
to vim/vim, Subscribed
64-bitman left a comment (vim/vim#18869)

@chrisbra What do you think? I'm fine with either way


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/c3656935904@github.com>

Foxe Chen

unread,
Dec 15, 2025, 1:28:01 PM (13 days ago) Dec 15
to vim/vim, Push

@64-bitman pushed 1 commit.

  • 3b40767 update tsquerymatch equal func

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/before/85ca83267385dfb162b38ec119f9767280102c0f/after/3b40767dbf357bfab2473928ccb44ff752870d22@github.com>

BenYip

unread,
Dec 15, 2025, 1:28:18 PM (13 days ago) Dec 15
to vim/vim, Subscribed
bennyyip left a comment (vim/vim#18869)

Maybe we can handle it the same way as libsodium. For Linux user, they can use liblibtree-sitter.so from package manager. And for Windows user, we bundle it in https://github.com/vim/vim-win32-installer.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/c3657022018@github.com>

Christian Brabandt

unread,
Dec 15, 2025, 2:37:07 PM (13 days ago) Dec 15
to vim/vim, Subscribed
chrisbra left a comment (vim/vim#18869)

If possible, we should avoid vendoring tree-sitter into Vim. It is a lot of code, and I do not want to take on responsibility for maintaining it here - especially from a security perspective, since it is a fast-moving target and I already have plenty to do for Vim. Instead, we should keep this modular and have the configure script detect (or point) and link against an installed tree-sitter.
I guess we have to find out how to do this for Windows, but we had to do the same for libsodium back then. We don't have to solve everything at once.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/c3657278773@github.com>

Foxe Chen

unread,
Dec 15, 2025, 2:44:04 PM (13 days ago) Dec 15
to vim/vim, Push

@64-bitman pushed 1 commit.

  • d093839 Revert "add treesitter library in-tree"

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/before/3b40767dbf357bfab2473928ccb44ff752870d22/after/d0938391bf75d518dcab76dd040b9b5170c63fd7@github.com>

Foxe Chen

unread,
Dec 15, 2025, 11:20:58 PM (12 days ago) Dec 15
to vim/vim, Push

@64-bitman pushed 2 commits.

  • 1c676e4 temp
  • 2d3a83c make captures property of tsquerymatch return dict

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/before/d0938391bf75d518dcab76dd040b9b5170c63fd7/after/2d3a83ca684cc483b138ae9d2d10ee1fafef732e@github.com>

Foxe Chen

unread,
Dec 15, 2025, 11:54:46 PM (12 days ago) Dec 15
to vim/vim, Push

@64-bitman pushed 1 commit.

  • 6ac6222 make captures property of tsquerymatch return dict

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/before/5a7760f5dfe8db7b7a3b6277a927ce32025136ca/after/6ac622207e43cda9d451647f089b21bb7147c477@github.com>

Foxe Chen

unread,
Dec 16, 2025, 12:49:06 AM (12 days ago) Dec 16
to vim/vim, Push

@64-bitman pushed 1 commit.

  • 3ff4a05 use tuple for tsquery_inspect patterns entry instead of dict

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/before/6ac622207e43cda9d451647f089b21bb7147c477/after/3ff4a055b551cc1bf047c4aa303bb9a543c4f3e3@github.com>

D. Ben Knoble

unread,
Dec 16, 2025, 12:38:01 PM (12 days ago) Dec 16
to vim/vim, Subscribed
benknoble left a comment (vim/vim#18869)

(PS: I know most PRs get squashed here, so what I'm about to say is largely moot for the final result. It might be helpful for 64-bitman and collaborators as they develop anyway.

Reverting the vendor commit still requires Git to keep around all the object files corresponding to that code. By contrast, if the branch is rewritten so that the vendor commit never appears in the first place, Git can throw those objects away from local copies and they won't be present in new fetches or clones. It also keeps history cleaner for projects that don't squash.)


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/c3661666424@github.com>

Foxe Chen

unread,
Dec 16, 2025, 7:21:19 PM (12 days ago) Dec 16
to vim/vim, Push

@64-bitman pushed 43 commits.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/before/102a44e513d4bd47c8d60e121d1d05a1d41b42a1/after/be66adf0521038f734ab210cc13d053eaf8731f5@github.com>

Foxe Chen

unread,
Dec 25, 2025, 4:05:55 PM (3 days ago) Dec 25
to vim/vim, Push

@64-bitman pushed 43 commits.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/before/be66adf0521038f734ab210cc13d053eaf8731f5/after/4dcf7b92cfe16a9ebd2075b7f7fda6b8cc8d745d@github.com>

Foxe Chen

unread,
Dec 25, 2025, 11:15:13 PM (2 days ago) Dec 25
to vim/vim, Push

@64-bitman pushed 2 commits.

  • b64476f add timeout to tsquerycursor_exec
  • 485719e add tsparser_parse_string()

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/before/4dcf7b92cfe16a9ebd2075b7f7fda6b8cc8d745d/after/485719e78e0da3e9625ae1d2c4a83b5034166a08@github.com>

Foxe Chen

unread,
Dec 26, 2025, 12:09:24 AM (2 days ago) Dec 26
to vim/vim, Push

@64-bitman pushed 1 commit.

  • 675717d add ts_language_is_loaded()

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/before/485719e78e0da3e9625ae1d2c4a83b5034166a08/after/675717d04109bf17b2368c948a7b5eda8dcfd95d@github.com>

Foxe Chen

unread,
Dec 26, 2025, 12:54:42 AM (2 days ago) Dec 26
to vim/vim, Push

@64-bitman pushed 1 commit.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/before/675717d04109bf17b2368c948a7b5eda8dcfd95d/after/8e43c2f3e223d93ebd632cee5a5f92c426f1778c@github.com>

Foxe Chen

unread,
Dec 26, 2025, 1:08:33 AM (2 days ago) Dec 26
to vim/vim, Push

@64-bitman pushed 1 commit.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/before/8e43c2f3e223d93ebd632cee5a5f92c426f1778c/after/65506957929055d887b33ece9d39b1d2d46181dd@github.com>

Foxe Chen

unread,
Dec 26, 2025, 1:59:03 AM (2 days ago) Dec 26
to vim/vim, Push

@64-bitman pushed 1 commit.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18869/before/65506957929055d887b33ece9d39b1d2d46181dd/after/0a94459fe2758eaa3f6a1be75bacd8a465158a75@github.com>

It is loading more messages.
0 new messages