diff --git a/extension.js b/extension.js index 931499f3..23d6708b 100644 --- a/extension.js +++ b/extension.js @@ -21,7 +21,7 @@ exports.activate = function activateStylelint(context) { } } }, { - documentSelector: ['css', 'sass'], + documentSelector: ['css', 'sass', 'less'], synchronize: { configurationSection: 'stylelint', fileEvents: vscode.workspace.createFileSystemWatcher('**/{.stylelintrc,stylelint.config.js}') diff --git a/server.js b/server.js index f60db2e6..3d28b83f 100644 --- a/server.js +++ b/server.js @@ -12,13 +12,18 @@ let configOverrides; const connection = langServer.createConnection(process.stdin, process.stdout); const documents = new langServer.TextDocuments(); +const syntaxConfig = { + '.scss': 'scss', + '.less': 'less' +}; + function validate(document) { return stylelintVSCode({ code: document.getText(), config, configOverrides, configBasedir, - syntax: path.extname(String(document.uri)).toLowerCase() === '.scss' ? 'scss' : null + syntax: syntaxConfig[path.extname(String(document.uri)).toLowerCase()] }).then(diagnostics => { connection.sendDiagnostics({uri: document.uri, diagnostics}); }).catch(err => {