usercss: don't relint on save; mode is an object once initialized
This commit is contained in:
parent
a61ee5f093
commit
71f3dfbffd
|
@ -32,10 +32,8 @@ var linterConfig = {
|
||||||
getName() {
|
getName() {
|
||||||
// some dirty hacks to override editor.linter getting from prefs
|
// some dirty hacks to override editor.linter getting from prefs
|
||||||
const linter = prefs.get('editor.linter');
|
const linter = prefs.get('editor.linter');
|
||||||
if (linter && editors[0] && editors[0].getOption('mode') !== 'css') {
|
const mode = linter && editors[0] && editors[0].doc.mode;
|
||||||
return 'stylelint';
|
return mode && mode !== 'css' && mode.name !== 'css' ? 'stylelint' : linter;
|
||||||
}
|
|
||||||
return linter;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
getCurrent(linter = linterConfig.getName()) {
|
getCurrent(linter = linterConfig.getName()) {
|
||||||
|
|
|
@ -59,10 +59,16 @@ function createSourceEditor(style) {
|
||||||
|
|
||||||
function initLinterSwitch() {
|
function initLinterSwitch() {
|
||||||
const linterEl = $('#editor.linter');
|
const linterEl = $('#editor.linter');
|
||||||
|
let prevMode = NaN;
|
||||||
cm.on('optionChange', (cm, option) => {
|
cm.on('optionChange', (cm, option) => {
|
||||||
if (option !== 'mode') {
|
if (option !== 'mode') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
const mode = cm.doc.mode;
|
||||||
|
if (mode === prevMode || mode && mode.name === prevMode) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
prevMode = mode;
|
||||||
updateLinter();
|
updateLinter();
|
||||||
update();
|
update();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user