Fix & rename scoped state variable
This commit is contained in:
parent
1a630033bd
commit
a3e149a30e
20
edit/edit.js
20
edit/edit.js
|
@ -1014,7 +1014,8 @@ function updateLintReport(cm, delay) {
|
||||||
setTimeout(cm => { cm.performLint(); update(cm); }, delay, cm);
|
setTimeout(cm => { cm.performLint(); update(cm); }, delay, cm);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const state = cm.state.lint;
|
// eslint-disable-next-line no-var
|
||||||
|
var state = cm.state.lint;
|
||||||
if (!state) {
|
if (!state) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1028,13 +1029,12 @@ function updateLintReport(cm, delay) {
|
||||||
const scope = cm ? [cm] : editors;
|
const scope = cm ? [cm] : editors;
|
||||||
let changed = false;
|
let changed = false;
|
||||||
let fixedOldIssues = false;
|
let fixedOldIssues = false;
|
||||||
let state;
|
|
||||||
scope.forEach(function(cm) {
|
scope.forEach(function(cm) {
|
||||||
state = cm.state.lint || {};
|
const scopedState = cm.state.lint || {};
|
||||||
const oldMarkers = state.markedLast || {};
|
const oldMarkers = scopedState.markedLast || {};
|
||||||
const newMarkers = {};
|
const newMarkers = {};
|
||||||
const html = !state.marked || state.marked.length == 0 ? '' : '<tbody>' +
|
const html = !scopedState.marked || scopedState.marked.length == 0 ? '' : '<tbody>' +
|
||||||
state.marked.map(function(mark) {
|
scopedState.marked.map(function(mark) {
|
||||||
const info = mark.__annotation;
|
const info = mark.__annotation;
|
||||||
const isActiveLine = info.from.line == cm.getCursor().line;
|
const isActiveLine = info.from.line == cm.getCursor().line;
|
||||||
const pos = isActiveLine ? 'cursor' : (info.from.line + ',' + info.from.ch);
|
const pos = isActiveLine ? 'cursor' : (info.from.line + ',' + info.from.ch);
|
||||||
|
@ -1054,10 +1054,10 @@ function updateLintReport(cm, delay) {
|
||||||
'<td role="col">' + (info.from.ch + 1) + '</td>' +
|
'<td role="col">' + (info.from.ch + 1) + '</td>' +
|
||||||
'<td role="message">' + message + '</td></tr>';
|
'<td role="message">' + message + '</td></tr>';
|
||||||
}).join('') + '</tbody>';
|
}).join('') + '</tbody>';
|
||||||
state.markedLast = newMarkers;
|
scopedState.markedLast = newMarkers;
|
||||||
fixedOldIssues |= state.reportDisplayed && Object.keys(oldMarkers).length > 0;
|
fixedOldIssues |= scopedState.reportDisplayed && Object.keys(oldMarkers).length > 0;
|
||||||
if (state.html != html) {
|
if (scopedState.html != html) {
|
||||||
state.html = html;
|
scopedState.html = html;
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user