sassneovim

Neovim Scss variables - go to definition


Is there a way I can goto definition (gd) when my cursor is on scss variable?

I know i can grep with telescope but that’s not what i want.

I have nvim cmp (kickstart nvim) and cssls language server installed.

Filetype is correctly recognized as scss and cssls is attached to the buffer.

Tried some cmp plugins …


Solution

  • Just configured "Some Saas" (this is the name of the project). GoTo definition is working but not for everything. I suspect this is due to the fact that the same variable is declared several times.

    Make sure to turn off (or not to turn on) any other LSP for scss: https://wkillerud.github.io/some-sass/language-server/getting-started.html

    The LSP is sutable for working with css also, so you may use "Some Saas" for .css instead of cssls.

    How to configure:

    1. Install the lsp:
    npm install --global some-sass-language-server
    
    1. Install https://github.com/neovim/nvim-lspconfig
    2. Add this line to start the LSP (I've put it into ~/.config/nvim/after/plugin/lspconfig.lua
    local lspconfig = require("lspconfig")
    lspconfig.somesass_ls.setup({
        filetypes = { "sass", "scss", "less", "css" },
    })
    
    1. Restart neovim