Skip to content

Commit 1f4e6dc

Browse files
EmilySeville7cfgEmilySeville7cfg
authored andcommitted
feat(snippets): sync with Fish
1 parent 2230def commit 1f4e6dc

File tree

1 file changed

+75
-210
lines changed

1 file changed

+75
-210
lines changed

server/src/snippets.ts

Lines changed: 75 additions & 210 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,53 @@ export const SNIPPETS: BashCompletionItem[] = [
488488
'# - ${7:1} ${8:otherwise}',
489489
].join('\n'),
490490
},
491+
{
492+
documentation: 'block',
493+
label: 'block',
494+
insertText: [
495+
'{',
496+
'\t${1:command ...}',
497+
'}',
498+
].join('\n'),
499+
},
500+
{
501+
documentation: 'block redirected',
502+
label: 'block-redirected',
503+
insertText: [
504+
'{',
505+
'\t${1:command ...}',
506+
'} > ${2:file}',
507+
].join('\n'),
508+
},
509+
{
510+
documentation: 'block stderr redirected',
511+
label: 'block-stderr-redirected',
512+
insertText: [
513+
'{',
514+
'\t${1:command ...}',
515+
'} 2> ${2:file}',
516+
].join('\n'),
517+
},
518+
{
519+
documentation: 'variable',
520+
label: 'variable',
521+
insertText: 'declare ${1:variable}=${2:value}',
522+
},
523+
{
524+
documentation: 'variable index',
525+
label: 'variable-index',
526+
insertText: '${1:variable}[${2:index}]=${3:value}',
527+
},
528+
{
529+
documentation: 'variable append',
530+
label: 'variable-append',
531+
insertText: '${1:variable}+=${2:value}',
532+
},
533+
{
534+
documentation: 'variable-prepend',
535+
label: 'variable-prepend',
536+
insertText: '${1:variable}=${2:value}\\$$1',
537+
},
491538
{
492539
documentation: 'if unset or null',
493540
label: 'if-unset-or-null',
@@ -529,244 +576,62 @@ export const SNIPPETS: BashCompletionItem[] = [
529576
insertText: '"\\${${1:variable}+${2:alternative}}"',
530577
},
531578
{
532-
documentation: 'without shortest leading pattern',
533-
label: 'without-shortest-leading-pattern',
579+
documentation: 'string shortest leading replacement',
580+
label: 'string-remove-leading',
534581
insertText: '"\\${${1:variable}#${2:pattern}}"',
535582
},
536583
{
537-
documentation: 'without longest leading pattern',
538-
label: 'without-longest-leading-pattern',
539-
insertText: '"\\${${1:variable}##${2:pattern}}"',
540-
},
541-
{
542-
documentation: 'without shortest trailing pattern',
543-
label: 'without-shortest-trailing-pattern',
584+
documentation: 'string shortest trailing replacement',
585+
label: 'string-remove-trailing',
544586
insertText: '"\\${${1:variable}%${2:pattern}}"',
545587
},
546588
{
547-
documentation: 'without longest trailing pattern',
548-
label: 'without-longest-trailing-pattern',
549-
insertText: '"\\${${1:variable}%%${2:pattern}}"',
589+
documentation: 'string-match',
590+
label: 'string filtering',
591+
insertText: 'sed ${1|-E -n,--regexp-extended --quiet|} \'/${2:pattern}/p\'',
550592
},
551593
{
552-
documentation: '.. expansion',
553-
label: 'range',
554-
insertText: '{${1:from}..${2:to}}',
594+
documentation: 'string-replace',
595+
label: 'string replacement',
596+
insertText: 'sed ${1|-E,--regexp-extended|} \'s/${2:pattern}/${3:replacement}/\'',
555597
},
556598
{
557-
documentation: '"echo" invocation',
558-
label: 'echo',
559-
insertText: 'echo "${1:message}"',
599+
documentation: 'string-replace-all',
600+
label: 'string replacement',
601+
insertText: 'sed ${1|-E,--regexp-extended|} \'s/${2:pattern}/${3:replacement}/g\'',
560602
},
561603
{
562-
documentation: '"printf" invocation',
563-
label: 'printf',
604+
documentation: 'string-transliterate',
605+
label: 'string-transliterate',
564606
insertText:
565-
'printf \'${1|%c,%s,%d,%f,%15c,%15s,%15d,%15f,%.5s,%.5d,%.5f|}\' "${2:message}"',
607+
"sed ${1|-E,--regexp-extended|} 'y/${2:source-characters}/${3:replacement-characters}/g'",
566608
},
567609
{
568-
documentation: '"source" invocation',
569-
label: 'source',
570-
insertText: '${1|source,.|} "${2:path/to/file}"',
610+
documentation: 'file print',
611+
label: 'file-print',
612+
insertText: "sed '' ${1:file}",
571613
},
572614
{
573-
documentation: '"alias" invocation',
574-
label: 'alias',
575-
insertText: 'alias ${1:name}=${2:value}',
576-
},
577-
{
578-
documentation: '"cd" invocation',
579-
label: 'cd',
580-
insertText: 'cd "${1:path/to/directory}"',
581-
},
582-
{
583-
documentation: '"getopts" invocation',
584-
label: 'getopts',
585-
insertText: 'getopts ${1:optstring} ${2:name}',
586-
},
587-
{
588-
documentation: '"jobs" invocation',
589-
label: 'jobs',
590-
insertText: 'jobs -x ${1:command}',
591-
},
592-
{
593-
documentation: '"kill" invocation',
594-
label: 'kill',
595-
insertText: 'kill ${1|-l,-L|}',
596-
},
597-
{
598-
documentation: '"let" invocation',
599-
label: 'let',
600-
insertText: 'let ${1:argument}',
601-
},
602-
{
603-
documentation: '"test" invocation',
604-
label: 'test',
605-
insertText:
606-
'[[ ${1:argument1} ${2|-ef,-nt,-ot,==,=,!=,=~,<,>,-eq,-ne,-lt,-le,-gt,-ge|} ${3:argument2} ]]',
607-
},
608-
{
609-
documentation: 'line print',
610-
label: 'sed:print',
611-
insertText: "sed '' ${1:path/to/file}",
612-
},
613-
{
614-
documentation: 'line pattern filter',
615-
label: 'sed:filter-by-line-pattern',
616-
insertText:
617-
"sed ${1|--regexp-extended,-E|} ${2|--quiet,-n|} '/${3:pattern}/p' ${4:path/to/file}",
618-
},
619-
{
620-
documentation: 'line number filter',
621-
label: 'sed:filter-by-line-number',
622-
insertText:
623-
"sed ${1|--regexp-extended,-E|} ${2|--quiet,-n|} '${3:number}p' ${4:path/to/file}",
624-
},
625-
{
626-
documentation: 'line number filter',
627-
label: 'sed:filter-by-line-numbers',
628-
insertText:
629-
"sed ${1|--regexp-extended,-E|} ${2|--quiet,-n|} '${3:from},${4:to}p' ${5:path/to/file}",
630-
},
631-
{
632-
documentation: 'single replacement',
633-
label: 'sed:replace-first',
615+
documentation: 'file read',
616+
label: 'file-read',
634617
insertText:
635-
"sed ${1|--regexp-extended,-E|} 's/${2:pattern}/${3:replacement}/' ${4:path/to/file}",
636-
},
637-
{
638-
documentation: 'global replacement',
639-
label: 'sed:replace-all',
640-
insertText:
641-
"sed ${1|--regexp-extended,-E|} 's/${2:pattern}/${3:replacement}/g' ${4:path/to/file}",
642-
},
643-
{
644-
documentation: 'transliteration',
645-
label: 'sed:transliterate',
646-
insertText:
647-
"sed ${1|--regexp-extended,-E|} 'y/${2:source-characters}/${3:replacement-characters}/g' ${4:path/to/file}",
648-
},
649-
{
650-
documentation: 'whole file read',
651-
label: 'sed:read-all',
652-
insertText:
653-
"sed ${1|--regexp-extended,-E|} ':${2:x} N $! b$2 ${3:command}' ${4:path/to/file}",
654-
},
655-
{
656-
documentation: 'line print',
657-
label: 'awk:print',
658-
insertText: "awk '/./' ${1:path/to/file}",
659-
},
660-
{
661-
documentation: 'line pattern filter',
662-
label: 'awk:filter-by-line-pattern',
663-
insertText: "awk '/${1:pattern}/' ${2:path/to/file}",
664-
},
665-
{
666-
documentation: 'line number filter',
667-
label: 'awk:filter-by-line-number',
668-
insertText: "awk 'NR == ${1:number}' ${2:path/to/file}",
669-
},
670-
{
671-
documentation: 'line number filter',
672-
label: 'awk:filter-by-line-numbers',
673-
insertText: "awk 'NR >= ${1:from} && NR <= ${2:to}' ${3:path/to/file}",
674-
},
675-
{
676-
documentation: 'single replacement',
677-
label: 'awk:replace-first',
678-
insertText: 'awk \'{ sub("${1:pattern}", "${2:replacement}") }\' ${3:path/to/file}',
679-
},
680-
{
681-
documentation: 'global replacement',
682-
label: 'awk:replace-all',
683-
insertText: 'awk \'{ gsub("${1:pattern}", "${2:replacement}") }\' ${3:path/to/file}',
684-
},
685-
{
686-
documentation: 'whole file read',
687-
label: 'awk:read-all',
688-
insertText: "awk RS='^$' '{ ${1:command} }' ${2:path/to/file}",
618+
"sed ${1|-E,--regexp-extended|} ':${2:x} N $! b$2 ${3:command}' ${4:file}",
689619
},
690620
{
691621
documentation: 'node print',
692-
label: 'jq:print',
693-
insertText: "jq '.${1:path/to/node}' ${2:path/to/file}",
622+
label: 'json',
623+
insertText: "jq '.${1:node}' ${2:file}",
694624
},
695625
{
696626
documentation: 'node print',
697-
label: 'yq:print',
698-
insertText: "yq '.${1:path/to/node}' ${2:path/to/file}",
699-
},
700-
{
701-
documentation: 'home directory',
702-
label: '~',
703-
insertText: '$HOME',
627+
label: 'json',
628+
insertText: "jq '.${1:node}' ${2:file}",
704629
},
705630
{
706-
documentation: '[dev]ice name',
707-
label: 'dev',
631+
documentation: 'device',
632+
label: 'device',
708633
insertText: '/dev/${1|null,stdin,stdout,stderr|}',
709634
},
710-
{
711-
documentation: '[al]pha[num]eric characters',
712-
label: 'alnum',
713-
insertText: '[[:alnum:]]',
714-
},
715-
{
716-
documentation: '[alpha]betic characters',
717-
label: 'alpha',
718-
insertText: '[[:alpha:]]',
719-
},
720-
{
721-
documentation: '[blank] characters',
722-
label: 'blank',
723-
insertText: '[[:blank:]]',
724-
},
725-
{
726-
documentation: '[c]o[nt]ro[l] characters',
727-
label: 'cntrl',
728-
insertText: '[[:cntrl:]]',
729-
},
730-
{
731-
documentation: '[digit] characters',
732-
label: 'digit',
733-
insertText: '[[:digit:]]',
734-
},
735-
{
736-
documentation: '[graph]ical characters',
737-
label: 'graph',
738-
insertText: '[[:graph:]]',
739-
},
740-
{
741-
documentation: '[lower] characters',
742-
label: 'lower',
743-
insertText: '[[:lower:]]',
744-
},
745-
{
746-
documentation: '[print]able characters',
747-
label: 'print',
748-
insertText: '[[:print:]]',
749-
},
750-
{
751-
documentation: '[punct]uation characters',
752-
label: 'punct',
753-
insertText: '[[:punct:]]',
754-
},
755-
{
756-
documentation: '[space] characters',
757-
label: 'space',
758-
insertText: '[[:space:]]',
759-
},
760-
{
761-
documentation: '[upper] characters',
762-
label: 'upper',
763-
insertText: '[[:upper:]]',
764-
},
765-
{
766-
documentation: 'hexadecimal characters',
767-
label: 'xdigit',
768-
insertText: '[[:xdigit:]]',
769-
},
770635
].map((item) => ({
771636
...item,
772637
documentation: {

0 commit comments

Comments
 (0)