Skip to content

Commit 278ce4e

Browse files
2 parents 3b98db4 + 9ee71f9 commit 278ce4e

6 files changed

Lines changed: 288 additions & 6 deletions

File tree

.vscodeignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
.vscode/**
2-
.vscode-test/**
2+
.examples/**
33
.gitignore
44
vsc-extension-quickstart.md

README.md

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
# vscode-cashscript
22

3+
[![Version](https://vsmarketplacebadge.apphb.com/version/nathanielcherian.cashscript.svg)](https://marketplace.visualstudio.com/items?itemName=nathanielcherian.cashscript) [![Downloads](https://vsmarketplacebadge.apphb.com/downloads/nathanielcherian.cashscript.svg)](https://marketplace.visualstudio.com/items?itemName=nathanielcherian.cashscript) [![Installs](https://vsmarketplacebadge.apphb.com/installs/nathanielcherian.cashscript.svg)](https://marketplace.visualstudio.com/items?itemName=nathanielcherian.cashscript) [![Rating](https://vsmarketplacebadge.apphb.com/rating-star/nathanielcherian.cashscript.svg)](https://marketplace.visualstudio.com/items?itemName=nathanielcherian.cashscript#review-details)
4+
35
Vscode-cashscript provides tools that make it easier for developers to write smart contracts with [cashscript](https://cashscript.org/).
46

5-
![example of vscode-cashscript](media/p2pkh.gif)
7+
![example of vscode-cashscript](https://github.com/nathanielCherian/vscode-cashscript/blob/main/media/p2pkh.gif)
68

79
## Features
810

@@ -12,17 +14,37 @@ Vscode-cashscript provides tools that make it easier for developers to write sma
1214
- Linting
1315
- Contract Compilation
1416

15-
## Instructions
17+
## Development Instructions
1618

1719
Press **F5** or click the "**Compile Contract**" button in the top right. A json file containing the contract artifiact will be created in the same directory with the same name.
1820

21+
Clone the project
22+
23+
```
24+
git clone https://github.com/nathanielCherian/vscode-cashscript
25+
```
26+
27+
Install Dependencies
28+
29+
```
30+
cd vscode-cashscript && npm i
31+
```
32+
33+
Open the project in vscode.=
34+
35+
```
36+
code .
37+
```
38+
39+
Press F5 anywhere to start the test window, open the examples folder to test out any '.cash' file. All relevent files are located within the /src directory.
40+
1941
## Extension Settings
2042

2143
None available yet.
2244

2345
## Known Issues
2446

25-
Calling out known issues can help limit users opening duplicate issues against your extension.
47+
None available yet.
2648

2749
## Release Notes
2850

examples/p2pkh.cash

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@ contract P2PKH(bytes20 pkh) {
44
function spend(pubkey pk, sig s) {
55
require(hash160(pk) == pkh);
66
require(checkSig(s, pk));
7+
require(checkSig(s, pk));
78
}
89
}

examples/p2pkh.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"contractName": "P2PKH",
3+
"constructorInputs": [
4+
{
5+
"name": "pkh",
6+
"type": "bytes20"
7+
}
8+
],
9+
"abi": [
10+
{
11+
"name": "spend",
12+
"covenant": false,
13+
"inputs": [
14+
{
15+
"name": "pk",
16+
"type": "pubkey"
17+
},
18+
{
19+
"name": "s",
20+
"type": "sig"
21+
}
22+
]
23+
}
24+
],
25+
"bytecode": "OP_OVER OP_HASH160 OP_EQUALVERIFY OP_2DUP OP_CHECKSIGVERIFY OP_CHECKSIG",
26+
"source": "pragma cashscript ^0.6.0;\r\n\r\ncontract P2PKH(bytes20 pkh) {\r\n function spend(pubkey pk, sig s) {\r\n require(hash160(pk) == pkh);\r\n require(checkSig(s, pk));\r\n require(checkSig(s, pk));\r\n }\r\n}\r\n",
27+
"compiler": {
28+
"name": "cashc",
29+
"version": "0.6.3"
30+
},
31+
"updatedAt": "2021-06-10T15:37:07.041Z"
32+
}

package-lock.json

Lines changed: 8 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 221 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,115 @@
11
{
2+
"name": "cashscript",
3+
"publisher": "NathanielCherian",
4+
"displayName": "cashscript",
5+
"description": "Cashscript language support for Visual Studio Code",
6+
"version": "1.0.0",
7+
"icon": "images/icon.png",
8+
"repository": {
9+
"type": "git",
10+
"url": "https://github.com/nathanielCherian/vscode-cashscript"
11+
},
12+
"bugs": {
13+
"url": "https://github.com/nathanielCherian/vscode-cashscript/issues"
14+
},
15+
"contributors": [
16+
"Nathaniel Cherian"
17+
],
18+
"keywords": [
19+
"cashscript",
20+
"bch",
21+
"blockchain",
22+
"compiler",
23+
"contract"
24+
],
25+
"categories": [
26+
"Programming Languages",
27+
"Snippets",
28+
"Linters"
29+
],
30+
"engines": {
31+
"vscode": "^1.56.0"
32+
},
33+
"activationEvents": [
34+
"onLanguage:cashscript",
35+
"onCommand:cashscript.compile"
36+
],
37+
"main": "./out/src/extension",
38+
"scripts": {
39+
"vscode:prepublish": "npm run -S esbuild-base -- --minify",
40+
"esbuild-base": "esbuild ./src/extension.ts --bundle --outfile=out/main.js --external:vscode --format=cjs --platform=node",
41+
"esbuild": "npm run -S esbuild-base -- --sourcemap",
42+
"esbuild-watch": "npm run -S esbuild-base -- --sourcemap --watch",
43+
"test-compile": "tsc -p ./",
44+
"compile": "tsc -p ./",
45+
"watch": "tsc -watch -p ./",
46+
"prepare": "node ./node_modules/vscode/bin/install"
47+
},
48+
"contributes": {
49+
"languages": [
50+
{
51+
"id": "cashscript",
52+
"aliases": [
53+
"cashscript",
54+
"Cashscript"
55+
],
56+
"extensions": [
57+
".cash"
58+
],
59+
"configuration": "./cashscript.configuration.json"
60+
}
61+
],
62+
"grammars": [
63+
{
64+
"language": "cashscript",
65+
"scopeName": "source.cash",
66+
"path": "./syntaxes/cashscript.tmLanguage.json"
67+
}
68+
],
69+
"snippets": [
70+
{
71+
"language": "cashscript",
72+
"path": "./snippets/cashscript.snippets.json"
73+
}
74+
],
75+
"commands": [
76+
{
77+
"command": "cashscript.compile",
78+
"title": "Compile Contract"
79+
}
80+
],
81+
"keybindings": [
82+
{
83+
"command": "cashscript.compile",
84+
"key": "ctrl+f5"
85+
}
86+
],
87+
"menus": {
88+
"editor/title": [
89+
{
90+
"when": "resourceLangId == cashscript",
91+
"command": "cashscript.compile",
92+
"group": "navigation"
93+
}
94+
]
95+
}
96+
},
97+
"dependencies": {
98+
"antlr4ts": "^0.5.0-alpha.4",
99+
"cashc": "^0.6.3",
100+
"cashscript": "^0.6.3",
101+
"vscode-languageclient": "^7.0.0",
102+
"vscode-languageserver": "^7.0.0",
103+
"vscode-languageserver-textdocument": "^1.0.1"
104+
},
105+
"devDependencies": {
106+
"@types/vscode": "^1.56.0",
107+
"esbuild": "^0.12.8",
108+
"typescript": "^4.3.2",
109+
"vscode": "^1.1.37",
110+
"vscode-test": "^1.5.2"
111+
}
112+
}{
2113
"name": "vscode-cashscript",
3114
"displayName": "vscode-cashscript",
4115
"description": "Language extension for cashscript",
@@ -18,6 +129,49 @@
18129
"scripts": {
19130
"vscode:prepublish": "npm run compile",
20131
"compile": "tsc -p ./",
132+
"watch": "tsc -watch -p ./",{
133+
"name": "cashscript",
134+
"publisher": "NathanielCherian",
135+
"displayName": "cashscript",
136+
"description": "Cashscript language support for Visual Studio Code",
137+
"version": "1.0.0",
138+
"repository": {
139+
"type": "git",
140+
"url": "https://github.com/nathanielCherian/vscode-cashscript"
141+
},
142+
"bugs": {
143+
"url": "https://github.com/nathanielCherian/vscode-cashscript/issues"
144+
},
145+
"contributors": [
146+
"Nathaniel Cherian"
147+
],
148+
"keywords": [
149+
"cashscript",
150+
"bch",
151+
"blockchain",
152+
"compiler",
153+
"contract"
154+
],
155+
"categories": [
156+
"Programming Languages",
157+
"Snippets",
158+
"Linters"
159+
],
160+
"engines": {
161+
"vscode": "^1.56.0"
162+
},
163+
"activationEvents": [
164+
"onLanguage:cashscript",
165+
"onCommand:cashscript.compile"
166+
],
167+
"main": "./out/src/extension",
168+
"scripts": {
169+
"vscode:prepublish": "npm run -S esbuild-base -- --minify",
170+
"esbuild-base": "esbuild ./src/extension.ts --bundle --outfile=out/main.js --external:vscode --format=cjs --platform=node",
171+
"esbuild": "npm run -S esbuild-base -- --sourcemap",
172+
"esbuild-watch": "npm run -S esbuild-base -- --sourcemap --watch",
173+
"test-compile": "tsc -p ./",
174+
"compile": "tsc -p ./",
21175
"watch": "tsc -watch -p ./",
22176
"prepare": "node ./node_modules/vscode/bin/install"
23177
},
@@ -78,6 +232,73 @@
78232
"vscode-languageserver": "^7.0.0",
79233
"vscode-languageserver-textdocument": "^1.0.1"
80234
},
235+
"devDependencies": {
236+
"@types/vscode": "^1.56.0",
237+
"esbuild": "^0.12.8",
238+
"typescript": "^4.3.2",
239+
"vscode": "^1.1.37",
240+
"vscode-test": "^1.5.2"
241+
}
242+
}
243+
"prepare": "node ./node_modules/vscode/bin/install"
244+
},
245+
"contributes": {
246+
"languages": [
247+
{
248+
"id": "cashscript",
249+
"aliases": [
250+
"cashscript",
251+
"Cashscript"
252+
],
253+
"extensions": [
254+
".cash"
255+
],
256+
"configuration": "./cashscript.configuration.json"
257+
}
258+
],
259+
"grammars": [
260+
{
261+
"language": "cashscript",
262+
"scopeName": "source.cash",
263+
"path": "./syntaxes/cashscript.tmLanguage.json"
264+
}
265+
],
266+
"snippets": [
267+
{
268+
"language": "cashscript",
269+
"path": "./snippets/cashscript.snippets.json"
270+
}
271+
],
272+
"commands": [
273+
{
274+
"command": "cashscript.compile",
275+
"title": "Compile Contract"
276+
}
277+
],
278+
"keybindings": [
279+
{
280+
"command": "cashscript.compile",
281+
"key": "ctrl+f5"
282+
}
283+
],
284+
"menus": {
285+
"editor/title": [
286+
{
287+
"when": "resourceLangId == cashscript",
288+
"command": "cashscript.compile",
289+
"group": "navigation"
290+
}
291+
]
292+
}
293+
},
294+
"dependencies": {
295+
"antlr4ts": "^0.5.0-alpha.4",
296+
"cashc": "^0.6.3",
297+
"cashscript": "^0.6.3",
298+
"vscode-languageclient": "^7.0.0",
299+
"vscode-languageserver": "^7.0.0",
300+
"vscode-languageserver-textdocument": "^1.0.1"
301+
},
81302
"devDependencies": {
82303
"@types/vscode": "^1.56.0",
83304
"typescript": "^4.3.2",

0 commit comments

Comments
 (0)