0.6.37 • Published 9 months ago

css-variable-ls v0.6.37

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

CSS Variable Langauage Server

I did no actual work on this language server. I just extracted the language server Vu Nguyen created for CSS Variables Autocomplete and adapted it for my use case. All credit goes to Vu Nguyen.

Installation

npm i -g css-variable-ls

Setup

    if not configs.cssvar then
        configs.cssvar = {
            default_config = {
                cmd = { "cssvar", "--stdio" },
                filetypes = { "css", "scss", "less" },
                root_dir = lsp.util.root_pattern("package.json", ".git"),
                single_file_support = true,
                settings = {
                    cssVariables = {
                        lookupFiles = {
                            "**/*.css",
                            "**/*.scss",
                            "**/*.sass",
                            "**/*.less",
                        },
                    },
                },
            },
            docs = {
                default_config = {
                    root_dir = [[root_pattern("", ".git") or bufdir]],
                },
            },
        }
    end
    lsp.cssvar.setup({
    ...
        on_new_config = function(_, root_dir)
            local client = vim.lsp.get_active_clients({ name = "cssvar" })[1]
            local path = util.path.join(root_dir, ".luarc.json")
            if util.path.exists(path) == false then
                return
            end
            local f = assert(io.open(path, "r")) -- assuming path is in the scope
            local content = f:read("*a")
            f:close()
            local config = vim.json.decode(content)
            if config == nil or config["cssVariables"] == nil then
                return
            end
            if client == nil then
                return
            end
            client.notify(
                "workspace/didChangeConfiguration",
                { settings = {
                    cssVariables = config["cssVariables"],
                } }
            )
        end,
        ...
    })
0.6.37

9 months ago

0.6.36

9 months ago

0.6.35

9 months ago

0.6.34

9 months ago

0.6.33

9 months ago

0.6.32

9 months ago

0.6.31

9 months ago

0.6.30

9 months ago

0.6.29

9 months ago

0.6.28

9 months ago

0.6.27

9 months ago

0.6.26

9 months ago

0.6.25

9 months ago

0.6.24

9 months ago

0.6.23

9 months ago

0.6.22

9 months ago

0.6.21

9 months ago

0.6.20

9 months ago

0.6.19

9 months ago

0.6.18

9 months ago

0.6.17

9 months ago

0.6.16

10 months ago

0.6.15

10 months ago

0.6.14

10 months ago

0.6.13

10 months ago

0.6.12

10 months ago

0.6.11

10 months ago

0.6.10

10 months ago

0.6.9

10 months ago

0.6.8

10 months ago

0.6.7

10 months ago

0.6.6

10 months ago

0.6.5

10 months ago

0.6.4

10 months ago

0.6.3

10 months ago

0.6.2

10 months ago

0.6.1

10 months ago

0.6.0

10 months ago

0.5.29

10 months ago

0.5.28

10 months ago

0.5.27

10 months ago

0.5.26

10 months ago

0.5.25

10 months ago

0.5.24

10 months ago

0.5.23

10 months ago

0.5.22

10 months ago

0.5.21

10 months ago

0.5.20

10 months ago

0.5.19

10 months ago

0.5.18

10 months ago

0.5.10

10 months ago

0.5.8

10 months ago

0.5.6

10 months ago

0.5.5

10 months ago

0.5.4

10 months ago

0.5.2

10 months ago

0.5.1

10 months ago

0.5.0

10 months ago

0.4.0

10 months ago

0.1.2

10 months ago

0.1.0

10 months ago

2.6.2

10 months ago