Fix: cache metaIndex
This commit is contained in:
parent
e3316aa811
commit
d335c87601
|
@ -4,6 +4,7 @@
|
||||||
function createMetaCompiler(cm) {
|
function createMetaCompiler(cm) {
|
||||||
const successCallbacks = [];
|
const successCallbacks = [];
|
||||||
let meta = null;
|
let meta = null;
|
||||||
|
let metaIndex = null;
|
||||||
let cache = [];
|
let cache = [];
|
||||||
|
|
||||||
linter.register((text, options, _cm) => {
|
linter.register((text, options, _cm) => {
|
||||||
|
@ -14,7 +15,7 @@ function createMetaCompiler(cm) {
|
||||||
if (!match) {
|
if (!match) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
if (match[0] === meta) {
|
if (match[0] === meta && match.index === metaIndex) {
|
||||||
return cache;
|
return cache;
|
||||||
}
|
}
|
||||||
return parseMeta(match[0])
|
return parseMeta(match[0])
|
||||||
|
@ -23,10 +24,12 @@ function createMetaCompiler(cm) {
|
||||||
cb(result);
|
cb(result);
|
||||||
}
|
}
|
||||||
meta = match[0];
|
meta = match[0];
|
||||||
|
metaIndex = match.index;
|
||||||
cache = [];
|
cache = [];
|
||||||
return cache;
|
return cache;
|
||||||
}, err => {
|
}, err => {
|
||||||
meta = match[0];
|
meta = match[0];
|
||||||
|
metaIndex = match.index;
|
||||||
cache = [{
|
cache = [{
|
||||||
from: cm.posFromIndex((err.index || 0) + match.index),
|
from: cm.posFromIndex((err.index || 0) + match.index),
|
||||||
to: cm.posFromIndex((err.index || 0) + match.index),
|
to: cm.posFromIndex((err.index || 0) + match.index),
|
||||||
|
|
Loading…
Reference in New Issue
Block a user