[seti] set languageId associations
This commit is contained in:
parent
70ab16cc10
commit
d4860107db
3 changed files with 120 additions and 77 deletions
|
@ -11,7 +11,6 @@
|
|||
"mimetypes": ["text/html", "text/x-jshtm", "text/template", "text/ng-template", "application/xhtml+xml"]
|
||||
}],
|
||||
"grammars": [{
|
||||
/* "language": "html", not yet enabled*/
|
||||
"scopeName": "text.html.basic",
|
||||
"path": "./syntaxes/HTML.plist"
|
||||
}]
|
||||
|
|
|
@ -54,6 +54,35 @@ function invertColor(color) {
|
|||
return res;
|
||||
}
|
||||
|
||||
function getLanguageMappings() {
|
||||
var langToExt = {
|
||||
'csharp': ['cs', 'csx']
|
||||
};
|
||||
|
||||
var allExtensions = fs.readdirSync('..');
|
||||
for (var i= 0; i < allExtensions.length; i++) {
|
||||
let dirPath = path.join('..', allExtensions[i], 'package.json');
|
||||
if (!fs.lstatSync(path.join('..', allExtensions[i])).isDirectory() || !fs.lstatSync(dirPath).isFile()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
let content = fs.readFileSync(dirPath).toString();
|
||||
let jsonContent = JSON.parse(content);
|
||||
let languages = jsonContent.contributes && jsonContent.contributes.languages;
|
||||
if (Array.isArray(languages)) {
|
||||
for (var k = 0; k < languages.length; k++) {
|
||||
var extensions = languages[k].extensions;
|
||||
var languageId = languages[k].id;
|
||||
if (Array.isArray(extensions) && languageId) {
|
||||
langToExt[languageId] = extensions.map(function (e) { return e.substr(1); });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return langToExt;
|
||||
}
|
||||
|
||||
|
||||
exports.update = function () {
|
||||
var fontMappings = 'https://raw.githubusercontent.com/jesseweed/seti-ui/master/styles/_fonts/seti.less';
|
||||
|
@ -63,6 +92,7 @@ exports.update = function () {
|
|||
var fileName2Def = {};
|
||||
var def2ColorId = {};
|
||||
var colorId2Value = {};
|
||||
var lang2Def = {};
|
||||
|
||||
function writeFileIconContent(info) {
|
||||
var iconDefinitions = {};
|
||||
|
@ -106,14 +136,16 @@ exports.update = function () {
|
|||
file: "_default",
|
||||
fileExtensions: ext2Def,
|
||||
fileNames: fileName2Def,
|
||||
languageIds: lang2Def,
|
||||
light: {
|
||||
file: "_default_light",
|
||||
fileExtensions: getInvertSet(ext2Def),
|
||||
languageIds: getInvertSet(lang2Def),
|
||||
fileNames: getInvertSet(fileName2Def)
|
||||
},
|
||||
version: 'https://github.com/jesseweed/seti-ui/commit/' + info.commitSha,
|
||||
};
|
||||
fs.writeFileSync('./icons/seti-icon-theme.json', JSON.stringify(res, null, '\t'));
|
||||
fs.writeFileSync('./icons/vs-seti-icon-theme.json', JSON.stringify(res, null, '\t'));
|
||||
|
||||
}
|
||||
|
||||
|
@ -140,6 +172,26 @@ exports.update = function () {
|
|||
}
|
||||
def2ColorId[def] = colorId;
|
||||
}
|
||||
// replace extensions for languageId
|
||||
var langToExt = getLanguageMappings();
|
||||
for (var lang in langToExt) {
|
||||
var exts = langToExt[lang];
|
||||
var preferredDef = null;
|
||||
// use the first file association for the preferred definition
|
||||
for (var i1 = 0; i1 < exts.length && !preferredDef; i1++) {
|
||||
preferredDef = ext2Def[exts[i1]];
|
||||
}
|
||||
if (preferredDef) {
|
||||
lang2Def[lang] = preferredDef;
|
||||
for (var i1 = 0; i1 < exts.length; i1++) {
|
||||
// remove the extention association, unless it is different from the preferred
|
||||
if (ext2Def[exts[i1]] === preferredDef) {
|
||||
delete ext2Def[exts[i1]];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var colors = 'https://raw.githubusercontent.com/jesseweed/seti-ui/master/styles/ui-variables.less';
|
||||
return download(colors).then(function (content) {
|
||||
var regex3 = /(@[\w-]+):\s*(#[0-9a-z]+)/g;
|
||||
|
@ -156,7 +208,7 @@ exports.update = function () {
|
|||
console.error(e);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
}, console.error);
|
||||
}
|
||||
|
|
|
@ -701,16 +701,9 @@
|
|||
},
|
||||
"file": "_default",
|
||||
"fileExtensions": {
|
||||
"cpp": "_cpp",
|
||||
"c": "_c",
|
||||
"cs": "_c-sharp",
|
||||
"cc": "_cpp",
|
||||
"cfc": "_coldfusion",
|
||||
"cfm": "_coldfusion",
|
||||
"coffee": "_coffee",
|
||||
"config": "_config",
|
||||
"cson": "_json",
|
||||
"css": "_css",
|
||||
"css.map": "_css",
|
||||
"sss": "_css",
|
||||
"csv": "_csv",
|
||||
|
@ -719,14 +712,11 @@
|
|||
"elm": "_elm",
|
||||
"ico": "_favicon",
|
||||
"gitignore": "_github",
|
||||
"gitconfig": "_github",
|
||||
"gitkeep": "_github",
|
||||
"gitattributes": "_github",
|
||||
"go": "_go2",
|
||||
"slide": "_go",
|
||||
"article": "_go",
|
||||
"gradle": "_gradle",
|
||||
"groovy": "_grails",
|
||||
"gsp": "_grails",
|
||||
"hh": "_hacklang",
|
||||
"haml": "_haml",
|
||||
|
@ -735,57 +725,37 @@
|
|||
"hjs": "_mustache",
|
||||
"hs": "_haskell",
|
||||
"lhs": "_haskell",
|
||||
"html": "_html",
|
||||
"jade": "_jade",
|
||||
"java": "_java",
|
||||
"class": "_java",
|
||||
"classpath": "_java",
|
||||
"js": "_javascript",
|
||||
"js.map": "_javascript",
|
||||
"es": "_javascript",
|
||||
"es5": "_javascript",
|
||||
"es6": "_javascript",
|
||||
"es7": "_javascript",
|
||||
"json": "_json",
|
||||
"jl": "_julia",
|
||||
"less": "_less",
|
||||
"liquid": "_liquid",
|
||||
"ls": "_livescript",
|
||||
"lua": "_lua",
|
||||
"markdown": "_markdown",
|
||||
"md": "_markdown",
|
||||
"mustache": "_mustache",
|
||||
"stache": "_mustache",
|
||||
"npm-debug.log": "_npm",
|
||||
"npmignore": "_npm",
|
||||
"h": "_c",
|
||||
"m": "_c",
|
||||
"ml": "_ocaml",
|
||||
"mli": "_ocaml",
|
||||
"cmx": "_ocaml",
|
||||
"cmxa": "_ocaml",
|
||||
"pl": "_perl",
|
||||
"php": "_php",
|
||||
"php.inc": "_php",
|
||||
"pug": "_pug",
|
||||
"pp": "_puppet",
|
||||
"py": "_python",
|
||||
"jsx": "_react",
|
||||
"cjsx": "_react",
|
||||
"tsx": "_react",
|
||||
"rb": "_ruby",
|
||||
"erb": "_ruby",
|
||||
"erb.html": "_ruby",
|
||||
"html.erb": "_ruby",
|
||||
"rs": "_rust",
|
||||
"sass": "_sass",
|
||||
"scss": "_sass",
|
||||
"slim": "_slim",
|
||||
"smarty.tpl": "_smarty",
|
||||
"sbt": "_sbt",
|
||||
"scala": "_scala",
|
||||
"styl": "_stylus",
|
||||
"swift": "_swift",
|
||||
"tf": "_terraform",
|
||||
"tf.json": "_terraform",
|
||||
"tex": "_tex",
|
||||
|
@ -795,12 +765,9 @@
|
|||
"ins": "_tex",
|
||||
"txt": "_default",
|
||||
"twig": "_twig",
|
||||
"ts": "_typescript",
|
||||
"vala": "_vala",
|
||||
"vapi": "_vala",
|
||||
"xml": "_xml",
|
||||
"yml": "_yml",
|
||||
"yaml": "_yml",
|
||||
"ai": "_illustrator",
|
||||
"psd": "_photoshop",
|
||||
"pdf": "_pdf",
|
||||
|
@ -814,11 +781,7 @@
|
|||
"jpeg": "_image",
|
||||
"svg": "_svg",
|
||||
"svgx": "_image",
|
||||
"cmd": "_shell",
|
||||
"sh": "_shell",
|
||||
"zsh": "_shell",
|
||||
"fish": "_shell",
|
||||
"zshrc": "_shell",
|
||||
"mov": "_video",
|
||||
"ogv": "_video",
|
||||
"webm": "_video",
|
||||
|
@ -865,19 +828,45 @@
|
|||
"TODO": "_todo",
|
||||
"npm-debug.log": "_npm_ignored"
|
||||
},
|
||||
"languageIds": {
|
||||
"csharp": "_c-sharp",
|
||||
"bat": "_shell",
|
||||
"coffeescript": "_coffee",
|
||||
"c": "_c",
|
||||
"cpp": "_cpp",
|
||||
"css": "_css",
|
||||
"go": "_go2",
|
||||
"groovy": "_grails",
|
||||
"html": "_html",
|
||||
"ini": "_github",
|
||||
"jade": "_jade",
|
||||
"java": "_java",
|
||||
"javascriptreact": "_react",
|
||||
"javascript": "_javascript",
|
||||
"json": "_json",
|
||||
"less": "_less",
|
||||
"lua": "_lua",
|
||||
"markdown": "_markdown",
|
||||
"objective-c": "_c",
|
||||
"perl": "_perl",
|
||||
"php": "_php",
|
||||
"python": "_python",
|
||||
"ruby": "_ruby",
|
||||
"rust": "_rust",
|
||||
"scss": "_sass",
|
||||
"shellscript": "_shell",
|
||||
"swift": "_swift",
|
||||
"typescript": "_typescript",
|
||||
"typescriptreact": "_react",
|
||||
"xml": "_config",
|
||||
"yaml": "_yml"
|
||||
},
|
||||
"light": {
|
||||
"file": "_default_light",
|
||||
"fileExtensions": {
|
||||
"cpp": "_cpp_light",
|
||||
"c": "_c_light",
|
||||
"cs": "_c-sharp_light",
|
||||
"cc": "_cpp_light",
|
||||
"cfc": "_coldfusion_light",
|
||||
"cfm": "_coldfusion_light",
|
||||
"coffee": "_coffee_light",
|
||||
"config": "_config_light",
|
||||
"cson": "_json_light",
|
||||
"css": "_css_light",
|
||||
"css.map": "_css_light",
|
||||
"sss": "_css_light",
|
||||
"csv": "_csv_light",
|
||||
|
@ -886,14 +875,11 @@
|
|||
"elm": "_elm_light",
|
||||
"ico": "_favicon_light",
|
||||
"gitignore": "_github_light",
|
||||
"gitconfig": "_github_light",
|
||||
"gitkeep": "_github_light",
|
||||
"gitattributes": "_github_light",
|
||||
"go": "_go2_light",
|
||||
"slide": "_go_light",
|
||||
"article": "_go_light",
|
||||
"gradle": "_gradle_light",
|
||||
"groovy": "_grails_light",
|
||||
"gsp": "_grails_light",
|
||||
"hh": "_hacklang_light",
|
||||
"haml": "_haml_light",
|
||||
|
@ -902,57 +888,37 @@
|
|||
"hjs": "_mustache_light",
|
||||
"hs": "_haskell_light",
|
||||
"lhs": "_haskell_light",
|
||||
"html": "_html_light",
|
||||
"jade": "_jade_light",
|
||||
"java": "_java_light",
|
||||
"class": "_java_light",
|
||||
"classpath": "_java_light",
|
||||
"js": "_javascript_light",
|
||||
"js.map": "_javascript_light",
|
||||
"es": "_javascript_light",
|
||||
"es5": "_javascript_light",
|
||||
"es6": "_javascript_light",
|
||||
"es7": "_javascript_light",
|
||||
"json": "_json_light",
|
||||
"jl": "_julia_light",
|
||||
"less": "_less_light",
|
||||
"liquid": "_liquid_light",
|
||||
"ls": "_livescript_light",
|
||||
"lua": "_lua_light",
|
||||
"markdown": "_markdown_light",
|
||||
"md": "_markdown_light",
|
||||
"mustache": "_mustache_light",
|
||||
"stache": "_mustache_light",
|
||||
"npm-debug.log": "_npm_light",
|
||||
"npmignore": "_npm_light",
|
||||
"h": "_c_light",
|
||||
"m": "_c_light",
|
||||
"ml": "_ocaml_light",
|
||||
"mli": "_ocaml_light",
|
||||
"cmx": "_ocaml_light",
|
||||
"cmxa": "_ocaml_light",
|
||||
"pl": "_perl_light",
|
||||
"php": "_php_light",
|
||||
"php.inc": "_php_light",
|
||||
"pug": "_pug_light",
|
||||
"pp": "_puppet_light",
|
||||
"py": "_python_light",
|
||||
"jsx": "_react_light",
|
||||
"cjsx": "_react_light",
|
||||
"tsx": "_react_light",
|
||||
"rb": "_ruby_light",
|
||||
"erb": "_ruby_light",
|
||||
"erb.html": "_ruby_light",
|
||||
"html.erb": "_ruby_light",
|
||||
"rs": "_rust_light",
|
||||
"sass": "_sass_light",
|
||||
"scss": "_sass_light",
|
||||
"slim": "_slim_light",
|
||||
"smarty.tpl": "_smarty_light",
|
||||
"sbt": "_sbt_light",
|
||||
"scala": "_scala_light",
|
||||
"styl": "_stylus_light",
|
||||
"swift": "_swift_light",
|
||||
"tf": "_terraform_light",
|
||||
"tf.json": "_terraform_light",
|
||||
"tex": "_tex_light",
|
||||
|
@ -962,12 +928,9 @@
|
|||
"ins": "_tex_light",
|
||||
"txt": "_default_light",
|
||||
"twig": "_twig_light",
|
||||
"ts": "_typescript_light",
|
||||
"vala": "_vala_light",
|
||||
"vapi": "_vala_light",
|
||||
"xml": "_xml_light",
|
||||
"yml": "_yml_light",
|
||||
"yaml": "_yml_light",
|
||||
"ai": "_illustrator_light",
|
||||
"psd": "_photoshop_light",
|
||||
"pdf": "_pdf_light",
|
||||
|
@ -981,11 +944,7 @@
|
|||
"jpeg": "_image_light",
|
||||
"svg": "_svg_light",
|
||||
"svgx": "_image_light",
|
||||
"cmd": "_shell_light",
|
||||
"sh": "_shell_light",
|
||||
"zsh": "_shell_light",
|
||||
"fish": "_shell_light",
|
||||
"zshrc": "_shell_light",
|
||||
"mov": "_video_light",
|
||||
"ogv": "_video_light",
|
||||
"webm": "_video_light",
|
||||
|
@ -1006,6 +965,39 @@
|
|||
"tmp": "_clock_light",
|
||||
"DS_Store": "_ignored_light"
|
||||
},
|
||||
"languageIds": {
|
||||
"csharp": "_c-sharp_light",
|
||||
"bat": "_shell_light",
|
||||
"coffeescript": "_coffee_light",
|
||||
"c": "_c_light",
|
||||
"cpp": "_cpp_light",
|
||||
"css": "_css_light",
|
||||
"go": "_go2_light",
|
||||
"groovy": "_grails_light",
|
||||
"html": "_html_light",
|
||||
"ini": "_github_light",
|
||||
"jade": "_jade_light",
|
||||
"java": "_java_light",
|
||||
"javascriptreact": "_react_light",
|
||||
"javascript": "_javascript_light",
|
||||
"json": "_json_light",
|
||||
"less": "_less_light",
|
||||
"lua": "_lua_light",
|
||||
"markdown": "_markdown_light",
|
||||
"objective-c": "_c_light",
|
||||
"perl": "_perl_light",
|
||||
"php": "_php_light",
|
||||
"python": "_python_light",
|
||||
"ruby": "_ruby_light",
|
||||
"rust": "_rust_light",
|
||||
"scss": "_sass_light",
|
||||
"shellscript": "_shell_light",
|
||||
"swift": "_swift_light",
|
||||
"typescript": "_typescript_light",
|
||||
"typescriptreact": "_react_light",
|
||||
"xml": "_config_light",
|
||||
"yaml": "_yml_light"
|
||||
},
|
||||
"fileNames": {
|
||||
"karma.conf.js": "_karma_light",
|
||||
"karma.conf.coffee": "_karma_light",
|
||||
|
|
Loading…
Reference in a new issue