Change: use editorWorker.metalint
This commit is contained in:
parent
5778d5c858
commit
f47d57aea8
|
@ -1,4 +1,4 @@
|
|||
/* global linter */
|
||||
/* global linter editorWorker */
|
||||
'use strict';
|
||||
|
||||
function createMetaCompiler(cm) {
|
||||
|
@ -18,25 +18,23 @@ function createMetaCompiler(cm) {
|
|||
if (match[0] === meta && match.index === metaIndex) {
|
||||
return cache;
|
||||
}
|
||||
return API.parseUsercss({sourceCode: match[0], metaOnly: true})
|
||||
.then(result => result.usercssData)
|
||||
.then(result => {
|
||||
return editorWorker.metalint(match[0])
|
||||
.then(({metadata, errors}) => {
|
||||
if (!errors.length) {
|
||||
for (const cb of updateListeners) {
|
||||
cb(result);
|
||||
cb(metadata);
|
||||
}
|
||||
meta = match[0];
|
||||
metaIndex = match.index;
|
||||
cache = [];
|
||||
return cache;
|
||||
}, err => {
|
||||
meta = match[0];
|
||||
metaIndex = match.index;
|
||||
cache = [{
|
||||
}
|
||||
cache = errors.map(err =>
|
||||
({
|
||||
from: cm.posFromIndex((err.index || 0) + match.index),
|
||||
to: cm.posFromIndex((err.index || 0) + match.index),
|
||||
message: err.message,
|
||||
severity: 'error'
|
||||
}];
|
||||
severity: err.code === 'unknownMeta' ? 'warning' : 'error'
|
||||
})
|
||||
);
|
||||
meta = match[0];
|
||||
metaIndex = match.index;
|
||||
return cache;
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue
Block a user