kzg
kzg

Reputation: 780

Sublime Text 3 - SASS (scss) autocomplete variables from another files

I have two files:

variables.scss:

$my_var: #fff;

module.scss:

@import 'variables';

.body { background: $my_var;}

And Visual Studio provides me nice hints - when I'm typing $my in module.scss I see all variables from imported files that matches to $my. Simple.

But Sublime Text 3 autocompletes only variables from module.scss, not from other imported files. I have installed All Autocomplete package, it doesn't work... Any ideas? It is important feature for me...

Upvotes: 5

Views: 4145

Answers (3)

jsheffers
jsheffers

Reputation: 1622

I got this working using the AllAutocomplete plugin

The biggest drawback to using this plugin is that the file that it reads the variables from has to be open. Unfortunately I haven't found any better way to achieve this.

Sublime text 3 support?

This plugin didn't work for me out of the box with ST3. I had to make a small modification to the user settings file to get it to work.

"word_separators": "./\\()\"':,.;<>~!@#%^&*|+=[]{}`~?",

Adding this to your user sublime settings file should do the trick. Here is the github issue where this originated from.

https://github.com/alienhard/SublimeAllAutocomplete/issues/18

Upvotes: 0

mahish
mahish

Reputation: 1135

I had the same issue. This is what fixed the problem for me:

  1. Have an active tab with SASS (SCSS) file and then go to Preferences > Settings - More > Syntax Specific - User
  2. Paste this "word_separators": "./\\()\"':,.;<>~!@#%^&*|+=[]{}`~?"
  3. Save and profit.

Hope it helps. There is this github issue if you want to have more information.

Upvotes: 0

Marko Bajlovic
Marko Bajlovic

Reputation: 323

Question was answered here: Sass support for sublime text 3

From that link: You can install Emmet (formerly Zen Coding), it is an extremely powerful tool to do css (and scss), example :
I type bi and press tab and it gives me : background-image: url(|); (with the | your cursor).

If you are interested, please take a look at this:

Now, how to make it works with scss:

The answer is here

  • You have to install the package sass-textmate-bundle for scss and do what I have wrote.
  • If you need sass and not scss, check this answer, especially the second response from Alexander Ekdahl

Upvotes: 1

Related Questions