mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-09-11 19:17:09 +03:00
Removing ALL references of old first-mate
This commit is contained in:
parent
0dc1d92821
commit
03057610f6
@ -1,4 +1,4 @@
|
|||||||
const {ScopeSelector} = require('first-mate')
|
const {ScopeSelector} = require('second-mate')
|
||||||
const cache = {}
|
const cache = {}
|
||||||
|
|
||||||
exports.get = function (selector) {
|
exports.get = function (selector) {
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
"atom": "*"
|
"atom": "*"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"first-mate": "^7.4.1",
|
|
||||||
"underscore-plus": "1.x"
|
"underscore-plus": "1.x"
|
||||||
},
|
},
|
||||||
"configSchema": {
|
"configSchema": {
|
||||||
|
@ -18,45 +18,45 @@ describe 'Go settings', ->
|
|||||||
it 'matches lines correctly using the increaseIndentPattern', ->
|
it 'matches lines correctly using the increaseIndentPattern', ->
|
||||||
increaseIndentRegex = languageMode.increaseIndentRegexForScopeDescriptor(['source.go'])
|
increaseIndentRegex = languageMode.increaseIndentRegexForScopeDescriptor(['source.go'])
|
||||||
|
|
||||||
expect(increaseIndentRegex.testSync(' case true:')).toBeTruthy()
|
expect(increaseIndentRegex.findNextMatchSync(' case true:')).toBeTruthy()
|
||||||
expect(increaseIndentRegex.testSync(' default:')).toBeTruthy()
|
expect(increaseIndentRegex.findNextMatchSync(' default:')).toBeTruthy()
|
||||||
expect(increaseIndentRegex.testSync('func something() {')).toBeTruthy()
|
expect(increaseIndentRegex.findNextMatchSync('func something() {')).toBeTruthy()
|
||||||
expect(increaseIndentRegex.testSync(' if true {')).toBeTruthy()
|
expect(increaseIndentRegex.findNextMatchSync(' if true {')).toBeTruthy()
|
||||||
expect(increaseIndentRegex.testSync(' else {')).toBeTruthy()
|
expect(increaseIndentRegex.findNextMatchSync(' else {')).toBeTruthy()
|
||||||
expect(increaseIndentRegex.testSync(' switch {')).toBeTruthy()
|
expect(increaseIndentRegex.findNextMatchSync(' switch {')).toBeTruthy()
|
||||||
expect(increaseIndentRegex.testSync(' switch true {')).toBeTruthy()
|
expect(increaseIndentRegex.findNextMatchSync(' switch true {')).toBeTruthy()
|
||||||
expect(increaseIndentRegex.testSync(' select {')).toBeTruthy()
|
expect(increaseIndentRegex.findNextMatchSync(' select {')).toBeTruthy()
|
||||||
expect(increaseIndentRegex.testSync(' select true {')).toBeTruthy()
|
expect(increaseIndentRegex.findNextMatchSync(' select true {')).toBeTruthy()
|
||||||
expect(increaseIndentRegex.testSync(' for v := range val {')).toBeTruthy()
|
expect(increaseIndentRegex.findNextMatchSync(' for v := range val {')).toBeTruthy()
|
||||||
expect(increaseIndentRegex.testSync(' for i := 0; i < 10; i++ {')).toBeTruthy()
|
expect(increaseIndentRegex.findNextMatchSync(' for i := 0; i < 10; i++ {')).toBeTruthy()
|
||||||
expect(increaseIndentRegex.testSync(' for i := 0; i < 10; i++ {')).toBeTruthy()
|
expect(increaseIndentRegex.findNextMatchSync(' for i := 0; i < 10; i++ {')).toBeTruthy()
|
||||||
expect(increaseIndentRegex.testSync(' type something struct {')).toBeTruthy()
|
expect(increaseIndentRegex.findNextMatchSync(' type something struct {')).toBeTruthy()
|
||||||
expect(increaseIndentRegex.testSync(' fmt.Printf("some%s",')).toBeTruthy()
|
expect(increaseIndentRegex.findNextMatchSync(' fmt.Printf("some%s",')).toBeTruthy()
|
||||||
expect(increaseIndentRegex.testSync(' aSlice := []string{}{')).toBeTruthy()
|
expect(increaseIndentRegex.findNextMatchSync(' aSlice := []string{}{')).toBeTruthy()
|
||||||
|
|
||||||
it 'matches lines correctly using the decreaseIndentPattern', ->
|
it 'matches lines correctly using the decreaseIndentPattern', ->
|
||||||
decreaseIndentRegex = languageMode.decreaseIndentRegexForScopeDescriptor(['source.go'])
|
decreaseIndentRegex = languageMode.decreaseIndentRegexForScopeDescriptor(['source.go'])
|
||||||
|
|
||||||
expect(decreaseIndentRegex.testSync(' case true:')).toBeTruthy()
|
expect(decreaseIndentRegex.findNextMatchSync(' case true:')).toBeTruthy()
|
||||||
expect(decreaseIndentRegex.testSync(' default:')).toBeTruthy()
|
expect(decreaseIndentRegex.findNextMatchSync(' default:')).toBeTruthy()
|
||||||
expect(decreaseIndentRegex.testSync(' }')).toBeTruthy()
|
expect(decreaseIndentRegex.findNextMatchSync(' }')).toBeTruthy()
|
||||||
expect(decreaseIndentRegex.testSync(' },')).toBeTruthy()
|
expect(decreaseIndentRegex.findNextMatchSync(' },')).toBeTruthy()
|
||||||
expect(decreaseIndentRegex.testSync(' )')).toBeTruthy()
|
expect(decreaseIndentRegex.findNextMatchSync(' )')).toBeTruthy()
|
||||||
expect(decreaseIndentRegex.testSync(' ),')).toBeTruthy()
|
expect(decreaseIndentRegex.findNextMatchSync(' ),')).toBeTruthy()
|
||||||
|
|
||||||
it 'matches lines correctly using the decreaseNextIndentPattern', ->
|
it 'matches lines correctly using the decreaseNextIndentPattern', ->
|
||||||
decreaseNextIndentRegex = languageMode.decreaseNextIndentRegexForScopeDescriptor(['source.go'])
|
decreaseNextIndentRegex = languageMode.decreaseNextIndentRegexForScopeDescriptor(['source.go'])
|
||||||
|
|
||||||
expect(decreaseNextIndentRegex.testSync(' fmt.Println("something"))')).toBeTruthy()
|
expect(decreaseNextIndentRegex.findNextMatchSync(' fmt.Println("something"))')).toBeTruthy()
|
||||||
expect(decreaseNextIndentRegex.testSync(' fmt.Println("something")),')).toBeTruthy()
|
expect(decreaseNextIndentRegex.findNextMatchSync(' fmt.Println("something")),')).toBeTruthy()
|
||||||
expect(decreaseNextIndentRegex.testSync(' fmt.Println("something"), "x"),')).toBeTruthy()
|
expect(decreaseNextIndentRegex.findNextMatchSync(' fmt.Println("something"), "x"),')).toBeTruthy()
|
||||||
expect(decreaseNextIndentRegex.testSync(' fmt.Println(fmt.Sprint("something"))),')).toBeTruthy()
|
expect(decreaseNextIndentRegex.findNextMatchSync(' fmt.Println(fmt.Sprint("something"))),')).toBeTruthy()
|
||||||
expect(decreaseNextIndentRegex.testSync(' fmt.Println(fmt.Sprint("something"), "x")),')).toBeTruthy()
|
expect(decreaseNextIndentRegex.findNextMatchSync(' fmt.Println(fmt.Sprint("something"), "x")),')).toBeTruthy()
|
||||||
|
|
||||||
expect(decreaseNextIndentRegex.testSync(' fmt.Println("something")')).toBeFalsy()
|
expect(decreaseNextIndentRegex.findNextMatchSync(' fmt.Println("something")')).toBeFalsy()
|
||||||
expect(decreaseNextIndentRegex.testSync(' fmt.Println("something"),')).toBeFalsy()
|
expect(decreaseNextIndentRegex.findNextMatchSync(' fmt.Println("something"),')).toBeFalsy()
|
||||||
|
|
||||||
# a line with many (), testing for catastrophic backtracking.
|
# a line with many (), testing for catastrophic backtracking.
|
||||||
# see https://github.com/atom/language-go/issues/78
|
# see https://github.com/atom/language-go/issues/78
|
||||||
longLine = 'first.second().third().fourth().fifth().sixth().seventh().eighth().ninth().tenth()'
|
longLine = 'first.second().third().fourth().fifth().sixth().seventh().eighth().ninth().tenth()'
|
||||||
expect(decreaseNextIndentRegex.testSync(longLine)).toBeFalsy()
|
expect(decreaseNextIndentRegex.findNextMatchSync(longLine)).toBeFalsy()
|
||||||
|
@ -18,66 +18,66 @@ describe 'Python settings', ->
|
|||||||
it 'matches lines correctly using the increaseIndentPattern', ->
|
it 'matches lines correctly using the increaseIndentPattern', ->
|
||||||
increaseIndentRegex = languageMode.increaseIndentRegexForScopeDescriptor(['source.python'])
|
increaseIndentRegex = languageMode.increaseIndentRegexForScopeDescriptor(['source.python'])
|
||||||
|
|
||||||
expect(increaseIndentRegex.testSync('for i in range(n):')).toBeTruthy()
|
expect(increaseIndentRegex.findNextMatchSync('for i in range(n):')).toBeTruthy()
|
||||||
expect(increaseIndentRegex.testSync(' for i in range(n):')).toBeTruthy()
|
expect(increaseIndentRegex.findNextMatchSync(' for i in range(n):')).toBeTruthy()
|
||||||
expect(increaseIndentRegex.testSync('async for i in range(n):')).toBeTruthy()
|
expect(increaseIndentRegex.findNextMatchSync('async for i in range(n):')).toBeTruthy()
|
||||||
expect(increaseIndentRegex.testSync(' async for i in range(n):')).toBeTruthy()
|
expect(increaseIndentRegex.findNextMatchSync(' async for i in range(n):')).toBeTruthy()
|
||||||
expect(increaseIndentRegex.testSync('class TheClass(Object):')).toBeTruthy()
|
expect(increaseIndentRegex.findNextMatchSync('class TheClass(Object):')).toBeTruthy()
|
||||||
expect(increaseIndentRegex.testSync(' class TheClass(Object):')).toBeTruthy()
|
expect(increaseIndentRegex.findNextMatchSync(' class TheClass(Object):')).toBeTruthy()
|
||||||
expect(increaseIndentRegex.testSync('def f(x):')).toBeTruthy()
|
expect(increaseIndentRegex.findNextMatchSync('def f(x):')).toBeTruthy()
|
||||||
expect(increaseIndentRegex.testSync(' def f(x):')).toBeTruthy()
|
expect(increaseIndentRegex.findNextMatchSync(' def f(x):')).toBeTruthy()
|
||||||
expect(increaseIndentRegex.testSync('async def f(x):')).toBeTruthy()
|
expect(increaseIndentRegex.findNextMatchSync('async def f(x):')).toBeTruthy()
|
||||||
expect(increaseIndentRegex.testSync(' async def f(x):')).toBeTruthy()
|
expect(increaseIndentRegex.findNextMatchSync(' async def f(x):')).toBeTruthy()
|
||||||
expect(increaseIndentRegex.testSync('if this_var == that_var:')).toBeTruthy()
|
expect(increaseIndentRegex.findNextMatchSync('if this_var == that_var:')).toBeTruthy()
|
||||||
expect(increaseIndentRegex.testSync(' if this_var == that_var:')).toBeTruthy()
|
expect(increaseIndentRegex.findNextMatchSync(' if this_var == that_var:')).toBeTruthy()
|
||||||
expect(increaseIndentRegex.testSync('elif this_var == that_var:')).toBeTruthy()
|
expect(increaseIndentRegex.findNextMatchSync('elif this_var == that_var:')).toBeTruthy()
|
||||||
expect(increaseIndentRegex.testSync(' elif this_var == that_var:')).toBeTruthy()
|
expect(increaseIndentRegex.findNextMatchSync(' elif this_var == that_var:')).toBeTruthy()
|
||||||
expect(increaseIndentRegex.testSync('else:')).toBeTruthy()
|
expect(increaseIndentRegex.findNextMatchSync('else:')).toBeTruthy()
|
||||||
expect(increaseIndentRegex.testSync(' else:')).toBeTruthy()
|
expect(increaseIndentRegex.findNextMatchSync(' else:')).toBeTruthy()
|
||||||
expect(increaseIndentRegex.testSync('except Exception:')).toBeTruthy()
|
expect(increaseIndentRegex.findNextMatchSync('except Exception:')).toBeTruthy()
|
||||||
expect(increaseIndentRegex.testSync(' except Exception:')).toBeTruthy()
|
expect(increaseIndentRegex.findNextMatchSync(' except Exception:')).toBeTruthy()
|
||||||
expect(increaseIndentRegex.testSync('except Exception as e:')).toBeTruthy()
|
expect(increaseIndentRegex.findNextMatchSync('except Exception as e:')).toBeTruthy()
|
||||||
expect(increaseIndentRegex.testSync(' except Exception as e:')).toBeTruthy()
|
expect(increaseIndentRegex.findNextMatchSync(' except Exception as e:')).toBeTruthy()
|
||||||
expect(increaseIndentRegex.testSync('finally:')).toBeTruthy()
|
expect(increaseIndentRegex.findNextMatchSync('finally:')).toBeTruthy()
|
||||||
expect(increaseIndentRegex.testSync(' finally:')).toBeTruthy()
|
expect(increaseIndentRegex.findNextMatchSync(' finally:')).toBeTruthy()
|
||||||
expect(increaseIndentRegex.testSync('with open("filename") as f:')).toBeTruthy()
|
expect(increaseIndentRegex.findNextMatchSync('with open("filename") as f:')).toBeTruthy()
|
||||||
expect(increaseIndentRegex.testSync(' with open("filename") as f:')).toBeTruthy()
|
expect(increaseIndentRegex.findNextMatchSync(' with open("filename") as f:')).toBeTruthy()
|
||||||
expect(increaseIndentRegex.testSync('async with open("filename") as f:')).toBeTruthy()
|
expect(increaseIndentRegex.findNextMatchSync('async with open("filename") as f:')).toBeTruthy()
|
||||||
expect(increaseIndentRegex.testSync(' async with open("filename") as f:')).toBeTruthy()
|
expect(increaseIndentRegex.findNextMatchSync(' async with open("filename") as f:')).toBeTruthy()
|
||||||
expect(increaseIndentRegex.testSync('while True:')).toBeTruthy()
|
expect(increaseIndentRegex.findNextMatchSync('while True:')).toBeTruthy()
|
||||||
expect(increaseIndentRegex.testSync(' while True:')).toBeTruthy()
|
expect(increaseIndentRegex.findNextMatchSync(' while True:')).toBeTruthy()
|
||||||
expect(increaseIndentRegex.testSync('\t\t while True:')).toBeTruthy()
|
expect(increaseIndentRegex.findNextMatchSync('\t\t while True:')).toBeTruthy()
|
||||||
|
|
||||||
it 'does not match lines incorrectly using the increaseIndentPattern', ->
|
it 'does not match lines incorrectly using the increaseIndentPattern', ->
|
||||||
increaseIndentRegex = languageMode.increaseIndentRegexForScopeDescriptor(['source.python'])
|
increaseIndentRegex = languageMode.increaseIndentRegexForScopeDescriptor(['source.python'])
|
||||||
|
|
||||||
expect(increaseIndentRegex.testSync('for i in range(n)')).toBeFalsy()
|
expect(increaseIndentRegex.findNextMatchSync('for i in range(n)')).toBeFalsy()
|
||||||
expect(increaseIndentRegex.testSync('class TheClass(Object)')).toBeFalsy()
|
expect(increaseIndentRegex.findNextMatchSync('class TheClass(Object)')).toBeFalsy()
|
||||||
expect(increaseIndentRegex.testSync('def f(x)')).toBeFalsy()
|
expect(increaseIndentRegex.findNextMatchSync('def f(x)')).toBeFalsy()
|
||||||
expect(increaseIndentRegex.testSync('if this_var == that_var')).toBeFalsy()
|
expect(increaseIndentRegex.findNextMatchSync('if this_var == that_var')).toBeFalsy()
|
||||||
expect(increaseIndentRegex.testSync('"for i in range(n):"')).toBeFalsy()
|
expect(increaseIndentRegex.findNextMatchSync('"for i in range(n):"')).toBeFalsy()
|
||||||
|
|
||||||
it 'matches lines correctly using the decreaseIndentPattern', ->
|
it 'matches lines correctly using the decreaseIndentPattern', ->
|
||||||
decreaseIndentRegex = languageMode.decreaseIndentRegexForScopeDescriptor(['source.python'])
|
decreaseIndentRegex = languageMode.decreaseIndentRegexForScopeDescriptor(['source.python'])
|
||||||
|
|
||||||
expect(decreaseIndentRegex.testSync('elif this_var == that_var:')).toBeTruthy()
|
expect(decreaseIndentRegex.findNextMatchSync('elif this_var == that_var:')).toBeTruthy()
|
||||||
expect(decreaseIndentRegex.testSync(' elif this_var == that_var:')).toBeTruthy()
|
expect(decreaseIndentRegex.findNextMatchSync(' elif this_var == that_var:')).toBeTruthy()
|
||||||
expect(decreaseIndentRegex.testSync('else:')).toBeTruthy()
|
expect(decreaseIndentRegex.findNextMatchSync('else:')).toBeTruthy()
|
||||||
expect(decreaseIndentRegex.testSync(' else:')).toBeTruthy()
|
expect(decreaseIndentRegex.findNextMatchSync(' else:')).toBeTruthy()
|
||||||
expect(decreaseIndentRegex.testSync('except Exception:')).toBeTruthy()
|
expect(decreaseIndentRegex.findNextMatchSync('except Exception:')).toBeTruthy()
|
||||||
expect(decreaseIndentRegex.testSync(' except Exception:')).toBeTruthy()
|
expect(decreaseIndentRegex.findNextMatchSync(' except Exception:')).toBeTruthy()
|
||||||
expect(decreaseIndentRegex.testSync('except Exception as e:')).toBeTruthy()
|
expect(decreaseIndentRegex.findNextMatchSync('except Exception as e:')).toBeTruthy()
|
||||||
expect(decreaseIndentRegex.testSync(' except Exception as e:')).toBeTruthy()
|
expect(decreaseIndentRegex.findNextMatchSync(' except Exception as e:')).toBeTruthy()
|
||||||
expect(decreaseIndentRegex.testSync('finally:')).toBeTruthy()
|
expect(decreaseIndentRegex.findNextMatchSync('finally:')).toBeTruthy()
|
||||||
expect(decreaseIndentRegex.testSync(' finally:')).toBeTruthy()
|
expect(decreaseIndentRegex.findNextMatchSync(' finally:')).toBeTruthy()
|
||||||
expect(decreaseIndentRegex.testSync('\t\t finally:')).toBeTruthy()
|
expect(decreaseIndentRegex.findNextMatchSync('\t\t finally:')).toBeTruthy()
|
||||||
|
|
||||||
it 'does not match lines incorrectly using the decreaseIndentPattern', ->
|
it 'does not match lines incorrectly using the decreaseIndentPattern', ->
|
||||||
decreaseIndentRegex = languageMode.decreaseIndentRegexForScopeDescriptor(['source.python'])
|
decreaseIndentRegex = languageMode.decreaseIndentRegexForScopeDescriptor(['source.python'])
|
||||||
|
|
||||||
# NOTE! This first one is different from most other rote tests here.
|
# NOTE! This first one is different from most other rote tests here.
|
||||||
expect(decreaseIndentRegex.testSync('else: expression()')).toBeFalsy()
|
expect(decreaseIndentRegex.findNextMatchSync('else: expression()')).toBeFalsy()
|
||||||
expect(decreaseIndentRegex.testSync('elif this_var == that_var')).toBeFalsy()
|
expect(decreaseIndentRegex.findNextMatchSync('elif this_var == that_var')).toBeFalsy()
|
||||||
expect(decreaseIndentRegex.testSync(' elif this_var == that_var')).toBeFalsy()
|
expect(decreaseIndentRegex.findNextMatchSync(' elif this_var == that_var')).toBeFalsy()
|
||||||
expect(decreaseIndentRegex.testSync('else')).toBeFalsy()
|
expect(decreaseIndentRegex.findNextMatchSync('else')).toBeFalsy()
|
||||||
expect(decreaseIndentRegex.testSync(' "finally:"')).toBeFalsy()
|
expect(decreaseIndentRegex.findNextMatchSync(' "finally:"')).toBeFalsy()
|
||||||
|
@ -5,13 +5,14 @@ const temp = require('temp').track();
|
|||||||
const TextBuffer = require('text-buffer');
|
const TextBuffer = require('text-buffer');
|
||||||
const GrammarRegistry = require('../src/grammar-registry');
|
const GrammarRegistry = require('../src/grammar-registry');
|
||||||
const TreeSitterGrammar = require('../src/tree-sitter-grammar');
|
const TreeSitterGrammar = require('../src/tree-sitter-grammar');
|
||||||
const FirstMate = require('first-mate');
|
const SecondMate = require('second-mate');
|
||||||
const { OnigRegExp } = require('oniguruma');
|
const { OnigScanner } = SecondMate;
|
||||||
|
|
||||||
describe('GrammarRegistry', () => {
|
describe('GrammarRegistry', () => {
|
||||||
let grammarRegistry;
|
let grammarRegistry;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(async () => {
|
||||||
|
await SecondMate.ready
|
||||||
grammarRegistry = new GrammarRegistry({ config: atom.config });
|
grammarRegistry = new GrammarRegistry({ config: atom.config });
|
||||||
expect(subscriptionCount(grammarRegistry)).toBe(1);
|
expect(subscriptionCount(grammarRegistry)).toBe(1);
|
||||||
});
|
});
|
||||||
@ -102,7 +103,7 @@ describe('GrammarRegistry', () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const grammar = grammarRegistry.grammarForId('source.js');
|
const grammar = grammarRegistry.grammarForId('source.js');
|
||||||
expect(grammar instanceof FirstMate.Grammar).toBe(true);
|
expect(grammar instanceof SecondMate.Grammar).toBe(true);
|
||||||
expect(grammar.scopeName).toBe('source.js');
|
expect(grammar.scopeName).toBe('source.js');
|
||||||
|
|
||||||
grammarRegistry.removeGrammar(grammar);
|
grammarRegistry.removeGrammar(grammar);
|
||||||
@ -127,7 +128,7 @@ describe('GrammarRegistry', () => {
|
|||||||
|
|
||||||
grammarRegistry.removeGrammar(grammar);
|
grammarRegistry.removeGrammar(grammar);
|
||||||
expect(
|
expect(
|
||||||
grammarRegistry.grammarForId('source.js') instanceof FirstMate.Grammar
|
grammarRegistry.grammarForId('source.js') instanceof SecondMate.Grammar
|
||||||
).toBe(true);
|
).toBe(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -560,7 +561,7 @@ describe('GrammarRegistry', () => {
|
|||||||
|
|
||||||
const grammar = grammarRegistry.selectGrammar('test.js');
|
const grammar = grammarRegistry.selectGrammar('test.js');
|
||||||
expect(grammar.scopeName).toBe('source.js');
|
expect(grammar.scopeName).toBe('source.js');
|
||||||
expect(grammar instanceof FirstMate.Grammar).toBe(true);
|
expect(grammar instanceof SecondMate.Grammar).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('favors a tree-sitter grammar over a text-mate grammar when `core.useTreeSitterParsers` is true', () => {
|
it('favors a tree-sitter grammar over a text-mate grammar when `core.useTreeSitterParsers` is true', () => {
|
||||||
@ -766,7 +767,7 @@ describe('GrammarRegistry', () => {
|
|||||||
grammarRegistry.addGrammar(grammar1);
|
grammarRegistry.addGrammar(grammar1);
|
||||||
const grammar2 = {
|
const grammar2 = {
|
||||||
name: 'foo++',
|
name: 'foo++',
|
||||||
contentRegex: new OnigRegExp('.*bar'),
|
contentRegex: new OnigScanner(['.*bar']),
|
||||||
fileTypes: ['foo']
|
fileTypes: ['foo']
|
||||||
};
|
};
|
||||||
grammarRegistry.addGrammar(grammar2);
|
grammarRegistry.addGrammar(grammar2);
|
||||||
|
@ -13,7 +13,7 @@ const NullGrammar = require('./null-grammar');
|
|||||||
const TextMateLanguageMode = require('./text-mate-language-mode');
|
const TextMateLanguageMode = require('./text-mate-language-mode');
|
||||||
const ScopeDescriptor = require('./scope-descriptor');
|
const ScopeDescriptor = require('./scope-descriptor');
|
||||||
|
|
||||||
const TextMateScopeSelector = require('first-mate').ScopeSelector;
|
const TextMateScopeSelector = require('second-mate').ScopeSelector;
|
||||||
const GutterContainer = require('./gutter-container');
|
const GutterContainer = require('./gutter-container');
|
||||||
let TextEditorComponent = null;
|
let TextEditorComponent = null;
|
||||||
let TextEditorElement = null;
|
let TextEditorElement = null;
|
||||||
|
@ -5,7 +5,7 @@ const TokenizedLine = require('./tokenized-line');
|
|||||||
const TokenIterator = require('./token-iterator');
|
const TokenIterator = require('./token-iterator');
|
||||||
const ScopeDescriptor = require('./scope-descriptor');
|
const ScopeDescriptor = require('./scope-descriptor');
|
||||||
const NullGrammar = require('./null-grammar');
|
const NullGrammar = require('./null-grammar');
|
||||||
const { OnigRegExp } = require('oniguruma');
|
const { OnigScanner } = require('second-mate');
|
||||||
const {
|
const {
|
||||||
toFirstMateScopeId,
|
toFirstMateScopeId,
|
||||||
fromFirstMateScopeId
|
fromFirstMateScopeId
|
||||||
@ -144,7 +144,7 @@ class TextMateLanguageMode {
|
|||||||
);
|
);
|
||||||
if (!decreaseIndentRegex) return;
|
if (!decreaseIndentRegex) return;
|
||||||
|
|
||||||
if (!decreaseIndentRegex.testSync(line)) return;
|
if (!decreaseIndentRegex.findNextMatchSync(line)) return;
|
||||||
|
|
||||||
const precedingRow = this.buffer.previousNonBlankRow(bufferRow);
|
const precedingRow = this.buffer.previousNonBlankRow(bufferRow);
|
||||||
if (precedingRow == null) return;
|
if (precedingRow == null) return;
|
||||||
@ -156,14 +156,14 @@ class TextMateLanguageMode {
|
|||||||
scopeDescriptor
|
scopeDescriptor
|
||||||
);
|
);
|
||||||
if (increaseIndentRegex) {
|
if (increaseIndentRegex) {
|
||||||
if (!increaseIndentRegex.testSync(precedingLine)) desiredIndentLevel -= 1;
|
if (!increaseIndentRegex.findNextMatchSync(precedingLine)) desiredIndentLevel -= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
const decreaseNextIndentRegex = this.decreaseNextIndentRegexForScopeDescriptor(
|
const decreaseNextIndentRegex = this.decreaseNextIndentRegexForScopeDescriptor(
|
||||||
scopeDescriptor
|
scopeDescriptor
|
||||||
);
|
);
|
||||||
if (decreaseNextIndentRegex) {
|
if (decreaseNextIndentRegex) {
|
||||||
if (decreaseNextIndentRegex.testSync(precedingLine))
|
if (decreaseNextIndentRegex.findNextMatchSync(precedingLine))
|
||||||
desiredIndentLevel -= 1;
|
desiredIndentLevel -= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -203,17 +203,17 @@ class TextMateLanguageMode {
|
|||||||
if (!increaseIndentRegex) return desiredIndentLevel;
|
if (!increaseIndentRegex) return desiredIndentLevel;
|
||||||
|
|
||||||
if (!this.isRowCommented(precedingRow)) {
|
if (!this.isRowCommented(precedingRow)) {
|
||||||
if (increaseIndentRegex && increaseIndentRegex.testSync(precedingLine))
|
if (increaseIndentRegex && increaseIndentRegex.findNextMatchSync(precedingLine))
|
||||||
desiredIndentLevel += 1;
|
desiredIndentLevel += 1;
|
||||||
if (
|
if (
|
||||||
decreaseNextIndentRegex &&
|
decreaseNextIndentRegex &&
|
||||||
decreaseNextIndentRegex.testSync(precedingLine)
|
decreaseNextIndentRegex.findNextMatchSync(precedingLine)
|
||||||
)
|
)
|
||||||
desiredIndentLevel -= 1;
|
desiredIndentLevel -= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.buffer.isRowBlank(precedingRow)) {
|
if (!this.buffer.isRowBlank(precedingRow)) {
|
||||||
if (decreaseIndentRegex && decreaseIndentRegex.testSync(line))
|
if (decreaseIndentRegex && decreaseIndentRegex.findNextMatchSync(line))
|
||||||
desiredIndentLevel -= 1;
|
desiredIndentLevel -= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -848,7 +848,7 @@ class TextMateLanguageMode {
|
|||||||
regexForPattern(pattern) {
|
regexForPattern(pattern) {
|
||||||
if (pattern) {
|
if (pattern) {
|
||||||
if (!this.regexesByPattern[pattern]) {
|
if (!this.regexesByPattern[pattern]) {
|
||||||
this.regexesByPattern[pattern] = new OnigRegExp(pattern);
|
this.regexesByPattern[pattern] = new OnigScanner([pattern]);
|
||||||
}
|
}
|
||||||
return this.regexesByPattern[pattern];
|
return this.regexesByPattern[pattern];
|
||||||
}
|
}
|
||||||
|
25
yarn.lock
25
yarn.lock
@ -2662,7 +2662,6 @@ braces@~3.0.2:
|
|||||||
"bracket-matcher@file:packages/bracket-matcher":
|
"bracket-matcher@file:packages/bracket-matcher":
|
||||||
version "0.92.0"
|
version "0.92.0"
|
||||||
dependencies:
|
dependencies:
|
||||||
first-mate "^7.4.1"
|
|
||||||
underscore-plus "1.x"
|
underscore-plus "1.x"
|
||||||
|
|
||||||
browser-stdout@1.3.1:
|
browser-stdout@1.3.1:
|
||||||
@ -3990,7 +3989,7 @@ electron@12.2.3:
|
|||||||
"@types/node" "^14.6.2"
|
"@types/node" "^14.6.2"
|
||||||
extract-zip "^1.0.3"
|
extract-zip "^1.0.3"
|
||||||
|
|
||||||
emissary@^1, emissary@^1.0.0, emissary@^1.1.0, emissary@^1.2.0, emissary@^1.3.2, emissary@^1.3.3:
|
emissary@^1.0.0, emissary@^1.1.0, emissary@^1.2.0, emissary@^1.3.2, emissary@^1.3.3:
|
||||||
version "1.3.3"
|
version "1.3.3"
|
||||||
resolved "https://registry.yarnpkg.com/emissary/-/emissary-1.3.3.tgz#a618d92d682b232d31111dc3625a5df661799606"
|
resolved "https://registry.yarnpkg.com/emissary/-/emissary-1.3.3.tgz#a618d92d682b232d31111dc3625a5df661799606"
|
||||||
integrity sha512-pD6FWNBSlEOzSJDCTcSGVLgNnGw5fnCvvGMdQ/TN43efeXZ/QTq8+hZoK3OOEXPRNjMmSJmeOnEJh+bWT5O8rQ==
|
integrity sha512-pD6FWNBSlEOzSJDCTcSGVLgNnGw5fnCvvGMdQ/TN43efeXZ/QTq8+hZoK3OOEXPRNjMmSJmeOnEJh+bWT5O8rQ==
|
||||||
@ -4389,7 +4388,7 @@ etch@^0.12.2, etch@^0.12.6:
|
|||||||
resolved "https://registry.yarnpkg.com/etch/-/etch-0.12.8.tgz#c24bc9bd3a6148f62204ce8643d2e899b9ecb9de"
|
resolved "https://registry.yarnpkg.com/etch/-/etch-0.12.8.tgz#c24bc9bd3a6148f62204ce8643d2e899b9ecb9de"
|
||||||
integrity sha512-dFLRe4wLroVtwzyy1vGlE3BSDZHiL0kZME5XgNGzZIULcYTvVno8vbiIleAesoKJmwWaxDTzG+4eppg2zk14JQ==
|
integrity sha512-dFLRe4wLroVtwzyy1vGlE3BSDZHiL0kZME5XgNGzZIULcYTvVno8vbiIleAesoKJmwWaxDTzG+4eppg2zk14JQ==
|
||||||
|
|
||||||
event-kit@2.5.3, event-kit@^2.0.0, event-kit@^2.1.0, event-kit@^2.2.0, event-kit@^2.4.0, event-kit@^2.5.3:
|
event-kit@2.5.3, event-kit@^2.0.0, event-kit@^2.1.0, event-kit@^2.4.0, event-kit@^2.5.3:
|
||||||
version "2.5.3"
|
version "2.5.3"
|
||||||
resolved "https://registry.yarnpkg.com/event-kit/-/event-kit-2.5.3.tgz#d47e4bc116ec0aacd00263791fa1a55eb5e79ba1"
|
resolved "https://registry.yarnpkg.com/event-kit/-/event-kit-2.5.3.tgz#d47e4bc116ec0aacd00263791fa1a55eb5e79ba1"
|
||||||
integrity sha512-b7Qi1JNzY4BfAYfnIRanLk0DOD1gdkWHT4GISIn8Q2tAf3LpU8SP2CMwWaq40imYoKWbtN4ZhbSRxvsnikooZQ==
|
integrity sha512-b7Qi1JNzY4BfAYfnIRanLk0DOD1gdkWHT4GISIn8Q2tAf3LpU8SP2CMwWaq40imYoKWbtN4ZhbSRxvsnikooZQ==
|
||||||
@ -4604,19 +4603,6 @@ find-up@^5.0.0:
|
|||||||
locate-path "^6.0.0"
|
locate-path "^6.0.0"
|
||||||
path-exists "^4.0.0"
|
path-exists "^4.0.0"
|
||||||
|
|
||||||
first-mate@^7.4.1:
|
|
||||||
version "7.4.3"
|
|
||||||
resolved "https://registry.yarnpkg.com/first-mate/-/first-mate-7.4.3.tgz#058b9b6d2f43e38a5f0952669338cff2c46ae2dd"
|
|
||||||
integrity sha512-PtZUpaPmcV5KV4Rw5TfwczEnExN+X1o3Q/G82E4iRJ0tW91fm3Yi7pa5t4cBH8r3D6EyoBKvfpG2jKE+TZ0/nw==
|
|
||||||
dependencies:
|
|
||||||
emissary "^1"
|
|
||||||
event-kit "^2.2.0"
|
|
||||||
fs-plus "^3.0.0"
|
|
||||||
grim "^2.0.1"
|
|
||||||
oniguruma "^7.2.3"
|
|
||||||
season "^6.0.2"
|
|
||||||
underscore-plus "^1"
|
|
||||||
|
|
||||||
flat-cache@^3.0.4:
|
flat-cache@^3.0.4:
|
||||||
version "3.0.4"
|
version "3.0.4"
|
||||||
resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-3.0.4.tgz#61b0338302b2fe9f957dcc32fc2a87f1c3048b11"
|
resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-3.0.4.tgz#61b0338302b2fe9f957dcc32fc2a87f1c3048b11"
|
||||||
@ -7421,13 +7407,6 @@ onetime@^5.1.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
mimic-fn "^2.1.0"
|
mimic-fn "^2.1.0"
|
||||||
|
|
||||||
oniguruma@^7.2.3:
|
|
||||||
version "7.2.3"
|
|
||||||
resolved "https://registry.yarnpkg.com/oniguruma/-/oniguruma-7.2.3.tgz#e0b0b415302de8cdd6564e57a1a822ac0ab57012"
|
|
||||||
integrity sha512-PZZcE0yfg8Q1IvaJImh21RUTHl8ep0zwwyoE912KqlWVrsGByjjj29sdACcD1BFyX2bLkfuOJeP+POzAGVWtbA==
|
|
||||||
dependencies:
|
|
||||||
nan "^2.14.0"
|
|
||||||
|
|
||||||
"open-on-github@file:packages/open-on-github":
|
"open-on-github@file:packages/open-on-github":
|
||||||
version "1.3.2"
|
version "1.3.2"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user