diff --git a/src/grammar-registry.js b/src/grammar-registry.js index aa530b6a9..577c748c8 100644 --- a/src/grammar-registry.js +++ b/src/grammar-registry.js @@ -1,7 +1,7 @@ const _ = require('underscore-plus'); const Grim = require('grim'); const CSON = require('season'); -const FirstMate = require('first-mate'); +const SecondMate = require('second-mate'); const { Disposable, CompositeDisposable } = require('event-kit'); const TextMateLanguageMode = require('./text-mate-language-mode'); const TreeSitterLanguageMode = require('./tree-sitter-language-mode'); @@ -20,7 +20,7 @@ module.exports = class GrammarRegistry { constructor({ config } = {}) { this.config = config; this.subscriptions = new CompositeDisposable(); - this.textmateRegistry = new FirstMate.GrammarRegistry({ + this.textmateRegistry = new SecondMate.GrammarRegistry({ maxTokensPerLine: 100, maxLineLength: 1000 }); @@ -264,7 +264,7 @@ module.exports = class GrammarRegistry { if (grammar.contentRegex) { const contentMatch = isTreeSitter ? grammar.contentRegex.test(contents) - : grammar.contentRegex.testSync(contents); + : grammar.contentRegex.findNextMatchSync(contents); if (contentMatch) { score += 0.05; } else { @@ -317,6 +317,7 @@ module.exports = class GrammarRegistry { grammarMatchesPrefix(grammar, contents) { if (contents && grammar.firstLineRegex) { + debugger let escaped = false; let numberOfNewlinesInRegex = 0; for (let character of grammar.firstLineRegex.source) { @@ -339,8 +340,8 @@ module.exports = class GrammarRegistry { .split('\n') .slice(0, numberOfNewlinesInRegex + 1) .join('\n'); - if (grammar.firstLineRegex.testSync) { - return grammar.firstLineRegex.testSync(prefix); + if (grammar.firstLineRegex.findNextMatchSync) { + return grammar.firstLineRegex.findNextMatchSync(prefix); } else { return grammar.firstLineRegex.test(prefix); } diff --git a/static/index.js b/static/index.js index 0d2157b40..9c0ad88a3 100644 --- a/static/index.js +++ b/static/index.js @@ -19,10 +19,11 @@ } StartupTime.addMarker('window:start', startWindowTime); - window.onload = function() { + window.onload = async function() { try { StartupTime.addMarker('window:onload:start'); const startTime = Date.now(); + await require('second-mate').ready process.on('unhandledRejection', function(error, promise) { console.error(