Add TODO and hyperlink injections to YAML comments

This commit is contained in:
Andrew Dupont 2024-01-08 18:03:15 -08:00
parent e2da555079
commit 70b34cd67a
2 changed files with 24 additions and 0 deletions

View File

@ -0,0 +1,23 @@
exports.activate = () => {
const HYPERLINK_PATTERN = /\bhttps?:/
const TODO_PATTERN = /\b(TODO|FIXME|CHANGED|XXX|IDEA|HACK|NOTE|REVIEW|NB|BUG|QUESTION|COMBAK|TEMP|DEBUG|OPTIMIZE|WARNING)\b/;
atom.grammars.addInjectionPoint('source.yaml', {
type: 'comment',
language: (node) => {
return HYPERLINK_PATTERN.test(node.text) ? 'hyperlink' : undefined;
},
content: (node) => node,
languageScope: null
});
atom.grammars.addInjectionPoint('source.yaml', {
type: 'comment',
language: (node) => {
return TODO_PATTERN.test(node.text) ? 'todo' : undefined;
},
content: (node) => node,
languageScope: null
});
};

View File

@ -1,6 +1,7 @@
{
"name": "language-yaml",
"version": "0.32.0",
"main": "lib/main",
"description": "YAML language support in Atom",
"engines": {
"atom": "*",