vscode: SCSS follow link resolves wrong path (prefixes base with underscore)
- VSCode Version: 1.27.1
- OS Version: Win10x64
Steps to Reproduce:
Does this issue occur when all extensions are disabled?: Yes Insiders?: Yes
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 47
- Comments: 49 (10 by maintainers)
Commits related to this issue
- SCSS fs provider. Fix microsoft/vscode#58204 — committed to microsoft/vscode-css-languageservice by octref 5 years ago
- SCSS fs provider. Fix microsoft/vscode#58204 — committed to microsoft/vscode-css-languageservice by octref 5 years ago
I’ll fix this with a dynamic resolver. Previously there’s no
fsaccess from css language service, as it needs to be usable in Monaco.Here’s my plan:
-causing inconsistent behavior is a bug. I’ll fix that with @BPScott’s PR.acould resolve to eithera.scss,_a.scssora/index.scssora/_index.scss(dynamic link)_acould only resolve to_a.scss(static link)a.scssora.css, resolve without guessing the alternative such as_a.scss(static link)please fix it 😐
(Experimental duplicate detection) Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:
that seems like a stretch. VSCode is by no means useless for frontend developers with this bug.
Lets try to keep the hyperbole down to a believable level. Is the bug annoying? yes. Can it be worked around? also yes.
Ctrl + Pthen type in the file name.I would be awesome if this were fixed, though, as it is a major annoyance at the very least.
Another simple problem in VSCode that is not fixed by the team. VSCode need a task force for several small big problems in the editor.
@Fubuchi that extension does not work as a work-around. I have that extension installed and it doesn’t help for alleviating this issue.
i seem to be having the opposite problem.
my scss:
my filename:
error:
notice, the
_is not being added as it should be.Is there an alternative extension available? This makes Visual Code useless for frontend developers.
Currently, use this extension as a work-around : https://marketplace.visualstudio.com/items?itemName=mrmlnc.vscode-scss
It can jump to variable in other files.
Not only partials allowed to be imported From sass documentation
Partials are only special case of imports:
@nathanredblur It seems that problem is in this function: toScssPartialUri As I’ve mentioned in my duplicate of this issue #65078, behavior is different, when “-” symbol is present in file name. And this regex
/\/(\w+)(.scss)?$/gmonly accepts letters.https://github.com/microsoft/vscode-css-languageservice/pull/159 should fix the inconsistency where
@import './foobar'resolves to to_foobar.scsswhile@import './foo-barresolves tofoo-bar. Once that is merged then filenames containing non-alphanumeric charachers (like hypens) shall also be prefixed with an underscore and get their extension too.It doesn’t solve the underlying problem of VScode assuming the convention of “Sass files that are only meant to be imported, not compiled on their own, begin with _ (as in _code.scss)” rather than following the import spec but at least it makes that behaviour more consistent.
@vedmant There’s now (some) support for paths starting with
~: https://github.com/microsoft/vscode/pull/70693@octref could this finally be fixed? 🙁
ok, I understand the point, but will be easier just let vcode read the filename exactly how it is.
In case anybody is looking to implement, here’s the spec for resolving @imports in sass: https://github.com/sass/sass/blob/master/spec/at-rules/import.md
still listening this issue -_-
i was import bem-constructor
@import 'bem-constructor';my file name
_bem-constructor.scssget an error
Unable to open 'bem-constructor': File not found (file:///home//www/template/src/sass/bem-constructor).That’s because of dash “-”. There us an issue in regex, any non letter symbol in filename breaks resolver
nop isn’t fixed, in insider linux version didn’t work. If file is _varables.scss, editor look for __varables.scss … it’s more than boring!
@kasvtv then it’s an issue with
sass-loader, isn’t it? Absolute import in SASS requires the forward slash, it’s in the CSS specs that SASS conforms to.@import "foo";is relative and same as@import "./foo";@import "/foo";is absoluteSame problem for me, I have a master.scss that only does multiples
@import "...", the autocompletion works but the go to click doesn’t. The most weird part is that it works in some case and not in others :@import "components/header.scss"=> Works@import "pages/home.scss"=> Works@import "base/icons.scss"=> Doesn’t work, it tries to findbase/_icons.scss. For everything inside mybasefolder when I try to use the go to on click it search for the file with the underscore name…Is there any way to make it just go to what is written, just follow the path in any case ?