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 options to include suggestions for variables, mixins and functions defined globally #267

Open
1 task
niksy opened this issue Nov 14, 2024 · 1 comment

Comments

@niksy
Copy link
Contributor

niksy commented Nov 14, 2024

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

  • I am willing to submit a pull request for this issue.
@wkillerud
Copy link
Owner

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?

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

No branches or pull requests

2 participants