- Notifications
You must be signed in to change notification settings - Fork 509
add fish snippets from bmalehorn/vscode-fish #513
New issue
Have a question about this project? Sign up for a free account to open an issue and contact its maintainers and the community.
By clicking “Sign up for ”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on ? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
{ | ||
"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": { | ||
"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": { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi @remche, sorry for the delay. What I had meant earlier, was someone can just use the "body": [
"function ${1:name} $0",
"end"
]
} Then we don't clutter the snippets and the user's cursor will end on the first line allowing for them to specify arguments OR enter and tab to define the function body. This same approach can be done for the if, else snippets added above too. | ||
"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" | ||
] | ||
} |
There was a problem hiding this comment.
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
andif else
are already defined here