Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (typeof tokenTypes === 'undefined' || tokenTypes === null) {
return undefined;
}
// tslint:disable-next-line:no-null-keyword
const result = Object.create(null);
const scopes = Object.keys(tokenTypes);
const len = scopes.length;
for (let i = 0; i < len; i++) {
const scope = scopes[i];
const tokenType = tokenTypes[scope];
switch (tokenType) {
case 'string':
result[scope] = StandardTokenType.String;
break;
case 'other':
result[scope] = StandardTokenType.Other;
break;
case 'comment':
result[scope] = StandardTokenType.Comment;
break;
}
}
return result;
}
format: 'plist',
content: regExpGrammar,
};
}
});
registry.registerGrammarConfiguration(this.js_id, {
embeddedLanguages: {
'meta.tag.js': getEncodedLanguageId('jsx-tags'),
'meta.tag.without-attributes.js': getEncodedLanguageId('jsx-tags'),
'meta.tag.attributes.js.jsx': getEncodedLanguageId('javascriptreact'),
'meta.embedded.expression.js': getEncodedLanguageId('javascriptreact')
},
tokenTypes: {
'entity.name.type.instance.jsdoc': StandardTokenType.Other,
'entity.name.function.tagged-template': StandardTokenType.Other,
'meta.import string.quoted': StandardTokenType.Other,
'variable.other.jsdoc': StandardTokenType.Other
}
});
registry.mapLanguageIdToTextmateGrammar(this.js_id, 'source.js');
const jsxGrammar = require('../../data/javascript.jsx.tmlanguage.json');
registry.registerTextmateGrammarScope('source.jsx', {
async getGrammarDefinition(): Promise {
return {
format: 'json',
content: jsxGrammar,
};
}
});
return {
format: 'plist',
content: regExpGrammar,
};
}
});
registry.registerGrammarConfiguration(this.js_id, {
embeddedLanguages: {
'meta.tag.js': getEncodedLanguageId('jsx-tags'),
'meta.tag.without-attributes.js': getEncodedLanguageId('jsx-tags'),
'meta.tag.attributes.js.jsx': getEncodedLanguageId('javascriptreact'),
'meta.embedded.expression.js': getEncodedLanguageId('javascriptreact')
},
tokenTypes: {
'entity.name.type.instance.jsdoc': StandardTokenType.Other,
'entity.name.function.tagged-template': StandardTokenType.Other,
'meta.import string.quoted': StandardTokenType.Other,
'variable.other.jsdoc': StandardTokenType.Other
}
});
registry.mapLanguageIdToTextmateGrammar(this.js_id, 'source.js');
const jsxGrammar = require('../../data/javascript.jsx.tmlanguage.json');
registry.registerTextmateGrammarScope('source.jsx', {
async getGrammarDefinition(): Promise {
return {
format: 'json',
content: jsxGrammar,
};
}
};
}
});
registry.registerGrammarConfiguration(this.js_id, {
embeddedLanguages: {
'meta.tag.js': getEncodedLanguageId('jsx-tags'),
'meta.tag.without-attributes.js': getEncodedLanguageId('jsx-tags'),
'meta.tag.attributes.js.jsx': getEncodedLanguageId('javascriptreact'),
'meta.embedded.expression.js': getEncodedLanguageId('javascriptreact')
},
tokenTypes: {
'entity.name.type.instance.jsdoc': StandardTokenType.Other,
'entity.name.function.tagged-template': StandardTokenType.Other,
'meta.import string.quoted': StandardTokenType.Other,
'variable.other.jsdoc': StandardTokenType.Other
}
});
registry.mapLanguageIdToTextmateGrammar(this.js_id, 'source.js');
const jsxGrammar = require('../../data/javascript.jsx.tmlanguage.json');
registry.registerTextmateGrammarScope('source.jsx', {
async getGrammarDefinition(): Promise {
return {
format: 'json',
content: jsxGrammar,
};
}
});
registry.mapLanguageIdToTextmateGrammar(this.js_react_id, 'source.jsx');
content: regExpGrammar,
};
}
});
registry.registerGrammarConfiguration(this.js_id, {
embeddedLanguages: {
'meta.tag.js': getEncodedLanguageId('jsx-tags'),
'meta.tag.without-attributes.js': getEncodedLanguageId('jsx-tags'),
'meta.tag.attributes.js.jsx': getEncodedLanguageId('javascriptreact'),
'meta.embedded.expression.js': getEncodedLanguageId('javascriptreact')
},
tokenTypes: {
'entity.name.type.instance.jsdoc': StandardTokenType.Other,
'entity.name.function.tagged-template': StandardTokenType.Other,
'meta.import string.quoted': StandardTokenType.Other,
'variable.other.jsdoc': StandardTokenType.Other
}
});
registry.mapLanguageIdToTextmateGrammar(this.js_id, 'source.js');
const jsxGrammar = require('../../data/javascript.jsx.tmlanguage.json');
registry.registerTextmateGrammarScope('source.jsx', {
async getGrammarDefinition(): Promise {
return {
format: 'json',
content: jsxGrammar,
};
}
});