diff --git a/src/consts.ts b/src/consts.ts index 67f7c7f..345a728 100644 --- a/src/consts.ts +++ b/src/consts.ts @@ -65,8 +65,8 @@ const Consts = { archive: new RegExp ( `^(?![^\\S\\n]*(?!--|––|——)(?:[-❍❑■⬜□☐▪▫–—≡→›✘xX✔✓☑+]|\\[[ xX+-]?\\])\\s[^\\n]*)([^\\S\\n]*${_.escapeRegExp ( archiveName )}:.*$)`, 'gm' ), comment: /^(?!\s*$)(?![^\S\n]*(?!--|––|——)(?:[-❍❑■⬜□☐▪▫–—≡→›✘xX✔✓☑+]|\[[ xX+-]?\])\s[^\n]*)(?![^\S\n]*.+:[^\S\n]*(?:(?=@[^\s*~(]+(?::\/\/[^\s*~(:]+)?(?:\([^)]*\))?)|$))[^\S\n]*([^\n]+)/gm, tag: /(?:^|[^a-zA-Z0-9`])(@[^\s*~(]+(?::\/\/[^\s*~(:]+)?(?:\([^)]*\))?)/gm, - tagSpecial: new RegExp ( `(?:^|[^a-zA-Z0-9])@(${tagsNames.map ( n => _.escapeRegExp ( n ) ).join ( '|' )})(?:(?:\\([^)]*\\))|(?![a-zA-Z]))`, 'gm' ), - tagSpecialNormal: new RegExp ( `(?:^|[^a-zA-Z0-9])(?:${tagsNames.map ( n => `(@${_.escapeRegExp ( n )}(?:(?:\\([^)]*\\))|(?![a-zA-Z])))` ).join ( '|' )}|(@[^\\s*~(]+(?::\/\/[^\\s*~(:]+)?(?:(?:\\([^)]*\\))|(?![a-zA-Z]))))`, 'gm' ), + tagSpecial: new RegExp ( `(?:^|[^a-zA-Z0-9-])@(${tagsNames.map ( n => _.escapeRegExp ( n ) ).join ( '|' )})(?:(?:\\([^)]*\\))|(?![a-zA-Z0-9-]))`, 'gm' ), + tagSpecialNormal: new RegExp ( `(?:^|[^a-zA-Z0-9-])(?:${tagsNames.map ( n => `(@${_.escapeRegExp ( n )}(?:(?:\\([^)]*\\))|(?![a-zA-Z0-9-])))` ).join ( '|' )}|(@[^\\s*~(]+(?::\/\/[^\\s*~(:]+)?(?:(?:\\([^)]*\\))|(?![a-zA-Z]))))`, 'gm' ), tagNormal: new RegExp ( `(?:^|[^a-zA-Z0-9])@(?!${tagsNames.map ( n => _.escapeRegExp ( n ) ).join ( '|' )}|created|done|cancelled|started|lasted|wasted|est|\\d)[^\\s*~(:]+(?::\/\/[^\\s*~(:]+)?(?:\\([^)]*\\))?` ), tagCreated: /(?:^|[^a-zA-Z0-9])@created(?:(?:\(([^)]*)\))|(?![a-zA-Z]))/, tagStarted: /(?:^|[^a-zA-Z0-9])@started(?:(?:\(([^)]*)\))|(?![a-zA-Z]))/, diff --git a/src/todo/decorators/tag.ts b/src/todo/decorators/tag.ts index e8e571d..1de68fa 100644 --- a/src/todo/decorators/tag.ts +++ b/src/todo/decorators/tag.ts @@ -8,20 +8,24 @@ import Line from './line'; /* DECORATION TYPES */ -const SPECIAL_TAGS = Consts.tags.names.map ( ( name, index ) => vscode.window.createTextEditorDecorationType ({ - backgroundColor: Consts.colors.tags.background[index], - color: Consts.colors.tags.foreground[index], - borderRadius: '2px', - rangeBehavior: vscode.DecorationRangeBehavior.ClosedClosed, - dark: { - backgroundColor: Consts.colors.dark.tags.background[index], - color: Consts.colors.dark.tags.foreground[index] - }, - light: { - backgroundColor: Consts.colors.light.tags.background[index], - color: Consts.colors.light.tags.foreground[index] - } -})); +const SPECIAL_TAGS = Consts.tags.names.map ( ( name, index ) => { + const colorIndex = index % Consts.colors.tags.background.length; + return vscode.window.createTextEditorDecorationType({ + backgroundColor: Consts.colors.tags.background[colorIndex], + color: Consts.colors.tags.foreground[colorIndex], + borderRadius: '2px', + rangeBehavior: vscode.DecorationRangeBehavior.ClosedClosed, + dark: { + backgroundColor: Consts.colors.dark.tags.background[colorIndex], + color: Consts.colors.dark.tags.foreground[colorIndex], + }, + light: { + backgroundColor: Consts.colors.light.tags.background[colorIndex], + color: Consts.colors.light.tags.foreground[colorIndex], + }, + }); +}); + const TAG = vscode.window.createTextEditorDecorationType ({ color: Consts.colors.tag,