aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/ScriptingBox.tsx
diff options
context:
space:
mode:
authoranika-ahluwalia <anika.ahluwalia@gmail.com>2020-06-03 13:04:47 -0500
committeranika-ahluwalia <anika.ahluwalia@gmail.com>2020-06-03 13:04:47 -0500
commitdb747fcb82c44a63cc3905c031ab2ae34403f5ae (patch)
treecbc51b529bf130be3c650320d26435ccfbc2324a /src/client/views/nodes/ScriptingBox.tsx
parent35a49fa4974bdefd35675c4128d857f7580ebc0b (diff)
fixed uneven parantheses showing params suggestion
Diffstat (limited to 'src/client/views/nodes/ScriptingBox.tsx')
-rw-r--r--src/client/views/nodes/ScriptingBox.tsx43
1 files changed, 29 insertions, 14 deletions
diff --git a/src/client/views/nodes/ScriptingBox.tsx b/src/client/views/nodes/ScriptingBox.tsx
index f1105e614..f6e7e375b 100644
--- a/src/client/views/nodes/ScriptingBox.tsx
+++ b/src/client/views/nodes/ScriptingBox.tsx
@@ -491,10 +491,25 @@ export class ScriptingBox extends ViewBoxAnnotatableComponent<FieldViewProps, Sc
this._scriptSuggestedParams = this.getSuggestedParams(pos);
if (this._scriptSuggestedParams !== undefined && this._scriptSuggestedParams.length > 0) {
- this._paramSuggestion = true;
+ if (this.rawScript[pos - 2] !== "(") {
+ console.log("suggestion params");
+ this._paramSuggestion = true;
+ }
}
} else if (e.key === ")") {
this._paramSuggestion = false;
+ } else {
+ console.log(this.rawScript.split("(").length - 1);
+ console.log(this.rawScript.split(")").length - 1);
+ if (this.rawScript.split("(").length - 1 <= this.rawScript.split(")").length - 1) {
+ console.log("removed params");
+ this._paramSuggestion = false;
+ } else {
+ if (e.key === "Backspace") {
+ console.log("removed params");
+ this._paramSuggestion = false;
+ }
+ }
}
}
@@ -542,12 +557,12 @@ export class ScriptingBox extends ViewBoxAnnotatableComponent<FieldViewProps, Sc
onMouseLeave={() => this.setHovered(false)}>
{value}
</div>
- {!this._hovered ? (null) :
- <>
- <div key="desc" style={{ fontSize: "10px" }}>{this.getDescription(value)}</div>
- <div key="params" style={{ fontSize: "10px" }}>{this.getParams(value)}</div>
- </>
- }
+ {/* {!this._hovered ? (null) :
+ <> */}
+ <div key="desc" style={{ fontSize: "10px" }}>{this.getDescription(value)}</div>
+ <div key="params" style={{ fontSize: "10px" }}>{this.getParams(value)}</div>
+ {/* </>
+ } */}
</div>,
output: (item: any, trigger) => {
this._spaced = true;
@@ -563,12 +578,12 @@ export class ScriptingBox extends ViewBoxAnnotatableComponent<FieldViewProps, Sc
onMouseLeave={() => this.setHovered(false)}>
{value}
</div>
- {!this._hovered ? (null) :
- <>
- <div key="desc" style={{ fontSize: "10px" }}>{this.getDescription(value)}</div>
- <div key="params" style={{ fontSize: "10px" }}>{this.getParams(value)}</div>
- </>
- }
+ {/* {!this._hovered ? (null) :
+ <> */}
+ <div key="desc" style={{ fontSize: "10px" }}>{this.getDescription(value)}</div>
+ <div key="params" style={{ fontSize: "10px" }}>{this.getParams(value)}</div>
+ {/* </>
+ } */}
</div>,
output: (item: any, trigger) => {
this._spaced = true;
@@ -577,7 +592,7 @@ export class ScriptingBox extends ViewBoxAnnotatableComponent<FieldViewProps, Sc
}
}}
- onKeyPress={(e) => this.keyHandler(e, this.caretPos)}
+ onKeyDown={(e) => this.keyHandler(e, this.caretPos)}
onCaretPositionChange={(number: any) => this.handlePosChange(number)}
/>