Skip to content

Commit

Permalink
fix providers
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanielCherian committed Jan 31, 2022
1 parent 3adac8d commit 664aab2
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 60 deletions.
3 changes: 1 addition & 2 deletions examples/next.cash
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ contract P2PKH() {
function spend() {
// bytes2 left, bytes2 right = 0x123456.split(2);
// require(left == right);

require(tx.outputs[0].value == tx.inputs[this.activeInputIndex].value - 1000);
require(tx.outputs[0].value == tx.inputs[this.activeInputIndex].value - 10*10);
}
}
4 changes: 0 additions & 4 deletions src/CashscriptCompletionProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,6 @@ export default class CashscriptCompletionProvider implements vscode.CompletionIt
if(arr[2]) keyword+="_indexed"; // ex. inputs[0].
console.log("keyword: ", keyword);

// return [{
// label:keyword,
// kind:CompletionItemKind.Field
// }]
return DOT_COMPLETIONS[keyword];
}

Expand Down
6 changes: 3 additions & 3 deletions src/CashscriptHoverProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ class CashscriptHoverProvider implements vscode.HoverProvider{
const miscel = this.getMiscellaneousHovers(document, position);
if(miscel) return new vscode.Hover(miscel, range)

const dotHovers = this.getTxDotHovers(document, position);
if(dotHovers) return new vscode.Hover(dotHovers, range)
// const dotHovers = this.getTxDotHovers(document, position);
// if(dotHovers) return new vscode.Hover(dotHovers, range)


return null;
Expand Down Expand Up @@ -83,12 +83,12 @@ class CashscriptHoverProvider implements vscode.HoverProvider{
return matches[1];
}

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

// /### tx.(\w+)\n+```solidity\n(.+)\n```/
const TX_HOVERS = {
time:{
code:'require(tx.time >= <expression>);'
Expand Down
51 changes: 0 additions & 51 deletions src/LanguageDesc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,57 +110,6 @@ let TYPECASTS:Data = {
let LANGUAGE:Data = {...GLOBAL_FUNCTIONS, ...OUTPUT_INSTANTIATION, ...STATEMENTS};


/*
{
label:"time",
kind:CompletionItemKind.Field,
},
{
label:"age",
kind:CompletionItemKind.Field
},
{
label:"version",
kind:CompletionItemKind.Field
},
{
label:"hashPrevouts",
kind:CompletionItemKind.Field
},
{
label:"hashSequence",
kind:CompletionItemKind.Field
},
{
label:"outpoint",
kind:CompletionItemKind.Field
},
{
label:"bytecode",
kind:CompletionItemKind.Field
},
{
label:"value",
kind:CompletionItemKind.Field
},
{
label:"sequence",
kind:CompletionItemKind.Field
},
{
label:"hashOutputs",
kind:CompletionItemKind.Field
},
{
label:"locktime",
kind:CompletionItemKind.Field
},
{
label:"hashtype",
kind:CompletionItemKind.Field
},
*/

let DOT_COMPLETIONS:{[key:string]:CompletionItem[]} = {
tx:[
{
Expand Down

0 comments on commit 664aab2

Please sign in to comment.