report line:ch in live-preview errors for usercss
This commit is contained in:
parent
66704a78b3
commit
dbba338229
|
@ -623,6 +623,10 @@ onDOMscriptReady('/codemirror.js').then(() => {
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
errors.classList.add('hidden');
|
errors.classList.add('hidden');
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
|
if (err && editor && !Number.isNaN(err.index)) {
|
||||||
|
const pos = editors[0].posFromIndex(err.index);
|
||||||
|
err = `${pos.line}:${pos.ch} ${err}`;
|
||||||
|
}
|
||||||
errors.classList.remove('hidden');
|
errors.classList.remove('hidden');
|
||||||
errors.onclick = () => messageBox.alert(String(err), 'pre');
|
errors.onclick = () => messageBox.alert(String(err), 'pre');
|
||||||
});
|
});
|
||||||
|
|
|
@ -450,8 +450,8 @@ var usercss = (() => {
|
||||||
try {
|
try {
|
||||||
doParse();
|
doParse();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// grab additional info
|
// the source code string offset
|
||||||
e.index = metaIndex;
|
e.index = metaIndex + state.re.lastIndex;
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user