From d56405cd1e15204c7d8432262285f95f0981d2f6 Mon Sep 17 00:00:00 2001 From: EmilySeville7cfg Date: Sat, 19 Aug 2023 08:20:02 +1000 Subject: [PATCH 1/2] feat(snippet): support colors and text attributes --- server/src/snippets.ts | 76 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/server/src/snippets.ts b/server/src/snippets.ts index 2730fc1f..0177a977 100644 --- a/server/src/snippets.ts +++ b/server/src/snippets.ts @@ -639,6 +639,82 @@ export const SNIPPETS: BashCompletionItem[] = [ label: 'device', insertText: '/dev/${1|null,stdin,stdout,stderr|}', }, + { + documentation: 'colors', + label: 'colors', + insertText: [ + "declare black${1:_color}='\\e[30m'", + "declare red$1='\\e[31m'", + "declare green$1='\\e[32m'", + "declare yellow$1='\\e[33m'", + "declare blue$1='\\e[34m'", + "declare magenta$1='\\e[35m'", + "declare cyan$1='\\e[36m'", + "declare light_gray$1='\\e[37m'", + ].join('\n') + }, + { + documentation: 'light colors', + label: 'colors-light', + insertText: [ + "declare ${1:light_}black${2:_color}='\\e[90m'", + "declare $1red$2='\\e[91m'", + "declare $1green$2='\\e[92m'", + "declare $1yellow$2='\\e[93m'", + "declare $1blue$2='\\e[94m'", + "declare $1magenta$2='\\e[95m'", + "declare $1cyan$2='\\e[96m'", + "declare $1white$2='\\e[97m'", + ].join('\n') + }, + { + documentation: 'background colors', + label: 'colors-background', + insertText: [ + "declare ${1:background_}black${2:_color}='\\e[40m'", + "declare $1red$2='\\e[41m'", + "declare $1green$2='\\e[42m'", + "declare $1yellow$2='\\e[43m'", + "declare $1blue$2='\\e[44m'", + "declare $1magenta$2='\\e[45m'", + "declare $1cyan$2='\\e[46m'", + "declare $1light_gray$2='\\e[47m'", + ].join('\n') + }, + { + documentation: 'background light colors', + label: 'colors-light-background', + insertText: [ + "declare ${1:background_light_}black${2:_color}='\\e[100m'", + "declare $1red$2='\\e[101m'", + "declare $1green$2='\\e[102m'", + "declare $1yellow$2='\\e[103m'", + "declare $1blue$2='\\e[104m'", + "declare $1magenta$2='\\e[105m'", + "declare $1cyan$2='\\e[106m'", + "declare $1white$2='\\e[107m'", + ].join('\n') + }, + { + documentation: 'bold', + label: 'bold', + insertText: "declare ${1:bold}='\\e[1m'", + }, + { + documentation: 'faint', + label: 'faint', + insertText: "declare ${1:faint}='\\e[2m'", + }, + { + documentation: 'italics', + label: 'italics', + insertText: "declare ${1:italics}='\\e[3m'", + }, + { + documentation: 'underlined', + label: 'underlined', + insertText: "declare ${1:underlined}='\\e[4m'", + }, { documentation: 'completion', label: 'completion definition', From fda870065e5a4c4293ae07c93c8de5e4a7876b5a Mon Sep 17 00:00:00 2001 From: EmilySeville7cfg Date: Sat, 19 Aug 2023 08:29:36 +1000 Subject: [PATCH 2/2] fix(snippet): formatting --- server/src/snippets.ts | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/server/src/snippets.ts b/server/src/snippets.ts index 0177a977..dc7a4a87 100644 --- a/server/src/snippets.ts +++ b/server/src/snippets.ts @@ -644,14 +644,14 @@ export const SNIPPETS: BashCompletionItem[] = [ label: 'colors', insertText: [ "declare black${1:_color}='\\e[30m'", - "declare red$1='\\e[31m'", - "declare green$1='\\e[32m'", - "declare yellow$1='\\e[33m'", - "declare blue$1='\\e[34m'", - "declare magenta$1='\\e[35m'", - "declare cyan$1='\\e[36m'", - "declare light_gray$1='\\e[37m'", - ].join('\n') + "declare red$1='\\e[31m'", + "declare green$1='\\e[32m'", + "declare yellow$1='\\e[33m'", + "declare blue$1='\\e[34m'", + "declare magenta$1='\\e[35m'", + "declare cyan$1='\\e[36m'", + "declare light_gray$1='\\e[37m'", + ].join('\n'), }, { documentation: 'light colors', @@ -664,8 +664,8 @@ export const SNIPPETS: BashCompletionItem[] = [ "declare $1blue$2='\\e[94m'", "declare $1magenta$2='\\e[95m'", "declare $1cyan$2='\\e[96m'", - "declare $1white$2='\\e[97m'", - ].join('\n') + "declare $1white$2='\\e[97m'", + ].join('\n'), }, { documentation: 'background colors', @@ -678,8 +678,8 @@ export const SNIPPETS: BashCompletionItem[] = [ "declare $1blue$2='\\e[44m'", "declare $1magenta$2='\\e[45m'", "declare $1cyan$2='\\e[46m'", - "declare $1light_gray$2='\\e[47m'", - ].join('\n') + "declare $1light_gray$2='\\e[47m'", + ].join('\n'), }, { documentation: 'background light colors', @@ -692,8 +692,8 @@ export const SNIPPETS: BashCompletionItem[] = [ "declare $1blue$2='\\e[104m'", "declare $1magenta$2='\\e[105m'", "declare $1cyan$2='\\e[106m'", - "declare $1white$2='\\e[107m'", - ].join('\n') + "declare $1white$2='\\e[107m'", + ].join('\n'), }, { documentation: 'bold',