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

Add support for tasks #212

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
19 changes: 19 additions & 0 deletions src/com/millennialmedia/intellibot/psi/RobotKeywordProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ public static RobotKeywordProvider getInstance() {
KEYWORD_TABLE.addSyntax(RobotTokenTypes.HEADING, "*** Setting ***");
KEYWORD_TABLE.addSyntax(RobotTokenTypes.HEADING, "*** Test Cases ***");
KEYWORD_TABLE.addSyntax(RobotTokenTypes.HEADING, "*** Test Case ***");
KEYWORD_TABLE.addSyntax(RobotTokenTypes.HEADING, "*** Tasks ***");
KEYWORD_TABLE.addSyntax(RobotTokenTypes.HEADING, "*** Task ***");
KEYWORD_TABLE.addSyntax(RobotTokenTypes.HEADING, "*** Keywords ***");
KEYWORD_TABLE.addSyntax(RobotTokenTypes.HEADING, "*** Keyword ***");
KEYWORD_TABLE.addSyntax(RobotTokenTypes.HEADING, "*** Metadata ***");
Expand All @@ -41,6 +43,7 @@ public static RobotKeywordProvider getInstance() {

addRecommendation(RobotTokenTypes.HEADING, "*** Settings ***", "Settings");
addRecommendation(RobotTokenTypes.HEADING, "*** Test Cases ***", "Test Cases");
addRecommendation(RobotTokenTypes.HEADING, "*** Tasks ***", "Task");
addRecommendation(RobotTokenTypes.HEADING, "*** Keywords ***", "Keywords");
addRecommendation(RobotTokenTypes.HEADING, "*** Variables ***", "Variables");

Expand All @@ -54,6 +57,10 @@ public static RobotKeywordProvider getInstance() {
KEYWORD_TABLE.addSyntax(RobotTokenTypes.SETTING, "Test Teardown");
KEYWORD_TABLE.addSyntax(RobotTokenTypes.SETTING, "Test Postcondition");
KEYWORD_TABLE.addSyntax(RobotTokenTypes.SETTING, "Test Template");
KEYWORD_TABLE.addSyntax(RobotTokenTypes.SETTING, "Task Timeout");
KEYWORD_TABLE.addSyntax(RobotTokenTypes.SETTING, "Task Setup");
KEYWORD_TABLE.addSyntax(RobotTokenTypes.SETTING, "Task Teardown");
KEYWORD_TABLE.addSyntax(RobotTokenTypes.SETTING, "Task Template");
KEYWORD_TABLE.addSyntax(RobotTokenTypes.SETTING, "Documentation");
KEYWORD_TABLE.addSyntax(RobotTokenTypes.SETTING, "Metadata");
KEYWORD_TABLE.addSyntax(RobotTokenTypes.SETTING, "Force Tags");
Expand All @@ -77,6 +84,10 @@ public static RobotKeywordProvider getInstance() {
addRecommendation(RobotTokenTypes.SETTING, "Test Teardown", "Test Teardown");
addRecommendation(RobotTokenTypes.SETTING, "Test Template", "Test Template");
addRecommendation(RobotTokenTypes.SETTING, "Test Timeout", "Test Timeout");
addRecommendation(RobotTokenTypes.SETTING, "Task Setup", "Task Setup");
addRecommendation(RobotTokenTypes.SETTING, "Task Teardown", "Task Teardown");
addRecommendation(RobotTokenTypes.SETTING, "Task Template", "Task Template");
addRecommendation(RobotTokenTypes.SETTING, "Task Timeout", "Task Timeout");

KEYWORD_TABLE.addSyntax(RobotTokenTypes.BRACKET_SETTING, "[Setup]");
KEYWORD_TABLE.addSyntax(RobotTokenTypes.BRACKET_SETTING, "[Precondition]");
Expand Down Expand Up @@ -127,25 +138,32 @@ public static RobotKeywordProvider getInstance() {
GLOBAL_SETTINGS.add("Suite Teardown");
GLOBAL_SETTINGS.add("Suite Postcondition");
GLOBAL_SETTINGS.add("Test Setup");
GLOBAL_SETTINGS.add("Task Setup");
GLOBAL_SETTINGS.add("Test Precondition");
GLOBAL_SETTINGS.add("Test Teardown");
GLOBAL_SETTINGS.add("Task Teardown");
GLOBAL_SETTINGS.add("Test PostCondition");
GLOBAL_SETTINGS.add("Test Template");
GLOBAL_SETTINGS.add("Task Template");
GLOBAL_SETTINGS.add("Documentation");
GLOBAL_SETTINGS.add("Metadata");
GLOBAL_SETTINGS.add("Force Tags");
GLOBAL_SETTINGS.add("Default Tags");
GLOBAL_SETTINGS.add("Test Timeout");
GLOBAL_SETTINGS.add("Task Timeout");

SETTINGS_FOLLOWED_BY_KEYWORDS.add("Suite Setup");
SETTINGS_FOLLOWED_BY_KEYWORDS.add("Suite Precondition");
SETTINGS_FOLLOWED_BY_KEYWORDS.add("Suite Teardown");
SETTINGS_FOLLOWED_BY_KEYWORDS.add("Suite Postcondition");
SETTINGS_FOLLOWED_BY_KEYWORDS.add("Test Setup");
SETTINGS_FOLLOWED_BY_KEYWORDS.add("Task Setup");
SETTINGS_FOLLOWED_BY_KEYWORDS.add("Test Precondition");
SETTINGS_FOLLOWED_BY_KEYWORDS.add("Test Teardown");
SETTINGS_FOLLOWED_BY_KEYWORDS.add("Task Teardown");
SETTINGS_FOLLOWED_BY_KEYWORDS.add("Test PostCondition");
SETTINGS_FOLLOWED_BY_KEYWORDS.add("Test Template");
SETTINGS_FOLLOWED_BY_KEYWORDS.add("Task Template");
SETTINGS_FOLLOWED_BY_KEYWORDS.add("Setup");
SETTINGS_FOLLOWED_BY_KEYWORDS.add("[Setup]");
SETTINGS_FOLLOWED_BY_KEYWORDS.add("Precondition");
Expand All @@ -163,6 +181,7 @@ public static RobotKeywordProvider getInstance() {
SETTINGS_FOLLOWED_BY_STRINGS.add("Force Tags");
SETTINGS_FOLLOWED_BY_STRINGS.add("Default Tags");
SETTINGS_FOLLOWED_BY_STRINGS.add("Test Timeout");
SETTINGS_FOLLOWED_BY_STRINGS.add("Task Timeout");
SETTINGS_FOLLOWED_BY_STRINGS.add("Tags");
SETTINGS_FOLLOWED_BY_STRINGS.add("[Tags]");
SETTINGS_FOLLOWED_BY_STRINGS.add("Return");
Expand Down
2 changes: 1 addition & 1 deletion src/com/millennialmedia/intellibot/psi/RobotLexer.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ private static boolean isSettings(String line) {
}

private static boolean isTestCases(String line) {
return "*** Test Cases ***".equals(line) || "*** Test Case ***".equals(line);
return line.matches("\\*\\*\\* (Test Cases?|Tasks?) \\*\\*\\*");
}

private static boolean isKeywords(String line) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ private boolean containsVariables() {
public boolean containsTestCases() {
// TODO: better OO
String text = getPresentableText();
return text.startsWith("*** Test Case");
return text.matches("^\\*\\*\\* (Test Case|Task).*");
}

@Override
Expand Down