Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add fish snippets from bmalehorn/vscode-fish #513

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,5 @@ A good portion of the snippets have been forked from the following repositories:
- [vscode-react-javascript-snippets](https://github.com/dsznajder/vscode-react-javascript-snippets)
- [honza/vim-snippets - Verilog](https://github.com/honza/vim-snippets/blob/master/snippets/verilog.snippets)
- [vscode-relm4-snippets](https://github.com/Relm4/vscode-relm4-snippets)
- bmalehorn/vscode-fish/
- And more...
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@
"language": ["eelixir", "heex"],
"path": "./snippets/eelixir.json"
},
{
"language": "fish",
"path": "./snippets/fish.json"
},
{
"language": "fortran",
"path": "./snippets/fortran.json"
Expand Down
190 changes: 190 additions & 0 deletions snippets/fish.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
{
"shebang": {
"prefix": "shebang",
"description": "shebang",
"body": "#!/usr/bin/env fish"
},
"if operator": {
"prefix": "if",
"description": "if operator",
"body": [
"if ${1:condition}",
"\t$0",
"end"
]
},
"if else operator": {
"prefix": "if-else",
"description": "if operator",
"body": [
"if ${1:condition}",
"\t${2:echo}",
"else",
"\t$0",
"end"
]
},
"else operator": {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The else snippet can probably be omitted since the if and if else are already defined here

"prefix": "else",
"description": "else operator",
"body": [
"else",
"\t$0"
]
},
"if compare with comparison operator": {
"prefix": "if-compare",
"description": "if operator",
"body": [
"if test ${1:first} ${2|=,!=,-eq,-ne,-gt,-ge,-lt,-le,-nt,-ot,-ef|} ${3:second}",
"\t$0",
"end"
]
},
"if else with comparison operator": {
"prefix": "if-compare-else",
"description": "if else operator",
"body": [
"if test ${1:first} ${2|=,!=,-eq,-ne,-gt,-ge,-lt,-le,-nt,-ot,-ef|} ${3:second}",
"\t${4:echo}",
"else",
"\t$0",
"end"
]
},
"while operator": {
"prefix": "while",
"description": "while operator",
"body": [
"while ${1:condition}",
"\t$0",
"end"
]
},
"while with comparison operator": {
"prefix": "while-compare",
"description": "while operator",
"body": [
"while test ${1:first} ${2|=,!=,-eq,-ne,-gt,-ge,-lt,-le,-nt,-ot,-ef|} ${3:second}",
"\t$0",
"end"
]
},
"for operator": {
"prefix": "for",
"description": "for operator",
"body": [
"for ${1:item} in ${2:collection}",
"\t$0",
"end"
]
},
"switch operator": {
"prefix": "switch",
"description": "switch operator",
"body": [
"switch ${1:variable}",
"\tcase ${2:glob}",
"\t\t${3:echo}",
"\tcase \"*\"",
"\t\t$0",
"end"
]
},
"case operator": {
"prefix": "case",
"description": "case operator",
"body": [
"case ${1:glob}",
"\t$0"
]
},
"function definition": {
"prefix": "function",
"description": "function definition",
"body": [
"function ${1:name}",
"\t$0",
"end"
]
},
"function with arguments definition": {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these snippets should also be removed in favor of just having someone leverage the first function snippet.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please take this comment to apply to the if and while snippet variants too.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note sure what you mean here (not very familiar with snippet development). How to leverage the multiple possibility with only one snippet ?

"prefix": "function-arguments",
"description": "function definition",
"body": [
"function ${1:name} ${2|--arguments,-a|} ${3:arguments}",
"\t$0",
"end"
]
},
"function with documentation definition": {
"prefix": "function-description",
"description": "function description",
"body": [
"function ${1:name} ${2|--description,-d|} ${3:description}",
"\t$0",
"end"
]
},
"begin end block": {
"prefix": "begin",
"description": "begin end block",
"body": [
"begin",
"\t$0",
"end"
]
},
"and operator": {
"prefix": "and",
"description": "and operator",
"body": "${1:command}; and ${2:command}"
},
"or operator": {
"prefix": "or",
"description": "or operator",
"body": "${1:command}; or ${2:command}"
},
"set_color builtin": {
"prefix": "set-color",
"description": "\"set-color\" invocation",
"body": "set_color ${1|black,red,green,yellow,blue,magenta,cyan,white,brblack,brred,brgreen,bryellow,brblue,brmagenta,brcyan,brwhite|}"
},
"set_color with font style builtin": {
"prefix": "set-color-style",
"description": "\"set-color\" invocation",
"body": "set_color ${1|--bold,-o,--dim,-d,--italics,-i,--reverse,-r,--underline,-u|}"
},
"set builtin": {
"prefix": "set",
"description": "\"set\" invocation",
"body": "set ${1|--universal,-U,--function,-f,--local,-l,--global,-g,--export,-x,--unexport,-u,--path,--unpath,--append,-a,--prepend,-p,--erase,-e,--query,-q,--names,-n,--show,-S,--long,-L|} ${2:variable} ${3:value}"
},
"string builtin": {
"prefix": "string",
"description": "\"string\" invocation",
"body": "string ${1|collect,escape,join,join0,length,lower,match,pad,repeat,replace,shorten,split,split0,sub,trim,unescape,upper|} ${2:variable}"
},
"argparse builtin": {
"prefix": "argparse",
"description": "\"argparse\" invocation",
"body": "argparse ${1:specification} -- ${2:variable}"
},
"test builtin": {
"prefix": "test",
"description": "\"test\" invocation",
"body": "test ${1:first} ${2|=,!=,-eq,-ne,-gt,-ge,-lt,-le,-nt,-ot,-ef|} ${3:second}"
},
"random builtin": {
"prefix": "random",
"description": "\"random\" invocation",
"body": "random ${1:minimum} ${2:maximum}"
},
"comment": {
"prefix": "comment",
"description": "comment",
"body": "# ${1}"
}
}