debugger icon indicating copy to clipboard operation
debugger copied to clipboard

[Expression] syntax errors are cleared on save

Open Loirooriol opened this issue 8 years ago • 9 comments

Create a watch expression with a syntax error, e.g. [1,2,3

Result: the expression is cleared and "Invalid expression..." is displayed.

Expected: the expression is not cleared so that you can fix the syntax error without having to rewrite it all.

Loirooriol avatar Jan 25 '18 22:01 Loirooriol

@Loirooriol I believe this was added to the debugger in github. It should be in nightly tomorrow or monday.

jasonLaster avatar Jan 25 '18 23:01 jasonLaster

Still bad after bug 1432842 (v10).

Loirooriol avatar Jan 26 '18 17:01 Loirooriol

CC @bomsy @wldcordeiro what do you think?

jasonLaster avatar Feb 11 '18 14:02 jasonLaster

I think it's a good idea that we do not clear the invalid expression. It can be quite frustrating to retype really long expressions because of tiny mistakes. Maybe making the border (and also maybe the text) red should be quite obvious to the user.

bomsy avatar Feb 11 '18 17:02 bomsy

Maybe we shoould fix this as well here

The field should not remain red (in the invalid expression state) after the invalid expression has been field.

bomsy avatar Feb 11 '18 17:02 bomsy

/claim

marcogallo566 avatar Mar 12 '18 13:03 marcogallo566

Thanks for claiming the issue! :wave:

!!! Please check your email and confirm the invitation

Here are some links for getting setup, contributing, and developing. We're always happy to answer questions in slack! If you become busy, feel free to /unclaim it.

:fox_face: Debugger team!

claim avatar Mar 12 '18 13:03 claim

diff --git a/src/actions/expressions.js b/src/actions/expressions.js
index bf237e9..62fde2e 100644
--- a/src/actions/expressions.js
+++ b/src/actions/expressions.js
@@ -48,6 +48,7 @@ export function addExpression(input: string) {
 }
 
 export function clearExpressionError() {
+  // maybe this will help
   return { type: "CLEAR_EXPRESSION_ERROR" };
 }
 
diff --git a/src/components/SecondaryPanes/Expressions.js b/src/components/SecondaryPanes/Expressions.js
index fb22daf..dbd22d0 100644
--- a/src/components/SecondaryPanes/Expressions.js
+++ b/src/components/SecondaryPanes/Expressions.js
@@ -57,6 +57,7 @@ class Expressions extends Component<Props, State> {
   }
 
   clear = () => {
+    // some useful code
     this.setState(() => {
       this.props.clearExpressionError();
       return { editing: false, editIndex: -1, inputValue: "" };
@@ -207,6 +208,8 @@ class Expressions extends Component<Props, State> {
   renderExpressionEditInput(expression: Expression) {
     const { expressionError } = this.props;
     const { inputValue, editing } = this.state;
+
+    /// is this doing the right thing?
     const error = editing === true && expressionError === true;
     return (
       <span className="expression-input-container" key={expression.input}>

jasonLaster avatar Mar 12 '18 13:03 jasonLaster

Thank you, this will help a lot!

marcogallo566 avatar Mar 12 '18 13:03 marcogallo566