Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for lua #180

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Add support for lua #180

wants to merge 1 commit into from

Conversation

jessebot
Copy link
Contributor

@jessebot jessebot commented Dec 18, 2022

I'm not sure if I'm supposed to have the Comment and String there, but happy to remove it if needed.

Thanks for maintaining this project!

@ap
Copy link
Owner

ap commented Dec 24, 2022

I'm not sure if I'm supposed to have the Comment and String there

As far as I can see the Lua syntax is not defining any match or region or keyword directly on Comment or String, so the answer would be no.

this plugin is incompatible with treesitter

I do want to look into that at some point and see if it’s possible to make it cooperate with treesitter. But I don’t use NeoVim so it’s somewhere on the back burner.

I can't find anything like vim-css-color in the neovim community yet, so I still pop back over to vim, mostly to use this plugin

Wow, thank you. That is incredibly high praise.

The alternatives are still either non-functional or very slow, so even though I try to give lots of projects a shot, I always come back to this one 💙

Once more, thank you.

Unfortunately after all that praise I’m going to have to disappoint you… because your request happens to concern Lua. 🙁

The plugin in fact used to have Lua support. However, I had to drop it (81ce955):

At the time of this writing, the Lua syntax defines its regions in terms of contains=ALLBUT, which is impossible to cooperate with.

Looking at the Lua syntax again right now, it is still designed the same way (though it just recently switched from ALLBUT to TOP, which is less bad, but is also an “include every group except” kind of directive, and therefore still problematic in the same way).

Now looking back at it with more experience (but also without the benefit of having had my head in the codebase recently), I think it’s not impossible to cooperate with the syntax – just a lot more work than for “normal” ones. Namely, the after/syntax/lua.vim needs to have a bunch of commands to add the CSS Color syntax groups to (almost?) every ALLBUT/TOP Lua syntax group. Something like that. I think. (And this would be a moving target. Any time the Lua syntax is updated upstream, the CSS Color support for it may have to be updated to match. Annoying.)

So the Lua support as submitted is incomplete – so I can’t ship it in CSS Color without the extra work.

I don’t know if you can or want to tackle that yourself or if you’d have to wait for me. But if you haven’t seen or don’t mind the shortcomings yourself, you don’t need to wait and don’t have to patch the plugin: you can just put the file from your PR into ~/.vim/after/syntax/lua.vim and just use it as part of your personal config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants