Archived
Merge from vscode bead496a613e475819f89f08e9e882b841bc1fe8 (#14883)
* Merge from vscode bead496a613e475819f89f08e9e882b841bc1fe8 * Bump distro * Upgrade GCC to 4.9 due to yarn install errors * Update build image * Fix bootstrap base url * Bump distro * Fix build errors * Update source map file * Disable checkbox for blocking migration issues (#15131) * disable checkbox for blocking issues * wip * disable checkbox fixes * fix strings * Remove duplicate tsec command * Default to off for tab color if settings not present * re-skip failing tests * Fix mocha error * Bump sqlite version & fix notebooks search view * Turn off esbuild warnings * Update esbuild log level * Fix overflowactionbar tests * Fix ts-ignore in dropdown tests * cleanup/fixes * Fix hygiene * Bundle in entire zone.js module * Remove extra constructor param * bump distro for web compile break * bump distro for web compile break v2 * Undo log level change * New distro * Fix integration test scripts * remove the "no yarn.lock changes" workflow * fix scripts v2 * Update unit test scripts * Ensure ads-kerberos2 updates in .vscodeignore * Try fix unit tests * Upload crash reports * remove nogpu * always upload crashes * Use bash script * Consolidate data/ext dir names * Create in tmp directory Co-authored-by: chlafreniere <hichise@gmail.com> Co-authored-by: Christopher Suh <chsuh@microsoft.com> Co-authored-by: chgagnon <chgagnon@microsoft.com>
This commit is contained in:
co-authored by
chlafreniere
Christopher Suh
chgagnon
parent
7e1c0076ba
commit
867a963882
@@ -0,0 +1,84 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
// @ts-check
|
||||
'use strict';
|
||||
|
||||
var updateGrammar = require('vscode-grammar-updater');
|
||||
|
||||
function removeDom(grammar) {
|
||||
grammar.repository['support-objects'].patterns = grammar.repository['support-objects'].patterns.filter(pattern => {
|
||||
if (pattern.match && pattern.match.match(/\b(HTMLElement|ATTRIBUTE_NODE|stopImmediatePropagation)\b/g)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
return grammar;
|
||||
}
|
||||
|
||||
function removeNodeTypes(grammar) {
|
||||
grammar.repository['support-objects'].patterns = grammar.repository['support-objects'].patterns.filter(pattern => {
|
||||
if (pattern.name) {
|
||||
if (pattern.name.startsWith('support.variable.object.node') || pattern.name.startsWith('support.class.node.')) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (pattern.captures) {
|
||||
if (Object.values(pattern.captures).some(capture =>
|
||||
capture.name && (capture.name.startsWith('support.variable.object.process')
|
||||
|| capture.name.startsWith('support.class.console'))
|
||||
)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
});
|
||||
return grammar;
|
||||
}
|
||||
|
||||
function patchJsdoctype(grammar) {
|
||||
grammar.repository['jsdoctype'].patterns = grammar.repository['jsdoctype'].patterns.filter(pattern => {
|
||||
if (pattern.name && pattern.name.indexOf('illegal') >= -1) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
return grammar;
|
||||
}
|
||||
|
||||
function patchGrammar(grammar) {
|
||||
return removeNodeTypes(removeDom(patchJsdoctype(grammar)));
|
||||
}
|
||||
|
||||
function adaptToJavaScript(grammar, replacementScope) {
|
||||
grammar.name = 'JavaScript (with React support)';
|
||||
grammar.fileTypes = ['.js', '.jsx', '.es6', '.mjs', '.cjs'];
|
||||
grammar.scopeName = `source${replacementScope}`;
|
||||
|
||||
var fixScopeNames = function (rule) {
|
||||
if (typeof rule.name === 'string') {
|
||||
rule.name = rule.name.replace(/\.tsx/g, replacementScope);
|
||||
}
|
||||
if (typeof rule.contentName === 'string') {
|
||||
rule.contentName = rule.contentName.replace(/\.tsx/g, replacementScope);
|
||||
}
|
||||
for (var property in rule) {
|
||||
var value = rule[property];
|
||||
if (typeof value === 'object') {
|
||||
fixScopeNames(value);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var repository = grammar.repository;
|
||||
for (var key in repository) {
|
||||
fixScopeNames(repository[key]);
|
||||
}
|
||||
}
|
||||
|
||||
var tsGrammarRepo = 'microsoft/TypeScript-TmLanguage';
|
||||
updateGrammar.update(tsGrammarRepo, 'TypeScript.tmLanguage', './syntaxes/TypeScript.tmLanguage.json', grammar => patchGrammar(grammar));
|
||||
updateGrammar.update(tsGrammarRepo, 'TypeScriptReact.tmLanguage', './syntaxes/TypeScriptReact.tmLanguage.json', grammar => patchGrammar(grammar));
|
||||
updateGrammar.update(tsGrammarRepo, 'TypeScriptReact.tmLanguage', '../javascript/syntaxes/JavaScript.tmLanguage.json', grammar => adaptToJavaScript(patchGrammar(grammar), '.js'));
|
||||
updateGrammar.update(tsGrammarRepo, 'TypeScriptReact.tmLanguage', '../javascript/syntaxes/JavaScriptReact.tmLanguage.json', grammar => adaptToJavaScript(patchGrammar(grammar), '.js.jsx'));
|
||||
@@ -0,0 +1,4 @@
|
||||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||
# yarn lockfile v1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user