Skip to content

Commit 228b823

Browse files
committed
added snippets and some keys for marketplace
1 parent 5497c2f commit 228b823

File tree

2 files changed

+90
-4
lines changed

2 files changed

+90
-4
lines changed

package.json

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,30 @@
22
"name": "vscode-nushell-lang",
33
"displayName": "vscode-nushell-lang",
44
"description": "nushell language for vscode",
5-
"version": "0.1.0",
5+
"version": "0.1.1",
6+
"preview": true,
67
"license": "MIT",
78
"publisher": "nushell-team",
9+
"homepage": "https://www.nushell.sh/",
810
"repository": {
911
"type": "git",
1012
"url": "https://github.com/nushell/vscode-nushell-lang.git"
1113
},
14+
"bugs": {
15+
"url": "https://github.com/nushell/vscode-nushell-lang/issues"
16+
},
1217
"engines": {
1318
"vscode": "^1.52.0"
1419
},
1520
"icon": "assets/nushell.ico",
1621
"categories": [
17-
"Programming Languages"
22+
"Programming Languages",
23+
"Snippets"
1824
],
25+
"galleryBanner": {
26+
"color": "#008000",
27+
"theme": "light"
28+
},
1929
"contributes": {
2030
"languages": [
2131
{
@@ -49,7 +59,27 @@
4959
"id": "nushell",
5060
"uiTheme": "vs",
5161
"path": "./nushell.theme-minimal-light.json"
52-
}
53-
]
62+
}
63+
],
64+
"keybindings":[
65+
{
66+
"command": "start https://www.nushell.sh/book/",
67+
"key": "ctrl+f1",
68+
"when": "editorTextFocus && editorLangId == 'nushell'"
69+
},
70+
{
71+
"command": "editor.action.insertSnippet",
72+
"when": "editorTextFocus && editorLangId == 'nushell'",
73+
"mac": "cmd+alt+j",
74+
"win": "ctrl+alt+j",
75+
"linux": "ctrl+alt+j"
76+
}
77+
],
78+
"snippets": [
79+
{
80+
"language": "nushell",
81+
"path": "./snippets/nushell.json"
82+
}
83+
]
5484
}
5585
}

snippets/nushell.json

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
{
2+
"Create Custom Command": {
3+
"prefix": "def",
4+
"body": [
5+
"# Documentation for ${1:Custom_Command_Name}",
6+
"def ${1:Custom_Command_Name} [] {",
7+
"\t# Write some code here",
8+
"\t${2}",
9+
"}"
10+
],
11+
"description": "Example: Write a custom command"
12+
},
13+
"Custom Command With Parameter": {
14+
"prefix": "defp",
15+
"body": [
16+
"# Documentation for ${1:Custom_Command_Name}",
17+
"# Written on ${CURRENT_YEAR}-${CURRENT_MONTH}-${CURRENT_DATE} ${CURRENT_HOUR}:${CURRENT_MINUTE}:${CURRENT_SECOND}",
18+
"def ${1:Custom_Command_Name} [",
19+
"\t ${2:Param_Name} # Docs for ${2:Param_Name}",
20+
"\t] {",
21+
"\t# Test the parameter",
22+
"\techo \\$${2:Param_Name}",
23+
"\t${3}",
24+
"}"
25+
],
26+
"description": "Example: Write a custom command with a parameter"
27+
},
28+
"Custom Command With Switch": {
29+
"prefix": "defs",
30+
"body": [
31+
"# Documentation for ${1:Custom_Command_Name}",
32+
"# Written on ${CURRENT_YEAR}-${CURRENT_MONTH}-${CURRENT_DATE} ${CURRENT_HOUR}:${CURRENT_MINUTE}:${CURRENT_SECOND}",
33+
"def ${1:Custom_Command_Name} [",
34+
"\t--${2:Long_Switch}(-${3:Short_Switch}) # Docs for ${2:Long_Switch}",
35+
"\t] {",
36+
"\t\tlet is_${2:Long_Switch} = $(= \\$${2:Long_Switch} | empty?)\n",
37+
"\t\tif \\$is_${2:Long_Switch} {",
38+
"\t\t\techo \\$true",
39+
"\t\t} {",
40+
"\t\t\techo \\$false",
41+
"\t\t}\n",
42+
"\t# Write some code here",
43+
"\t${4}",
44+
"}"
45+
],
46+
"description": "Example: Write a custom command with a switch"
47+
},
48+
"Create an Alias": {
49+
"prefix": "alias",
50+
"body": [
51+
"# Documentation for ${1:Alias_Name}",
52+
"aliase ${1:Alias_Name} = ${2}"
53+
],
54+
"description": "Create an alias"
55+
}
56+
}

0 commit comments

Comments
 (0)