How to use the @theia/monaco/lib/browser/textmate.getEncodedLanguageId function in @theia/monaco

To help you get started, we’ve selected a few @theia/monaco examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github eclipse-theia / theia / packages / plugin-ext / src / main / browser / plugin-contribution-handler.ts View on Github external
private convertEmbeddedLanguages(languages?: ScopeMap): IEmbeddedLanguagesMap | undefined {
        if (typeof languages === 'undefined' || languages === null) {
            return undefined;
        }

        // tslint:disable-next-line:no-null-keyword
        const result = Object.create(null);
        const scopes = Object.keys(languages);
        const len = scopes.length;
        for (let i = 0; i < len; i++) {
            const scope = scopes[i];
            const langId = languages[scope];
            result[scope] = getEncodedLanguageId(langId);
        }
        return result;
    }
github eclipse-theia / theia / packages / textmate-grammars / src / browser / js.ts View on Github external
}
        });

        registry.registerTextmateGrammarScope('source.js.regexp', {
            async getGrammarDefinition(): Promise {
                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 {
github eclipse-theia / theia / packages / textmate-grammars / src / browser / js.ts View on Github external
registry.registerTextmateGrammarScope('source.js.regexp', {
            async getGrammarDefinition(): Promise {
                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',
github eclipse-theia / theia / packages / textmate-grammars / src / browser / js.ts View on Github external
});

        registry.registerTextmateGrammarScope('source.js.regexp', {
            async getGrammarDefinition(): Promise {
                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 {
github eclipse-theia / theia / packages / textmate-grammars / src / browser / js.ts View on Github external
};
            }
        });

        registry.registerTextmateGrammarScope('source.js.regexp', {
            async getGrammarDefinition(): Promise {
                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', {