forked from hex-ci/vscode-stylelint-plus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
39 lines (33 loc) · 1.12 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
'use strict';
const {LanguageClient, SettingMonitor} = require('vscode-languageclient');
const {workspace} = require('vscode');
const {activationEvents} = require('./package.json');
const documentSelector = [];
for (const activationEvent of activationEvents) {
if (activationEvent.startsWith('onLanguage:')) {
const language = activationEvent.replace('onLanguage:', '');
documentSelector.push({language, scheme: 'file'}, {language, scheme: 'untitled'});
}
}
exports.activate = ({subscriptions}) => {
const serverPath = require.resolve('./server.js');
const client = new LanguageClient('stylelint', {
run: {
module: serverPath
},
debug: {
module: serverPath,
options: {
execArgv: ['--nolazy', '--inspect=6004']
}
}
}, {
documentSelector,
diagnosticCollectionName: 'stylelint',
synchronize: {
configurationSection: 'stylelint',
fileEvents: workspace.createFileSystemWatcher('**/{.stylelintrc{,.js,.json,.yaml,.yml},stylelint.config.js,.stylelintignore}')
}
});
subscriptions.push(new SettingMonitor(client, 'stylelint.enable').start());
};