How to use the vscode-textmate.parseRawGrammar function in vscode-textmate

To help you get started, we’ve selected a few vscode-textmate 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 dotnet / csharp-tmLanguage / test / utils / tokenize.ts View on Github external
loadGrammar: async (scopeName) => {
        if (scopeName === 'source.cs') {
            scopeName //?
            // https://github.com/textmate/javascript.tmbundle/blob/master/Syntaxes/JavaScript.plist
            const response = await new Promise((resolve, reject) => {
                readFile('./grammars/csharp.tmLanguage', (e, v) => e ? reject(e) : resolve(v.toString()));
            });
            const g = parseRawGrammar(response, resolve('./grammars/csharp.tmLanguage'));
            g //?
            return g;
        }
        console.log(`Unknown scope name: ${scopeName}`);
        return null;
    }
});
github onflow / cadence / docs / highlight.js View on Github external
static async loadGrammar(path) {
        const rawGrammar = await fs.promises.readFile(path, 'utf-8')
        return vsctm.parseRawGrammar(rawGrammar.toString(), path)
    }
github andrewbranch / gatsby-remark-vscode / src / createGetRegistry.js View on Github external
loadGrammar: async scopeName => {
          const grammarInfo = getGrammar(scopeName, grammars);
          const fileName = grammarInfo && getGrammarLocation(grammarInfo);
          if (fileName) {
            const contents = await readFile(fileName, 'utf8');
            return parseRawGrammar(contents, fileName);
          }
          warnMissingLanguageFile(scopeName, rootScopeName);
        },
        getInjections: scopeName => {