fix linting when style was initially error-free

regressed in e6f94378
This commit is contained in:
tophf 2020-12-10 10:59:28 +03:00
parent 0b540fbabd
commit 579750fbc0
2 changed files with 7 additions and 3 deletions

View File

@ -29,6 +29,7 @@ const linter = (() => {
* update when lint gutter is added to a lot of editors simultaneously. * update when lint gutter is added to a lot of editors simultaneously.
*/ */
enableForEditor(cm, code) { enableForEditor(cm, code) {
if (cms.has(cm)) return;
if (code) return enableOnProblems(cm, code); if (code) return enableOnProblems(cm, code);
cm.setOption('lint', {getAnnotations, onUpdateLinting}); cm.setOption('lint', {getAnnotations, onUpdateLinting});
cms.add(cm); cms.add(cm);

View File

@ -651,8 +651,11 @@ function SectionsEditor() {
} }
function refreshOnView(cm, {code, force} = {}) { function refreshOnView(cm, {code, force} = {}) {
if (code) {
linter.enableForEditor(cm, code);
}
if (force || !xo) { if (force || !xo) {
refreshOnViewNow(cm, code); refreshOnViewNow(cm);
} else { } else {
xo.observe(cm.display.wrapper); xo.observe(cm.display.wrapper);
} }
@ -674,9 +677,9 @@ function SectionsEditor() {
} }
} }
async function refreshOnViewNow(cm, code) { async function refreshOnViewNow(cm) {
linter.enableForEditor(cm);
cm.refresh(); cm.refresh();
linter.enableForEditor(cm, code);
} }
function toggleContextMenuDelete(event) { function toggleContextMenuDelete(event) {