Open wkillerud opened 3 months ago
As mentioned in https://github.com/wkillerud/some-sass/issues/186#issuecomment-2256681536, there are workarounds:
Ok, I can confirm that without the quotes it shows suggestions and with quotes using crtl + space
works.
I may have found something else related to this issue/bug.
If I want to include a mixin from another file with the @include
rule it works, for example:
@use './test' as test;
@include test. // shows the existing mixins
But if I want to use a function or variable in a mixin from an @include
rule, it won't work, for example:
// _test.scss
@function name() {
@return 'Some Sass';
}
// _index.scss
@use './test' as test;
// works correctly here, but it only shows existing mixins
// it should show the variable $name and the function name()
@include test.hello(test.name());
This conflict seems to be related to the fact that it only expects mixin since the line includes a @include
rule. This raises another issue related to what it shoud display depending on the context in which it is used. For example:
// _index.scss
// work with the ctrl + space, but it shows everything, even mixins?
$test: "#{test.hello()}";
// works correctly here, but it shows everything, even mixins?
#{test.selector()} {
width: 100%;
}
The repository is up to date with all of this.
Thanks @MenSeb, the bug of variables and functions not being suggested as mixin parameters is fixed in 3.3.0.
works correctly here, but it shows everything, even mixins?
I don't see mixins in my code suggestions there. There are two suggestions for hello
, but both of them are for the function (one with, and one without parameters).
Thanks @wkillerud it works perfectly!
I don't see mixins in my code suggestions there. There are two suggestions for
hello
, but both of them are for the function (one with, and one without parameters).
My apologies, I may have confused functions with mixins at that moment, I can't reproduce what I pointed out.
I may have something else to add, I don't think it as a bug, but rather a feature that could be implemented. It is related to code suggestion, would you rather have a new issue for that or should I continue here? (I am updating the repo right now)
It does behave differently in some situation, I don't know if it is related to the extension tho.
The suggestions won't show what was forwarded from a sass package.
// _sass.scss
@use 'sass:meta';
@function is-number($value) {
@return meta.type-of($value) == number;
}
// _test.scss
@forward 'pkg:sass-true';
@forward 'sass:meta';
@forward './sass';
// index.scss
@use './test' as test;
// The custom logic is forwarded and shows suggestions
@debug test.is-number(10);
// The package pkg:sass-true is forwarded and shows suggestions
@debug test.$catch-errors;
// The package sass:meta is forwarded but it won't shows suggestions
@debug test.type-of('string');
The repo is up to date, please let me know if you wish to open a new issue for that.
The suggestions won't show what was forwarded from a sass package.
Interesting, I hadn't considered that case 😄 The completions for sass built-ins get added here, but only if they are @use
d in the current document.
I'll take a look at adding support for @forward
in this case.
No need for a new issue this time, but if you find something else it would be great if you opened a new issue – easier for me to keep track that way 👍
Edit: fixed in 3.4.0
I came up with this case while trying to forward "enhanced" sass modules with more utilities added to them haha
It works like a charm, thank you so much for your time and development :)
About VS Code Version: 1.91.1 (Universal) Commit: f1e16e1e6214d7c44d078b1f0607b2388f29d729 Date: 2024-07-09T22:07:54.982Z Electron: 29.4.0 ElectronBuildId: 9728852 Chromium: 122.0.6261.156 Node.js: 20.9.0 V8: 12.2.281.27-electron.0 OS: Darwin arm64 23.5.0
Reproducible Case: https://github.com/MenSeb/some-sass-bug/commit/48d7175c264b08107e7be8a9ed2566a5bc0af691
Steps to Reproduce:
index.scss
$test: "#{test.hello()}"
) the interpolation should show code completions once you finish typing"#{
.Investigating in #186, it seems like VS Code does not send
onCompletion
requests even if we last responded withisIncomplete = true
set on the result.