nvim-colorizer.lua icon indicating copy to clipboard operation
nvim-colorizer.lua copied to clipboard

SCSS variable matching

Open h0adp0re opened this issue 3 years ago • 15 comments

Hello, would it be possible to implement something like this? https://github.com/norcalli/nvim-colorizer.lua/pull/22

h0adp0re avatar Sep 05 '22 16:09 h0adp0re

Yes, given i have to mostly copy the pr, but no eta.

Akianonymus avatar Sep 05 '22 16:09 Akianonymus

Alright, that would be cool to have. I am not in a hurry to have it, just good to know it can (and will) be done!

h0adp0re avatar Sep 05 '22 16:09 h0adp0re

Test and report

https://github.com/NvChad/nvim-colorizer.lua/pull/18

Akianonymus avatar Sep 09 '22 18:09 Akianonymus

Thanks, that was fast! Currently it seems the colors are only highlighted when they're defined in the same file. Sadly this is only a little useful when using imports – as one often does with sass. But maybe that could be done later in an incremental PR?

h0adp0re avatar Sep 09 '22 22:09 h0adp0re

Yes, i plan to add import support, just thinking how to actually implement it, because it's a big task, scanning other files, it can choke the editor.

Have to find an efficient way to scan imports.

Akianonymus avatar Sep 10 '22 01:09 Akianonymus

Done, imports should be working now along with recursive variables

Akianonymus avatar Sep 12 '22 11:09 Akianonymus

Yes, now they do work, thank you!

I'd hate to be a bother but when the colors come from a second-level import they are not highlighted. Only first-level imports work currently. If that explanation makes any sense?

h0adp0re avatar Sep 12 '22 22:09 h0adp0re

Yes, now they do work, thank you!

I'd hate to be a bother but when the colors come from a second-level import they are not highlighted. Only first-level imports work currently. If that explanation makes any sense?

Check now

Akianonymus avatar Sep 13 '22 08:09 Akianonymus

You've outdone yourself, thank you! I sadly am not qualified to review the PR but by my standards this issue is resolved.

h0adp0re avatar Sep 13 '22 10:09 h0adp0re

You've outdone yourself, thank you! I sadly am not qualified to review the PR but by my standards this issue is resolved.

Even i am not qualified to review, it got quite complicated. But thank you for testing. Will merge it soon.

Akianonymus avatar Sep 13 '22 11:09 Akianonymus

I have merged it to master.

Akianonymus avatar Sep 14 '22 06:09 Akianonymus

@h0adp0re @Akianonymus I know I'm two years late, but I'm struggling getting this highlighting working (scss variables and color functions). Can you guys spot anything weird with my config:

    {
        "catgoose/nvim-colorizer.lua",
        event = "BufReadPre",
        opts = {},
        config = function()
            local colorizer = require("colorizer")

            colorizer.setup({
                filetypes = { "css", "scss" },
                user_default_options = {
                    css = true,
                    mode = "background",
                    names = true,
                    RGBA = true,
                    RRGGBBAA = true,
                    sass = {
                        enable = true,
                        parsers = {
                            "css",
                        },
                    },
                },
            })
        end,
    },

Johnsoct avatar Jan 05 '25 19:01 Johnsoct

I'm not sure if the sass highlighting is working right now. I've tried to use git bisect to find where it was actually highlighting but I could never find a working commit. If you can find a commit where this is working (maybe it's a problem with how I was testing) I can try to get this working.

catgoose avatar Jan 05 '25 20:01 catgoose

@catgoose Right now, I just set enabled to false and I'm still getting all the highlighting I would get in a CSS file, so that's doable for now. I'm sorry, but I just don't have the bandwidth to contribute. I'll bookmark the issue to come back to it if I get any time.

Johnsoct avatar Jan 10 '25 00:01 Johnsoct

@catgoose Right now, I just set enabled to false and I'm still getting all the highlighting I would get in a CSS file, so that's doable for now. I'm sorry, but I just don't have the bandwidth to contribute. I'll bookmark the issue to come back to it if I get any time.

Thanks. I plan to get to this issue, but I'm trying to finish up a few other things first.

catgoose avatar Jan 10 '25 01:01 catgoose

any updates on this ?

felixzsh avatar Jul 14 '25 22:07 felixzsh