From 008d73a76a44a0e704434d4e25fe9f237111a2cc Mon Sep 17 00:00:00 2001 From: mxd <838425805@qq.com> Date: Fri, 9 Jul 2021 21:00:00 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=B3=A8=E9=87=8A=E4=B8=AD?= =?UTF-8?q?=E7=9A=84`TODO`=E3=80=81`FIXME`=E9=AB=98=E4=BA=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../console/src/scripts/editor/dark-theme.js | 5 ++-- .../src/scripts/editor/default-theme.js | 5 ++-- .../console/src/scripts/editor/high-light.js | 25 ++++++++----------- 3 files changed, 17 insertions(+), 18 deletions(-) diff --git a/magic-editor/src/console/src/scripts/editor/dark-theme.js b/magic-editor/src/console/src/scripts/editor/dark-theme.js index 157427e0..f576c564 100644 --- a/magic-editor/src/console/src/scripts/editor/dark-theme.js +++ b/magic-editor/src/console/src/scripts/editor/dark-theme.js @@ -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: { diff --git a/magic-editor/src/console/src/scripts/editor/default-theme.js b/magic-editor/src/console/src/scripts/editor/default-theme.js index 8cff4969..88bd3726 100644 --- a/magic-editor/src/console/src/scripts/editor/default-theme.js +++ b/magic-editor/src/console/src/scripts/editor/default-theme.js @@ -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: { diff --git a/magic-editor/src/console/src/scripts/editor/high-light.js b/magic-editor/src/console/src/scripts/editor/high-light.js index d0f2c22e..e9340c0d 100644 --- a/magic-editor/src/console/src/scripts/editor/high-light.js +++ b/magic-editor/src/console/src/scripts/editor/high-light.js @@ -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'}]