vscode icon indicating copy to clipboard operation
vscode copied to clipboard

[scss] instellisense doesn't work when importing variables from separate file

Open jkanczler opened this issue 10 years ago • 41 comments

  • VSCode Version: 1.1.1
  • OS Version: Windows 7

Steps to Reproduce:

  1. Create an scss file with a simple variable
  2. Create another scss file that is importing the previously created scss file
  3. Try to implement a class in the second scss file and try to use the variable in there. Intellisense is not working inside a class, just outside a class:

image

image

jkanczler avatar May 24 '16 08:05 jkanczler

Yes, our css/less/sass supports are single file only.

aeschli avatar May 24 '16 14:05 aeschli

I was looking for this and got told that visual studio 2013 ever support this with additional comments:

https://blogs.msdn.microsoft.com/webdev/2013/11/06/a-high-value-undocumented-less-editor-feature-in-visual-studio/

It would be gorgeous if vscode inherit it. :)

towertop avatar Jun 28 '16 12:06 towertop

Definitely +1 for this feature request! :+1:

third774 avatar Sep 11 '16 15:09 third774

+1

This is a must have feature for me. Every time I sit down to do my LESS work, I always end up switching back to Visual Studio so I can get the references for my variables and mixins. This needs to happen.

tgrosh avatar Sep 14 '16 13:09 tgrosh

What about suggest variables from another opened file also? Or from files in the same directory. not only from linked ones. Or you know how looks for example directory with LESS files in Bootstrap 3... One main file with @includes of partial LESS files one of them with only variables and one subdirectory with mixins. So best behaviour should be to intelligently scan for other LESS files and includes and suggest variables this way.

mattez avatar Sep 29 '16 21:09 mattez

Similar thingss are discussed in these issues https://github.com/Microsoft/vscode/issues/10762 and https://github.com/Microsoft/vscode/issues/6820

mattez avatar Sep 29 '16 22:09 mattez

Both popular editors - Brackets and Sublime - support this via extensions.

I just want to switch to VSCODE and lack of this functionality is pretty big blocker for me. I'm really surprised that this essential feature for front-end developers is still missing in so clever editor which vscode surely is. If you are familiar with Bootstrap you know how annoying is write repetitively e.g. '@line-height-computed' or '@grid-gutter-width' or any other variables again and again...

And what about to change title to contain also LESS and SCSS key words and reflect what we are looking for: something like: [scss] Add feature to instellisense to support Less/Sass cross file variable resolution and also variables from imported separate files or something like that.

mattez avatar Sep 29 '16 22:09 mattez

How can I support this feature to be done? It should have higher priority. Yeah I find way in CONTRIBUTING.md

If you find your issue already exists, make relevant comments and add your reaction. Use a reaction in place of a "+1" comment. :+1: - upvote :-1: - downvote

So please you all front-end developers who want to use vscode and LESS/SASS please upvote by adding a :+1: reaction to the first post.

In a mean time Im going back to Brackets.

mattez avatar Sep 30 '16 10:09 mattez

Firsly, @mattez, thank you for your interest. I think developers would like to add all requested features, but now it is impossible.

From @bpasero

Since we are a small team of developers, there is only so many feature requests and issues we can work on for one milestone. Nevertheless we always welcome pull requests and are happy to accept them if they meet our quality standards.

I'm not an employee of Microsoft, but I write extensions for this editor and I'm interested in the evolution of this editor.

I also use Less in their projects and even wrote a book about Less in my native language. I am also waiting for this functionality.

And now let's talk about functionality. Please, @aeschli, tell me, this functionality should be implemented in vscode-css-languageservice or as separate extension? (If also think about the suggestions for mixins and their parameters)

If as an extension, then I'm ready to create it. Anytime Soon.

mrmlnc avatar Sep 30 '16 16:09 mrmlnc

Thank you @mrmlnc for your support. I'm really happy to see fist attempt to begun to solve this specifically. Hurray.

I know nothing about development strategies, but don't you can start on developing extension which could then later can be integrated to and became part of vscode?

BTW I have not tested jet (I'm more LESS user) but there is SASS extension already. But in general as a user I prefer "implemented" solution or very very good writen :) extension witch no interfere with existing features of vscode mainly it's IntelliSense.

And there is such a big part in default-settings.json dedicated to SASS and LESS so it looks like vscode want to support these languages deeply.

mattez avatar Oct 01 '16 10:10 mattez

Hi @mrmlnc have you got any hints from @aeschli ?

mattez avatar Oct 11 '16 13:10 mattez

@mattez, nope, but I'm working on an extension for Less (Sass later) 🌵. Think will be ready tomorrow. Will Intellisense support for variables and mixins (with nesting) from all imported files.

mrmlnc avatar Oct 11 '16 14:10 mrmlnc

@towertop, @tgrosh, @mattez, please, help me testing vscode-less extension ❤️.

mrmlnc avatar Oct 14 '16 15:10 mrmlnc

@mrmlnc I just installed you brand new hot extension. IT JUST WORKS so far. So I'm going to use it on a real projects. I looks gr8. Thank you very much @mrmlnc .

mattez avatar Oct 14 '16 15:10 mattez

This would come in very handy, especially if we as VS Code are going to switch our styling to SCSS #8589. It would already help us today on our website (I've ran into much of the same pain as mentioned here).

bgashler1 avatar Oct 14 '16 22:10 bgashler1

@bgashler1, I planned SCSS IntelliSense for next week. Now I want to identify problems in the current solution (performance [important], information in popup's and more cases).


UPD [24.10.2016]: Task moved to this week. Sorry 🐼

mrmlnc avatar Oct 15 '16 08:10 mrmlnc

@netopolit, @mattez, @bgashler1, @druellan, @marvinhagemeister,

Please, help me test testing vscode-scss extension ❤️.

mrmlnc avatar Oct 25 '16 13:10 mrmlnc

Seems to work pretty well!

2016-10-25_11h02_44

In fact, too well:

2016-10-25_11h04_29

Perhaps a way to ignore a path is needed. Also, not sure if the "implicitly" is so useful that worth taking up space for the path and the variable contents.

Another thing I noticed, and this can be a VScode problem: autocomplete

If you write the property, hit ctrl+space and then you keep typing, the autocomplete is not refreshed.

druellan avatar Oct 25 '16 14:10 druellan

It seems to be working fine.

I'm getting this in the panel:

[Error - 10:27:01 AM] Request textDocument/hover failed. Message: Request textDocument/hover failed with message: Cannot read property 'type' of null Code: -32603

MaximeDesRoches avatar Oct 25 '16 14:10 MaximeDesRoches

Another thing, I'm getting contextual help on every item inside a mixin:

2016-10-25_12h13_12

druellan avatar Oct 25 '16 15:10 druellan