vigoux / tree-sitter-viml

Tree-sitter parser for VimL
MIT License
74 stars 22 forks source link

Highlighting seems broken #45

Open arafatamim opened 2 years ago

arafatamim commented 2 years ago

It looks like the syntax highlighting in some parts of the file got messed up. Changing the color scheme doesn't fix it, and I've no idea if this was caused by an update or another plugin. Here are some examples:

image image image

I'm running the release Neovim version 0.6.0-1 on Linux.

Fymyte commented 2 years ago

If you have treesitter playground, you should check the tree but I am pretty sure it is due to some parsing errors (due to this parser and not your file). I don't think the colon are supported in autocmd (again just on this parser) and that's probably the issue with the first file.

vigoux commented 2 years ago

The colon seems to be a problem indeed. I am going to add some checks for that and correctly support it.

heralden commented 2 years ago

I have noticed some oddities as well:

Here filetype breaks the highlighting.

2022-01-15-154615_250x120_scrot

Here colorscheme breaks the highlighting.

2022-01-15-154638_414x75_scrot

Fymyte commented 2 years ago

@vigoux Do you think you can add those issues in the project todos ? I really like the parser and want to help and I think having a nice organized list of things would help me a lot to know from where to start.

vigoux commented 2 years ago

Yep, I can do that. Could you join the nvim-treesitter Zulip so that we can chat together too @Fymyte ?

Fymyte commented 2 years ago

For a quick follow up, support for colon before command has been added in commit 3b69c99

BlueDrag0n commented 2 years ago

Hello,

I've have the same problem when it comes to highlighting:

image

image

vigoux commented 2 years ago

This should have been fixed in latest master. I'll be adding a few test cases just to be sure.

jdrouhard commented 2 years ago

@BlueDrag0n Most built-in vim commands aren't understood by the parser yet. Most of the tab, buffer, window, and tag related commands aren't understood (like :tabn[ext] :tabp[revious] :bn[ext] :bp[rev] :sp[lit] :vert[ical] etc).

@vigoux Is this something that's on your radar? Do you think the parser should explicitly support every known built-in command or should there be a "fallback" rule that will match :[a-zA-Z0-9]+ and assume there are no args if its not a command explicitly supported?

vigoux commented 2 years ago

That's a good question. In an earlier version, the parser parsed unknown commands as some kind of "default" command with "sane" parsing.

Unfortunately, nothing is simple with VimL, and it ended up not working at all in most cases, leading to messed up ASTs in many cases.

That was a long time ago though, so it might be good to reconsider this, so that we make integration of the parser easier for the end users.

vigoux commented 2 years ago

vertical has been added in latest master.

We still miss buffer and tab related commands.