mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-09-11 19:17:09 +03:00
Changes so that second-mate can work
This commit is contained in:
parent
129354fe71
commit
ceec7ea914
@ -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);
|
||||
}
|
||||
|
@ -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(
|
||||
|
Loading…
Reference in New Issue
Block a user