Last active
October 6, 2016 01:55
-
-
Save joadr/6823d371f1be6bb06d779751408cc49d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"scopes": [ | |
// MINIMAL AUTO TRIGGER - NOT RECOMMENDED | |
// will always query files for auto completions | |
// { | |
// "scope": ".", | |
// "extensions": ["*"], | |
// "auto": true | |
// }, | |
{ | |
// js: require() | |
"scope": "\\.js\\s", // 1. ignore if scope at cursor does not match expression (super+alt+p) | |
"prefix": ["require", "define"], // 2. trigger only if: require(<cursor>, define([<cursor> | |
// if 1 & 2 are true: | |
"auto": true, | |
"relative": true, // insert absolute | |
"base_directory": false, // insert absolute from the set base directory (above) | |
"extensions": ["js", "html", "scss"], // show only .js, .html and .scss files | |
"replace_on_insert": [ | |
["\\.js$", ""], // after insertion, remove .js from path | |
["([^.])\\/index$", "\\1"], // nodejs will load index.js by default => also remove index | |
["^\\/bower_components\\/", ""] // remove bower_components, since our build tool resolves this path automatically | |
] | |
}, | |
{ | |
// es6 import from/import "*" | |
"scope": "source\\.js.*string", | |
"auto": true, | |
"relative": true, | |
"base_directory": false, | |
"prefix": ["from", "import"], | |
"extensions": ["js", "html", "scss", "jsx", "json"], | |
"replace_on_insert": [ | |
["\\.js$", ""], | |
["\\.jsx$", ""], | |
["^\\/bower_components\\/", ""] | |
] | |
}, | |
{ | |
// Typescript // <reference path="" /> | |
"scope": "source\\.ts\\scomment", | |
"auto": true, | |
"relative": true, | |
"base_directory": false, | |
"prefix": ["path"], | |
"tagName": ["reference"], | |
"extensions": ["ts", "js"], | |
"replace_on_insert": [] | |
}, | |
{ | |
// Typescript es6 import from/import "*" | |
"scope": "string[^\\s]*\\.ts\\s", | |
"auto": true, | |
"relative": true, | |
"base_directory": false, | |
"prefix": ["from", "import"], | |
"extensions": ["js", "ts"], | |
"replace_on_insert": [ | |
["(\\.js|\\.ts)$", ""], | |
["([^.])\\/index$", "\\1"] | |
] | |
}, | |
{ | |
// Coffeescript es6 import from/import "*" and require | |
"scope": "string[^\\s]*\\.coffee\\s", | |
"auto": true, | |
"relative": true, | |
"base_directory": false, | |
"prefix": ["from", "import", "require"], | |
"extensions": ["coffee"], | |
"replace_on_insert": [] | |
}, | |
{ | |
// js - *.src = "" | |
"scope": "source\\.js.*string", | |
"prefix": ["src"], | |
"auto": true, | |
"base_directory": true, | |
"extensions": ["png", "gif", "jpg", "jpeg"], | |
"relative": true | |
}, | |
{ | |
// (s)css: import | |
"scope": "(css|sass)\\s", | |
"auto": true, | |
"prefix": ["import"], | |
"relative": false, | |
"extensions": ["css", "scss"], | |
"replace_on_insert": [ | |
["\\.(css|scss)$", ""], | |
["^\\/bower_components\\/", ""] | |
] | |
}, | |
{ | |
// (s)css: import | |
"scope": "(css|sass)\\s", | |
"auto": true, | |
"prefix": ["url"], | |
"relative": false, | |
"extensions": ["jpg", "png", "gif"], | |
"replace_on_insert": [ | |
["\\.(css|scss)$", ""], | |
["^\\/bower_components\\/", ""] | |
] | |
}, | |
{ | |
// (s)css: import | |
"scope": ".", | |
"auto": false, | |
"relative": true, | |
"extensions": ["js", "html", "scss", "png", "jpg", "gif", "svg"], | |
"replace_on_insert": [ | |
["\\.js$", ""], | |
["\\/index$", ""], | |
["^\\/bower_components\\/", ""] | |
] | |
}, | |
{ | |
// html - <script src=".."> | |
"scope": "string\\.quote.*\\.html", | |
"prefix": ["src"], | |
"tagName": ["script"], | |
"auto": true, | |
"base_directory": true, | |
"extensions": ["js"], | |
"relative": true | |
}, | |
{ | |
// string.quote.double.html | |
// html - <img src="" and <script src="" and <* style="*: url() | |
"scope": "meta.tag.*string.*\\.html", | |
// <* src | |
"prefix": ["src", "url"], | |
"auto": true, | |
"base_directory": true, | |
"extensions": ["js", "png", "gif", "jpeg", "jpg", "svg"], | |
"relative": true | |
}, | |
{ | |
// html - <link href="" | |
"scope": "meta\\.tag.*string.*\\.html", | |
// "scope": "html", | |
// <link href | |
"tagName": ["link"], | |
"prefix": ["href"], | |
"auto": true, | |
"extensions": ["css"], | |
"relative": true | |
}, | |
{ | |
// css - *: url() | |
"scope": "meta\\.property.*\\.css", | |
// *: url | |
"prefix": ["url"], | |
"auto": true, | |
"relative": true, | |
"base_directory": true, | |
"extensions": ["png", "gif", "jpeg", "jpg", "woff", "ttf", "svg", "otf"], | |
}, | |
{ | |
// css - import "" | |
"scope": ".*\\.(css|sass|less)", | |
// *: url | |
"prefix": ["import"], | |
"auto": true, | |
"extensions": ["css", "scss", "less"], | |
"relative": true, | |
"replace_on_insert": [ | |
// remove extension | |
["\\.(scss|less)$", ""], | |
] | |
}, | |
{ | |
// python | |
"scope": "\\.python", | |
"extensions": ["py"], | |
"auto": true, | |
"prefix": ["from"], | |
"relative": false, | |
"replace_on_insert": [ | |
["^\\/", ""], | |
["\\/", "."], | |
// ! remove | |
["^(.*)\\.py$", "FuzzyFilePath.\\1"] | |
] | |
}, | |
{ | |
// php | |
"auto": true, | |
"scope": "\\.php", | |
"extensions": ["php"], | |
"prefix": ["require_once", "include"], | |
"relative": false, | |
"replace_on_insert": [["^\\/", ""]] | |
}, | |
{ | |
// * - any source file (by command only) | |
"scope": "source", | |
"auto": false, | |
"extensions": ["js", "html", "css", "scss", "less", "png", "gif", "jpeg", "jpg", "svg"], | |
"relative": true | |
}, | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment