[vim/vim] tree-sitter rendering in vim like what it is in neovim. (Issue #12508)

764 views
Skip to first unread message

sloppydevil

unread,
Jun 9, 2023, 1:54:50 AM6/9/23
to vim/vim, Subscribed

the only reason I change temporarily to neovim is tree-sitter syntax highlight.

Can there be a incremental syntax highlight there, so that I can see updated highlight in time?

thx so much.


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

Christian Brabandt

unread,
Jun 9, 2023, 4:14:34 AM6/9/23
to vim/vim, Subscribed

I think this is part of the larger proposal discussed at #9087


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/12508/1584161655@github.com>

Bram Moolenaar

unread,
Jun 9, 2023, 1:38:35 PM6/9/23
to vim/vim, Subscribed


> the only reason I change temporarily to neovim is tree-sitter syntax
> highlight.

Can you be specific about this? Is highlighting not supported for some
filetype? Does it work better for some filetype? If yes, then in what
way (faster, accuracy)?

> Can there be a incremental syntax highlight there, so that I can see
> updated highlight in time?

I suppose that's a question for Neovim.

--
hundred-and-one symptoms of being an internet addict:
138. You develop a liking for cold coffee.

/// Bram Moolenaar -- ***@***.*** -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/12508/1584930544@github.com>

sloppydevil

unread,
Jun 9, 2023, 8:36:12 PM6/9/23
to vim/vim, Subscribed

I'm editing typescript files, and there are currently about 10 files. one file if of code lines about 600. and my default color theme is dracula.

When I entered vim, sometimes head lines are not highlighted, e.g. the function names; and if i directly go to end of file pressing "G", the function names, keywords are for sure not highlighted.

I manually source $MYVIMRC, then the functions are highlighted; then scroll down, upcoming functions are highlighted too; but if I directly goto bottom of file, the functions are not highlighted.

I did similar thing for "yolo v5" repo, and went to "train.py" which also has about 600 lines' code, everything is good.

so it seems that this rendering lag exists in typescript?


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/12508/1585308025@github.com>

Bram Moolenaar

unread,
Jun 10, 2023, 2:01:23 PM6/10/23
to vim/vim, Subscribed


> I'm editing typescript files, and there are currently about 10 files.
> one file if of code lines about 600. and my default color theme is
> dracula.
>
> When I entered vim, sometimes head lines are not highlighted, e.g. the
> function names; and if i directly go to end of file pressing "G", the
> function names, keywords are for sure not highlighted.
>
> I manually source $MYVIMRC, then the functions are highlighted; then
> scroll down, upcoming functions are highlighted too; but if I directly
> goto bottom of file, the functions are not highlighted.
>
> I did similar thing for "yolo v5" repo, and went to "train.py" which
> also has about 600 lines' code, everything is good.
>
> so it seems that this rendering lag exists in typescript?

Most likely. If I understand you correctly, the typescript syntax in
Vim doesn't sync properly, while the treesitter implementation works
better. I believe treesitter parses the file from the start, thus that
would explain it.

You could force Vim to sync from the start:

:syntax sync fromstart

Give that a try.

--
hundred-and-one symptoms of being an internet addict:
145. You e-mail your boss, informing him you'll be late.

/// Bram Moolenaar -- ***@***.*** -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/12508/1585755754@github.com>

Lewis Russell

unread,
Jun 12, 2023, 5:22:10 AM6/12/23
to vim/vim, Subscribed

I believe treesitter parses the file from the start, thus that
would explain it.

Treesitter receives text edit events and is able to incrementally parse the tree. It only parses the full file on initial load.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/12508/1586940062@github.com>

Christian Brabandt

unread,
Jul 4, 2023, 8:57:17 AM7/4/23
to vim/vim, Subscribed

closing as dup of #9087


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/12508/1620202786@github.com>

Christian Brabandt

unread,
Jul 4, 2023, 8:57:19 AM7/4/23
to vim/vim, Subscribed

Closed #12508 as not planned.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issue/12508/issue_event/9721618140@github.com>

Reply all
Reply to author
Forward
0 new messages