Skip to content

Commit c73c81a

Browse files
Merge pull request #6 from nathanielCherian/next
v0.2.0
2 parents 199dcd8 + c8694e9 commit c73c81a

18 files changed

Lines changed: 5563 additions & 4967 deletions

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,11 @@ Would like to implement tests and other sustainability features before bumping v
1919
## 0.1.2
2020
- Added tx to completion provider and syntax highlighting
2121
- added byte alias for bytes1
22+
23+
## 0.2.0
24+
- Compatible with ```cashscript@0.7.0```
25+
- Updated to new Native Introspection functionality
26+
- Added tuple destructuring
27+
- Added new ```constant``` keyword
28+
- Added ```*``` operator
29+

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ None available yet.
5252

5353
Check the [changelog](/CHANGELOG.md) for past releases. Latest stable version:
5454

55-
### 0.1.2
56-
- Added tx to completion provider and syntax highlighting
57-
- added byte alias for bytes1
55+
## 0.2.0
56+
- Compatible with ```cashscript@0.7.0```
57+
- Updated to new Native Introspection functionality
58+
- Added tuple destructuring
59+
- Added new ```constant``` keyword
60+
- Added ```'*'``` operator

examples/next.cash

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
pragma cashscript ^0.7.0;
2+
3+
contract P2PKH() {
4+
function spend() {
5+
bytes2 left, bytes2 right = 0x123456.split(2);
6+
int constant c = 5;
7+
require(left == right);
8+
require(c*2 == 2);
9+
require(tx.outputs[0].value == tx.inputs[this.activeInputIndex].value - 10*10);
10+
}
11+
}

package-lock.json

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

package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"publisher": "NathanielCherian",
44
"displayName": "cashscript",
55
"description": "Cashscript language support for Visual Studio Code",
6-
"version": "0.1.2",
6+
"version": "0.2.0",
77
"icon": "media/icon.png",
88
"repository": {
99
"type": "git",
@@ -96,17 +96,17 @@
9696
},
9797
"dependencies": {
9898
"antlr4ts": "^0.5.0-alpha.4",
99-
"cashc": "0.6.4",
100-
"cashscript": "^0.6.4",
99+
"cashc": "^0.7.0",
100+
"cashscript": "^0.7.0",
101101
"vscode-languageclient": "^7.0.0",
102102
"vscode-languageserver": "^7.0.0",
103-
"vscode-languageserver-textdocument": "^1.0.1"
103+
"vscode-languageserver-textdocument": "^1.0.4"
104104
},
105105
"devDependencies": {
106-
"@types/vscode": "^1.56.0",
107-
"esbuild": "^0.12.8",
108-
"typescript": "^4.3.2",
106+
"@types/vscode": "^1.63.1",
107+
"esbuild": "^0.12.29",
108+
"typescript": "^4.5.5",
109109
"vscode": "^1.1.37",
110-
"vscode-test": "^1.5.2"
110+
"vscode-test": "^1.6.1"
111111
}
112112
}

src/CashscriptCompletionProvider.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,13 @@ export default class CashscriptCompletionProvider implements vscode.CompletionIt
5353

5454
protected getDotCompletions():CompletionItem[]{
5555

56-
const re = /(\w+).$/ // EX: "tx."
56+
const re = /(\w+)(\[.+\])?.$/ // EX: "tx."
5757
const range:Range = new Range(new vscode.Position(this.pos.line, 0), this.pos)
5858
const text = this.doc.getText(range);
5959
var arr, keyword;
6060
if((arr=text?.match(re))){
6161
keyword = arr[1];
62+
if(arr[2]) keyword+="_indexed"; // ex. inputs[0].
6263
console.log("keyword: ", keyword);
6364

6465
return DOT_COMPLETIONS[keyword];

src/CashscriptHoverProvider.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ class CashscriptHoverProvider implements vscode.HoverProvider{
2525
const miscel = this.getMiscellaneousHovers(document, position);
2626
if(miscel) return new vscode.Hover(miscel, range)
2727

28-
const dotHovers = this.getTxDotHovers(document, position);
29-
if(dotHovers) return new vscode.Hover(dotHovers, range)
28+
// const dotHovers = this.getTxDotHovers(document, position);
29+
// if(dotHovers) return new vscode.Hover(dotHovers, range)
3030

3131

3232
return null;
@@ -83,12 +83,12 @@ class CashscriptHoverProvider implements vscode.HoverProvider{
8383
return matches[1];
8484
}
8585

86+
// NEED TO UPDATE THIS AFTER NEW DOCS COME OUT
8687
getTxDotHovers(document:vscode.TextDocument, position:vscode.Position):vscode.MarkdownString[]{
8788
const reg = /tx.[a-zA-Z0-9]+/;
8889
let range = document.getWordRangeAtPosition(position, reg);
8990
let word = document.getText(range).substring(3);
9091

91-
// /### tx.(\w+)\n+```solidity\n(.+)\n```/
9292
const TX_HOVERS = {
9393
time:{
9494
code:'require(tx.time >= <expression>);'

0 commit comments

Comments
 (0)