forked from xeaone/language-javascript-plus
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
47 lines (34 loc) · 962 Bytes
/
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
40
41
42
43
44
45
46
47
exports.activate = function () {
for (const scopeName of ['source.js','source.ts','source.flow']) {
atom.grammars.addInjectionPoint(scopeName, { type: 'template_string',
language (templateNode) {
const node = templateNode.previousSibling;
if (node.type === 'comment') {
const languages = ['html', 'css'];
const text = node.text.toLowerCase().replace(/\/|\*/g, '');
if (languages.includes(text)) {
return text;
}
}
},
content (templateNode) {
return templateNode;
}
});
atom.grammars.addInjectionPoint(scopeName, { type: 'comment',
language (commentNode) {
const languages = ['html', 'css'];
const text = commentNode.text.toLowerCase().replace(/\/|\*/g, '');
if (languages.includes(text)) {
return text;
}
},
content (commentNode) {
const node = commentNode.nextSibling;
if (node.type === 'template_string') {
return node;
}
}
});
}
};