Skip to content
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

Enable the disabled nodes in the node palette #553

Merged
merged 3 commits into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -158,22 +158,20 @@ private void setDefaultNodes() {

this.rootBuilder
.stepIn(Category.Name.ERROR_HANDLING)
// TODO: Uncomment when error handling is implemented
// .node(NodeKind.ERROR_HANDLER)
.node(NodeKind.ERROR_HANDLER)
.node(NodeKind.FAIL)
.node(NodeKind.PANIC)
.stepOut()
.stepIn(Category.Name.CONCURRENCY)
.node(NodeKind.FORK)
.node(NodeKind.PARALLEL_FLOW)
.node(NodeKind.WAIT)
// TODO: Uncomment when concurrency is implemented
// .node(NodeKind.TRANSACTION)
// .node(NodeKind.COMMIT)
// .node(NodeKind.ROLLBACK)
// .node(NodeKind.RETRY);
// .node(NodeKind.LOCK)
// .node(NodeKind.START)
.node(NodeKind.LOCK)
.node(NodeKind.START)
.node(NodeKind.TRANSACTION)
.node(NodeKind.COMMIT)
.node(NodeKind.ROLLBACK)
.node(NodeKind.RETRY)
.stepOut();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1285,9 +1285,8 @@ public void visit(LocalTypeDefinitionStatementNode localTypeDefinitionStatementN

@Override
public void visit(StartActionNode startActionNode) {
startNode(NodeKind.START, startActionNode)
.properties().expression(startActionNode.expression(), StartBuilder.START_EXPRESSION_DOC);
endNode(startActionNode);
startNode(NodeKind.START, startActionNode).properties()
.expression(startActionNode.expression(), StartBuilder.START_EXPRESSION_DOC);
}

@Override
Expand Down Expand Up @@ -1389,7 +1388,6 @@ public void visit(WaitActionNode waitActionNode) {
default -> nodes.add(waitFutureExpr);
}


// Generate the properties for the futures
nodeBuilder.properties().waitAll(waitAll).nestedProperty();
Node waitField;
Expand All @@ -1415,7 +1413,6 @@ public void visit(WaitActionNode waitActionNode) {
WaitBuilder.FUTURES_LABEL, WaitBuilder.FUTURES_DOC);
}


@Override
public void visit(TransactionStatementNode transactionStatementNode) {
startNode(NodeKind.TRANSACTION, transactionStatementNode);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,16 @@ public void setConcreteConstData() {

@Override
public Map<Path, List<TextEdit>> toSource(SourceBuilder sourceBuilder) {
// Write the type and the variable
Optional<Property> type = sourceBuilder.flowNode.getProperty(Property.TYPE_KEY);
Optional<Property> variable = sourceBuilder.flowNode.getProperty(Property.VARIABLE_KEY);
if (type.isPresent() && variable.isPresent()) {
sourceBuilder.token()
.expressionWithType(type.get(), variable.get())
.keyword(SyntaxKind.EQUAL_TOKEN);
}

// Write the expression
sourceBuilder.token().keyword(SyntaxKind.START_KEYWORD);
Optional<Property> property = sourceBuilder.flowNode.getProperty(Property.EXPRESSION_KEY);
property.ifPresent(value -> sourceBuilder.token()
Expand All @@ -60,6 +70,8 @@ public Map<Path, List<TextEdit>> toSource(SourceBuilder sourceBuilder) {

@Override
public void setConcreteTemplateData(TemplateContext context) {
properties().expression("", START_EXPRESSION_DOC);
properties()
.dataVariable(null, true, context.getAllVisibleSymbolNames())
.expression("", START_EXPRESSION_DOC);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,16 @@
"description": "Handle errors that occur during execution"
},
"items": [
{
"metadata": {
"label": "ErrorHandler",
"description": "Catch and handle errors"
},
"codedata": {
"node": "ERROR_HANDLER"
},
"enabled": true
},
{
"metadata": {
"label": "Fail",
Expand Down Expand Up @@ -516,6 +526,66 @@
"node": "WAIT"
},
"enabled": true
},
{
"metadata": {
"label": "Lock",
"description": "Allow to access mutable states safely"
},
"codedata": {
"node": "LOCK"
},
"enabled": true
},
{
"metadata": {
"label": "Start",
"description": "Execute a function or a method invocation in a new strand"
},
"codedata": {
"node": "START"
},
"enabled": true
},
{
"metadata": {
"label": "Transaction",
"description": "Handle transaction."
},
"codedata": {
"node": "TRANSACTION"
},
"enabled": true
},
{
"metadata": {
"label": "Commit",
"description": "Commit transaction"
},
"codedata": {
"node": "COMMIT"
},
"enabled": true
},
{
"metadata": {
"label": "Rollback",
"description": "Rollback the transaction"
},
"codedata": {
"node": "ROLLBACK"
},
"enabled": true
},
{
"metadata": {
"label": "Retry Block",
"description": "Retry block."
},
"codedata": {
"node": "RETRY"
},
"enabled": true
}
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4133,6 +4133,16 @@
"description": "Handle errors that occur during execution"
},
"items": [
{
"metadata": {
"label": "ErrorHandler",
"description": "Catch and handle errors"
},
"codedata": {
"node": "ERROR_HANDLER"
},
"enabled": true
},
{
"metadata": {
"label": "Fail",
Expand Down Expand Up @@ -4190,6 +4200,66 @@
"node": "WAIT"
},
"enabled": true
},
{
"metadata": {
"label": "Lock",
"description": "Allow to access mutable states safely"
},
"codedata": {
"node": "LOCK"
},
"enabled": true
},
{
"metadata": {
"label": "Start",
"description": "Execute a function or a method invocation in a new strand"
},
"codedata": {
"node": "START"
},
"enabled": true
},
{
"metadata": {
"label": "Transaction",
"description": "Handle transaction."
},
"codedata": {
"node": "TRANSACTION"
},
"enabled": true
},
{
"metadata": {
"label": "Commit",
"description": "Commit transaction"
},
"codedata": {
"node": "COMMIT"
},
"enabled": true
},
{
"metadata": {
"label": "Rollback",
"description": "Rollback the transaction"
},
"codedata": {
"node": "ROLLBACK"
},
"enabled": true
},
{
"metadata": {
"label": "Retry Block",
"description": "Retry block."
},
"codedata": {
"node": "RETRY"
},
"enabled": true
}
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,16 @@
"description": "Handle errors that occur during execution"
},
"items": [
{
"metadata": {
"label": "ErrorHandler",
"description": "Catch and handle errors"
},
"codedata": {
"node": "ERROR_HANDLER"
},
"enabled": true
},
{
"metadata": {
"label": "Fail",
Expand Down Expand Up @@ -189,6 +199,66 @@
"node": "WAIT"
},
"enabled": true
},
{
"metadata": {
"label": "Lock",
"description": "Allow to access mutable states safely"
},
"codedata": {
"node": "LOCK"
},
"enabled": true
},
{
"metadata": {
"label": "Start",
"description": "Execute a function or a method invocation in a new strand"
},
"codedata": {
"node": "START"
},
"enabled": true
},
{
"metadata": {
"label": "Transaction",
"description": "Handle transaction."
},
"codedata": {
"node": "TRANSACTION"
},
"enabled": true
},
{
"metadata": {
"label": "Commit",
"description": "Commit transaction"
},
"codedata": {
"node": "COMMIT"
},
"enabled": true
},
{
"metadata": {
"label": "Rollback",
"description": "Rollback the transaction"
},
"codedata": {
"node": "ROLLBACK"
},
"enabled": true
},
{
"metadata": {
"label": "Retry Block",
"description": "Retry block."
},
"codedata": {
"node": "RETRY"
},
"enabled": true
}
]
},
Expand Down
Loading
Loading