mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-09-11 11:15:24 +03:00
Only inject TODO and hyperlink into CSS when needed
This commit is contained in:
parent
bbf4cb4417
commit
351493fc35
@ -1,22 +1,25 @@
|
||||
exports.activate = () => {
|
||||
|
||||
atom.grammars.addInjectionPoint('source.css', {
|
||||
type: 'comment',
|
||||
language: () => 'todo',
|
||||
content: (node) => node
|
||||
});
|
||||
const TODO_PATTERN = /\b(TODO|FIXME|CHANGED|XXX|IDEA|HACK|NOTE|REVIEW|NB|BUG|QUESTION|COMBAK|TEMP|DEBUG|OPTIMIZE|WARNING)\b/;
|
||||
const HYPERLINK_PATTERN = /\bhttps?:/
|
||||
|
||||
atom.grammars.addInjectionPoint('source.css', {
|
||||
type: 'comment',
|
||||
language: () => 'hyperlink',
|
||||
language(node) {
|
||||
return TODO_PATTERN.test(node.text) ? 'todo' : undefined;
|
||||
},
|
||||
content: (node) => node
|
||||
});
|
||||
|
||||
atom.grammars.addInjectionPoint('source.css', {
|
||||
type: 'string_value',
|
||||
language: () => 'hyperlink',
|
||||
content: (node) => node
|
||||
});
|
||||
for (let type of ['comment', 'string_value']) {
|
||||
atom.grammars.addInjectionPoint('source.css', {
|
||||
type,
|
||||
language(node) {
|
||||
return HYPERLINK_PATTERN.test(node.text) ? 'hyperlink' : undefined;
|
||||
},
|
||||
content: (node) => node
|
||||
});
|
||||
}
|
||||
|
||||
// Catch things like
|
||||
//
|
||||
|
Loading…
Reference in New Issue
Block a user