增加注释中的TODOFIXME高亮

This commit is contained in:
mxd
2021-07-09 21:00:00 +08:00
parent 7ae7941898
commit 008d73a76a
3 changed files with 17 additions and 18 deletions

View File

@@ -18,8 +18,9 @@ export default {
{token: 'string.invalid', foreground: '008000', background: 'FFCCCC'},
{token: 'string.escape.invalid', foreground: '008000', background: 'FFCCCC'},
{token: 'string.escape', foreground: '000080', fontStyle: 'bold'},
{token: 'comment', foreground: '808080'},
{token: 'comment.doc', foreground: '629755'},
{token: 'comment', foreground: '808080', fontStyle: 'italic'},
{token: 'comment.doc', foreground: '629755', fontStyle: 'italic'},
{token: 'comment.todo', foreground: 'A8C023', fontStyle: 'italic'},
{token: 'string.escape', foreground: 'CC7832'}
],
colors: {

View File

@@ -17,8 +17,9 @@ export default {
{token: 'string.invalid', foreground: '008000', background: 'FFCCCC'},
{token: 'string.escape.invalid', foreground: '008000', background: 'FFCCCC'},
{token: 'string.escape', foreground: '000080', fontStyle: 'bold'},
{token: 'comment', foreground: '808080'},
{token: 'comment.doc', foreground: '808080'},
{token: 'comment', foreground: '808080', fontStyle: 'italic'},
{token: 'comment.doc', foreground: '808080', fontStyle: 'italic'},
{token: 'comment.todo', foreground: '008DDE', fontStyle: 'italic'},
{token: 'string.escape', foreground: '000080'}
],
colors: {

View File

@@ -27,9 +27,8 @@ export const HighLightOptions = {
[/::[a-zA-Z]+/, 'keywords'],
[/[{}()[\]]/, '@brackets'],
[/(@digits)[lLbBsSdDfFmM]?/, 'number'],
[/\/\*\*(?!\/)/, 'comment.doc', '@mulcomment'],
[/\/\*/, 'comment', '@comment'],
[/\/\/.*$/, 'comment'],
[/\/\//, 'comment', '@commentTodo'],
[
/\/(?=([^\\\/]|\\.)+\/([gimsuy]*)(\s*)(\.|;|,|\)|\]|\}|$))/,
{token: 'regexp', bracket: '@open', next: '@regexp'}
@@ -42,11 +41,16 @@ export const HighLightOptions = {
[/'/, 'string', '@string_single'],
],
comment: [
[/[^/*]+/, 'comment'],
// [/\/\*/, 'comment', '@push' ], // nested comment not allowed :-(
// [/\/\*/, 'comment.invalid' ], // this breaks block comments in the shape of /* //*/
[/\*\//, 'comment', '@pop'],
[/[/*]/, 'comment']
[/((TODO)|(todo)|(fixme)|(FIXME))[ \t]+[^\n(?!\*\/)]+/, 'comment.todo','@comment'],
[/[ \t]+/, 'comment','@comment'],
[/\*\//, 'comment', '@popall'],
[/[^ \t]+(?!((TODO)|(todo)|(fixme)|(FIXME)))/, 'comment','@comment']
],
commentTodo: [
[/((TODO)|(todo)|(fixme)|(FIXME))[ \t]+[^\n]+/, 'comment.todo','@popall'],
[/^/,'', '@popall'],
[/[^ \t]+(?!((TODO)|(todo)|(fixme)|(FIXME)))/, 'comment', '@commentTodo']
],
regexp: [
[
@@ -90,13 +94,6 @@ export const HighLightOptions = {
}
]
],
mulcomment: [
[/[^/*]+/, 'comment.doc'],
// [/\/\*/, 'comment.doc', '@push' ], // nested comment not allowed :-(
[/\/\*/, 'comment.doc.invalid'],
[/\*\//, 'comment.doc', '@pop'],
[/[/*]/, 'comment.doc']
],
string_multi_embedded: [
[/[^"]+/, ''],
['"""', {token: 'string', next: '@pop', nextEmbedded: '@pop'}]