Fix: lint initialize issue

This commit is contained in:
eight 2017-09-19 07:41:57 +08:00
parent d1964bbc16
commit ba4c06ae82

View File

@ -131,10 +131,9 @@ function initLint() {
$('#lint h2').addEventListener('click', toggleLintReport); $('#lint h2').addEventListener('click', toggleLintReport);
} }
linterConfig.loadAll(); linterConfig.loadAll().then(updateLinter);
linterConfig.watchStorage(); linterConfig.watchStorage();
prefs.subscribe(['editor.linter'], updateLinter); prefs.subscribe(['editor.linter'], updateLinter);
updateLinter();
} }
function updateLinter({immediately} = {}) { function updateLinter({immediately} = {}) {
@ -531,8 +530,8 @@ function loadLinterAssets(name = prefs.get('editor.linter')) {
} }
function loadAddon() { function loadAddon() {
if ($('script[src$="/vendor/codemirror/addon/lint/lint.js"]')) { if (CodeMirror.lint) {
return Promise.resolve(); return;
} }
return loadScript([ return loadScript([
'/vendor/codemirror/addon/lint/lint.css', '/vendor/codemirror/addon/lint/lint.css',