wkillerud / some-sass

Improved support for SCSS, Sass indented and SassDoc. Workspace awareness and full support for Sass modules.
https://wkillerud.github.io/some-sass/
60 stars 6 forks source link

Add options to include suggestions for variables, mixins and functions defined globally #267

Open niksy opened 5 days ago

niksy commented 5 days ago

In which editor is this a problem?

N/A

Describe the bug

There are projects which haven’t fully switched to Sass modules system and use approach where every variable, mixin and function is defined globally, usually using bundler functionality such as injecting imports (e.g. additionalData in Vite).

Currently there isn’t a way where you can say "give me results from these imports every time you query and process Sass file with language server", something like completion.includeFromCurrentDocument but for specific documents.

What's the expected result?

Defining list of imports where language server can query for global values for variables, mixins and functions.

Link to minimal reproducible example

No response

Participation

wkillerud commented 4 days ago

In case you missed it, there is the completion.suggestFromUseOnly setting which is false by default. With that, as long as the Sass file is in the workspace, functions variables and mixins from it should be suggested.

using bundler functionality such as injecting imports (e.g. additionalData in Vite).

I've not used that before myself. In this case, is it configured as in the example – a string in the Vite config file?

I'm wary of adding features to the language server that is not ultimately based on Sass code as files. If we add an option similar to additionalData we now have symbols that don't work with Go to Definition, can't be renamed, would need some kind of special handling in Find all references. We have some of that already with Sass built-in modules, and it complicates things 😅

Perhaps Sublime Text's completion files can work for you here?