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

Feedback: Cannot resolve to SCSS partial files #49

Closed
mrmlnc opened this issue Jun 14, 2017 · 14 comments
Closed

Feedback: Cannot resolve to SCSS partial files #49

mrmlnc opened this issue Jun 14, 2017 · 14 comments
Assignees
Milestone

Comments

@mrmlnc
Copy link
Owner

mrmlnc commented Jun 14, 2017

Original issues:

@mrmlnc
Copy link
Owner Author

mrmlnc commented Jun 14, 2017

Okay, now I can offer you to try the new version of the extension. Now is beta, but I need feedback.

https://github.com/mrmlnc/vscode-scss/releases/tag/0.7.0

How to install:

  • Download .vsix file from release page
  • Open VS Code
  • F1 → Install extension from VSIX
  • Reload editor by button after install

@phifa
Copy link

phifa commented Jun 15, 2017

still only kind of works. variables show up, mixins only super slowly. i am using foundation with the foundation-cli

@mrmlnc
Copy link
Owner Author

mrmlnc commented Jun 15, 2017

@phifa, thanks for comment! I'll work on performance in the next version (the plugin will cache directories). Now we need to fix the working with imported files.

@mrmlnc mrmlnc self-assigned this Jun 15, 2017
@phifa
Copy link

phifa commented Jun 16, 2017

In more advanced setups, some scss imports might not be written with full path in the scss file itself. If included via webpack or gulp, etc. import paths could be in a *.js or *.yml file as well. Now wouldnt it make sense, if we could somehow tell the extension which include paths it needs to crawl in addition to the obvious scss folder/files? If you set up a new foundation site and transpile it via gulp, the import paths to the bower_components folder are directly in the gulp file for example.

@Christo44
Copy link

My issue was resolved by adding all my imports into one file, then importing that file into my html page.

_styles.scss:
@include _variables.scss
@include _fonts.scss

main.scss:
@include _styles.scss

and inside index.html linking main.min.css

I'll need to test further. One thing I do pickup in this release is that peeking into or using the go-to function defines most of the variable usages but scss reads from the VSCode history file in this example. _base.scss. If I exclude the history folder from vscode-scss the reference as you see in the link will be lost. So that means it's not reading _base.scss nor picking up every variable, which is odd

@Tiedye
Copy link

Tiedye commented Aug 21, 2017

Any updates on this issue?

@felixfbecker
Copy link

I also cannot get any IntelliSense for files I @imported, e.g. from node_modules, no matter how I specify the path.

@mrmlnc
Copy link
Owner Author

mrmlnc commented Feb 6, 2018

Just five words about the current status of this plugin.

Now I have finished working on a package that will speed up indexing of the project directory. I want to work on universal code-base for similar plugins (Less + SCSS) in the first half of this year. At the same time, I plan to solve most of the problems of both plugins.

Right now this point (the beginning of works) is written down in my road map for the middle of March or the beginning of April. In February, I need my time to a few higher priorities for me.

Sorry.

P.S. Maybe your problem were fixed in the non-published tag 0.7.0.

@phifa
Copy link

phifa commented Feb 8, 2018

Anybody else working with https://github.com/zurb/foundation-sites/ and experiencing the same issue with paths?

@nmsmith22389
Copy link

nmsmith22389 commented Oct 16, 2018

I'm also getting errors from importing partials. Please please please fix this.

In SCSS you are not required to include the underscore or extension in the file name when importing partials. (the underscore before a SCSS file indicates that it's a partial)

So when I import a file like this...

@import 'path/to/file';

Which is perfectly valid SCSS that imports the _file.scss file, the extension errors out because it's trying to look for file.scss instead of _file.scss.

That really sucks because partials are an important part of SCSS. If you could please include support for recognizing partials that are imported without the underscore and extension that would be a great help.


Just to clarify and sum up the problem, here is what needs to be changed...

Import Syntax Actual File Name Extension Checks Extension Should Check
path/to/file path/to/_file.scss path/to/file.scss path/to/_file.scss

@a7madgamal
Copy link

@nmsmith22389 It's funny because I have exactly the opposite of your reported issue :D
I do provide the relative path with underscore but ctrl-click and autocomplete don't work. but when I tried renaming the imported file to start with underscore and removed the underscore from the import statement it works!
not sure if ctrl-click is related to this adon or not though

@premitheme
Copy link

I'm using the beta version in #49 (comment)

  • When the plugin is disabled or uninstalled, if I cmd+click partial import without underscore it opens the partial file with no problems. If the import has underscore I get "File not found" error. So this is the default behaviour of VSCode.

  • When the plugin is installed and enabled, the same default behaviour applies for cmd+click imports, but when I hover a mixin in a file, it shows the mixin info popup but when I cmd+click the mixin it tries to open the wrong file (without underscore), and I get "File not found" error.

My partials are imported without underscore, like this @import "mixins" refering to .../assets/css/src/_mixins.scss
When I cmd+click a mixin, the plugin searches for .../assets/css/src/mixins.scss and VSCode returns a "File not found" error.

@justlevine
Copy link

justlevine commented Mar 7, 2019

Having the same issue as described by @premitheme . Last update was a year ago, any news since then?

v.0.7.0 seems to fix @import statements, but not the link for mixins and variables (See image - it should be _breakpoint.scss with an underscore).

capture

And to clarify, writing @import 'path/to/partial; //_partial.scss isnt just optional shorthand, but the actual recommended syntax for scss partials.
Depending on what you're using in your build process/how strict your linting is, writing out path/to/_partial.scss will throw a error.

@octref octref modified the milestones: 0.7.0, 0.8.0 Nov 12, 2019
@octref
Copy link
Collaborator

octref commented Nov 15, 2019

This is already fixed by @mrmlnc's commits for 0.7.0. I added integration test for it. This will be released under 0.8.0.

@octref octref closed this as completed Nov 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants