Skip to content
This repository has been archived by the owner on Oct 5, 2021. It is now read-only.

Commit

Permalink
Merge pull request #754 from Shan1024/update-transaction
Browse files Browse the repository at this point in the history
Remove obsolete keywords
  • Loading branch information
anupama-pathirage authored Dec 14, 2017
2 parents 3efe5f3 + cfaa0d7 commit 29095a6
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,6 @@ public class BallerinaCompletionUtils {
private static final LookupElementBuilder WORKER;
private static final LookupElementBuilder TRANSACTION;
private static final LookupElementBuilder FAILED;
private static final LookupElementBuilder ABORTED;
private static final LookupElementBuilder COMMITTED;
private static final LookupElementBuilder ABORT;
private static final LookupElementBuilder TRY;
private static final LookupElementBuilder CATCH;
Expand Down Expand Up @@ -177,8 +175,6 @@ public class BallerinaCompletionUtils {
WORKER = createKeywordLookupElement("worker");
TRANSACTION = createKeywordLookupElement("transaction");
FAILED = createKeywordLookupElement("failed");
ABORTED = createKeywordLookupElement("aborted");
COMMITTED = createKeywordLookupElement("committed");
ABORT = createKeywordLookupElement("abort");
TRY = createKeywordLookupElement("try");
CATCH = createKeywordLookupElement("catch");
Expand Down Expand Up @@ -381,8 +377,6 @@ static List<LookupElement> getCommonKeywords() {
lookupElements.add(createKeywordAsLookup(WORKER));
lookupElements.add(createKeywordAsLookup(TRANSACTION));
lookupElements.add(createKeywordAsLookup(FAILED));
lookupElements.add(createKeywordAsLookup(ABORTED));
lookupElements.add(createKeywordAsLookup(COMMITTED));
lookupElements.add(createKeywordAsLookup(ABORT));
lookupElements.add(createKeywordAsLookup(TRY));
lookupElements.add(createKeywordAsLookup(CATCH));
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/liveTemplates/Ballerina.xml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
</context>
</template>

<template name="tran" value="transaction with retries($COUNT$){ {&#10; $END$&#10;} failed {&#10; &#10;}"
<template name="tran" value="transaction with retries($COUNT$){ &#10; $END$&#10;} failed {&#10; &#10;}"
description="Transaction Template" toReformat="false" toShortenFQNames="false">
<variable name="COUNT" expression="" defaultValue="" alwaysStopAt="true"/>
<context>
Expand Down
18 changes: 0 additions & 18 deletions src/main/resources/liveTemplates/BallerinaHidden.xml
Original file line number Diff line number Diff line change
Expand Up @@ -106,24 +106,6 @@
</context>
</template>

<template description='Aborted clause' id='ballerina_lang_aborted' name='ballerina_lang_aborted'
toReformat='false' toShortenFQNames='true' value='aborted {&#10; $END$&#10;}'>
<context>
<option name="BALLERINA_RESOURCE" value="true"/>
<option name="BALLERINA_FUNCTION" value="true"/>
<option name="BALLERINA_ACTION" value="true"/>
</context>
</template>

<template description='Committed clause' id='ballerina_lang_committed' name='ballerina_lang_committed'
toReformat='false' toShortenFQNames='true' value='committed {&#10; $END$&#10;}'>
<context>
<option name="BALLERINA_RESOURCE" value="true"/>
<option name="BALLERINA_FUNCTION" value="true"/>
<option name="BALLERINA_ACTION" value="true"/>
</context>
</template>

<template description='Try Statement' id='ballerina_lang_try' name='ballerina_lang_try'
toReformat='false' toShortenFQNames='true' value='try {&#10; $END$&#10;}'>
<context>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,14 +266,13 @@ public void testFunctionBodyWithCommonKeywords() {
expectedLookups.add("finally");
expectedLookups.add("iterate");
expectedLookups.add("while");
expectedLookups.add("committed");
expectedLookups.add("failed");
doTest("function test () { i<caret> }", expectedLookups.toArray(new String[expectedLookups.size()]));
}

public void testFunctionBodyWithFunctionLevelKeywords() {
doTest("function test () { r<caret> }", "return", "string", "fork", "worker", "transaction",
"abort", "aborted", "try", "break", "iterate", "throw", "var");
"abort", "try", "break", "iterate", "throw", "var");
}

public void testInvokingFunctionInDifferentFile1() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,8 @@ public abstract class BallerinaCompletionTestBase extends BallerinaCodeInsightFi
static final List<String> REFERENCE_TYPES = Arrays.asList("message", "map", "xml", "json", "datatable");
static final List<String> XMLNS_TYPE = Collections.singletonList("xmlns");
static final List<String> OTHER_TYPES = Arrays.asList("any", "type", "var");
static final List<String> COMMON_KEYWORDS = Arrays.asList("if", "else", "fork", "join", "timeout",
"worker", "transaction", "failed", "aborted", "committed", "abort", "try", "catch", "finally",
"iterate", "while", "next", "break", "throw");
static final List<String> COMMON_KEYWORDS = Arrays.asList("if", "else", "fork", "join", "timeout", "worker",
"transaction", "failed", "abort", "try", "catch", "finally", "iterate", "while", "next", "break", "throw");
static final List<String> VALUE_KEYWORDS = Arrays.asList("true", "false", "null");
static final List<String> FUNCTION_LEVEL_KEYWORDS = Collections.singletonList("return");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,6 @@ public void testTransactionKeyword() {
"}", null);
}

public void testAbortedKeyword() {
doCheckResult("test.bal", "function test(){ aborted<caret> }", "function test(){ aborted {\n \n} }", null);
}

public void testCommittedKeyword() {
doCheckResult("test.bal", "function test(){ committed<caret> }", "function test(){ committed {\n \n} }",
null);
}

public void testTryKeyword() {
doCheckResult("test.bal", "function test(){ try<caret> }", "function test(){ try {\n \n} }", null);
}
Expand Down

0 comments on commit 29095a6

Please sign in to comment.