-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cursor ast update #2409
Cursor ast update #2409
Conversation
Kb exit toolbox
…e the recently selected stack.
* Set node version explicitly for travis * rebuild * Tweak travis config
When moving from a stack to the workspace, place the cursor just above the recently selected stack.
…into cursor_ast_update
…ckly into warnings_fix
Warnings fix
Add tests for keyboard handling in the toolbox
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A general comment: we need a way to describe an AST node "for" a given connection, block, etc. Representing? Pointing to? Wrapping? Pick one and be consistent in all comments. (I like "pointing to")
Several comments start with "Pattern". Those are comments that apply to multiple places in the code, but that I didn't tag every single spot. Please update anything you find with that pattern in code you touched in this PR, but you don't need to hunt down every use of it in your code.
@@ -66,9 +68,36 @@ Blockly.Navigation.STATE_TOOLBOX = 3; | |||
|
|||
/** | |||
* The current state the user is in. | |||
* Initialized to workspace state since a user enters navigation mode by shift | |||
* clicking on a block or workspace. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add type annotation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
core/ast_node.js
Outdated
/* | ||
* The type of the location. | ||
* @type String | ||
* One of Blockly.ASTNode.types | ||
* @type string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pattern: use @type {string}
instead of @type string
, and for other type annotations on properties. I think it's mostly here and in navigation.js.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
core/ast_node.js
Outdated
}; | ||
|
||
/** | ||
* The amount to move the workspace coordinate. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please clarify.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
/** | ||
* Create an ast node from a field. | ||
* @param {?Blockly.Field} field The location of the ast node. | ||
* @return {?Blockly.ASTNode} An ast node for a field. | ||
* @param {Blockly.Field} field The location of the ast node. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pattern: move to a consistent version of AST Node in comments (from the current mix of astnode, ast node, ASTNode, AST Node, AST node)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
core/ast_node.js
Outdated
if (connection.type === Blockly.INPUT_VALUE) { | ||
astNode = new Blockly.ASTNode(Blockly.ASTNode.types.INPUT, connection); | ||
astNode = Blockly.ASTNode.createInputNode(connection.getParentInput()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pattern: since you aren't doing anything to the astNode
after the if/else, return the new node immediately, and return null at the end.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
core/cursor_svg.js
Outdated
@@ -82,7 +83,7 @@ Blockly.CursorSvg.CURSOR_REFERENCE = null; | |||
|
|||
/** | |||
* Parent svg element. | |||
* This is generally a block unless the cursor is on the workspace | |||
* This is generally a block unless the cursor is on the workspace. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"This is generally a block's svg root, unless the cursor is on the workspace."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
@@ -146,15 +147,16 @@ Blockly.CursorSvg.prototype.setParent_ = function(newParent) { | |||
|
|||
/** | |||
* Show the cursor using coordinates. | |||
* @param {?goog.math.Coordinate} position The position of the cursor on the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clean up comment (you left a word)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
core/cursor_svg.js
Outdated
Blockly.CursorSvg.prototype.update_ = function(position) { | ||
this.showWithAnything_(position); | ||
Blockly.CursorSvg.prototype.update_ = function() { | ||
this.showWithAnything_(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider moving all ofshowWithAnything
into here and deleting that function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
core/navigation.js
Outdated
}; | ||
|
||
/** | ||
* Get the insertion connection. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Explain what the insertion connection is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -279,14 +320,16 @@ Blockly.Navigation.resetFlyout = function() { | |||
|
|||
/** | |||
* Finds the best connection. | |||
* @param {!Blockly.Block} block The block to be connected. | |||
* @param {!Blockly.Connection} connection The connection to connect to. | |||
* @param {Blockly.Block} block The block to be connected. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Explain what the best connection is
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
The basics
The details
Resolves
Proposed Changes
Contains:
Reason for Changes
Test Coverage
Tested on:
Additional Information