diff --git a/edit.html b/edit.html
index d99c00c9..3f5e08f0 100644
--- a/edit.html
+++ b/edit.html
@@ -25,7 +25,7 @@
-
+
@@ -65,6 +65,8 @@
+
+
@@ -87,6 +89,14 @@
+
+
+
+
+
+
+
+
diff --git a/edit/codemirror-editing-hooks.js b/edit/codemirror-editing-hooks.js
index 4297eb05..1b918112 100644
--- a/edit/codemirror-editing-hooks.js
+++ b/edit/codemirror-editing-hooks.js
@@ -1,5 +1,5 @@
/*
-global CodeMirror linterConfig loadScript
+global CodeMirror loadScript
global editors editor styleId ownTabId
global save toggleStyle setupAutocomplete makeSectionVisible getSectionForChild
global getSectionsHashes
@@ -8,9 +8,6 @@ global messageBox
'use strict';
onDOMscriptReady('/codemirror.js').then(() => {
-
- CodeMirror.defaults.lint = linterConfig.getForCodeMirror();
-
const COMMANDS = {
save,
toggleStyle,
diff --git a/edit/source-editor.js b/edit/source-editor.js
index 4b91e4f2..dcc1a4f1 100644
--- a/edit/source-editor.js
+++ b/edit/source-editor.js
@@ -1,10 +1,10 @@
/*
global editors styleId: true
global CodeMirror dirtyReporter
-global updateLintReportIfEnabled initLint linterConfig updateLinter
global createAppliesToLineWidget messageBox
global sectionsToMozFormat
global beforeUnload
+global createMetaCompiler linter
*/
'use strict';
@@ -44,7 +44,6 @@ function createSourceEditor(style) {
cm.on('changes', () => {
dirty.modify('sourceGeneration', savedGeneration, cm.changeGeneration());
- updateLintReportIfEnabled(cm);
});
CodeMirror.commands.prevEditor = cm => nextPrevMozDocument(cm, -1);
@@ -55,9 +54,17 @@ function createSourceEditor(style) {
cm.operation(initAppliesToLineWidget);
- updateMeta().then(() => {
+ const metaCompiler = createMetaCompiler(cm);
+ metaCompiler.onSuccess(meta => {
+ style.usercssData = meta;
+ style.name = meta.name;
+ style.url = meta.homepageURL;
+ updateMeta();
+ });
- initLint();
+ linter.hook(cm);
+
+ updateMeta().then(() => {
let prevMode = NaN;
cm.on('optionChange', (cm, option) => {
@@ -65,7 +72,7 @@ function createSourceEditor(style) {
const mode = getModeName();
if (mode === prevMode) return;
prevMode = mode;
- updateLinter();
+ linter.refresh();
updateLinterSwitch();
});
@@ -88,7 +95,7 @@ function createSourceEditor(style) {
function updateLinterSwitch() {
const el = $('#editor.linter');
- el.value = linterConfig.getName();
+ el.value = getCurrentLinter();
const cssLintOption = $('[value="csslint"]', el);
const mode = getModeName();
if (mode !== 'css') {
@@ -100,6 +107,14 @@ function createSourceEditor(style) {
}
}
+ function getCurrentLinter() {
+ const name = prefs.get('editor.linter');
+ if (cm.getOption('mode') === 'stylus' && name === 'csslint') {
+ return 'stylelint';
+ }
+ return name;
+ }
+
function setupNewStyle(style) {
style.sections[0].code = ' '.repeat(prefs.get('editor.tabSize')) +
`/* ${t('usercssReplaceTemplateSectionBody')} */`;