diff options
Diffstat (limited to 'index.js')
-rw-r--r-- | index.js | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -9,6 +9,20 @@ highlighter.requireGrammarsSync({ "modulePath": require.resolve('language-emacs-lisp/package.json'), }); +const Selector = require('first-mate-select-grammar'); +const selector = Selector(); +function addExtensionsToGrammar(knownExtension,extraExtensions) { + let grammar = selector.selectGrammar( + highlighter.registry, + `some_file.${knownExtension}`, + "not much"); + if (grammar) { + Array.prototype.push.apply(grammar.fileTypes,extraExtensions); + } +} + +addExtensionsToGrammar('cpp',['ino']); + const server = http.createServer((req, res) => { const filename = req.headers['filename']; let buffer = ''; |