File tree Expand file tree Collapse file tree 5 files changed +31
-23
lines changed
src/com/millennialmedia/intellibot Expand file tree Collapse file tree 5 files changed +31
-23
lines changed Original file line number Diff line number Diff line change @@ -29,15 +29,12 @@ public String getDisplayName() {
2929
3030 @ Override
3131 public boolean skip (PsiElement element ) {
32- if (element .getNode ().getElementType () != RobotTokenTypes .ARGUMENT ) {
33- return true ;
34- } else if (!(element instanceof Argument )) {
35- return true ;
36- }
37- PsiFile file = element .getContainingFile ();
38- if (!(file instanceof RobotFile )) {
32+ if (!(element instanceof Argument )) {
3933 return true ;
4034 }
35+ // else if (element.getNode().getElementType() != RobotTokenTypes.ARGUMENT) {
36+ // return true;
37+ // }
4138
4239 PsiElement parent = element .getParent ();
4340
@@ -58,7 +55,11 @@ public boolean skip(PsiElement element) {
5855 if (importFile == null ) {
5956 return true ; // we cannot find the file thus we do not know if we use it
6057 }
61-
58+
59+ PsiFile file = element .getContainingFile ();
60+ if (!(file instanceof RobotFile )) {
61+ return true ;
62+ }
6263 Collection <PsiFile > referenced = ((RobotFile ) file ).getFilesFromInvokedKeywordsAndVariables ();
6364 return referenced .contains (importFile .getContainingFile ());
6465 } else {
Original file line number Diff line number Diff line change 55import com .millennialmedia .intellibot .RobotBundle ;
66import com .millennialmedia .intellibot .ide .inspections .SimpleRobotInspection ;
77import com .millennialmedia .intellibot .psi .RobotTokenTypes ;
8+ import com .millennialmedia .intellibot .psi .element .Argument ;
89import com .millennialmedia .intellibot .psi .element .Import ;
910import org .jetbrains .annotations .Nls ;
1011import org .jetbrains .annotations .NotNull ;
@@ -24,7 +25,10 @@ public String getDisplayName() {
2425
2526 @ Override
2627 public boolean skip (PsiElement element ) {
27- if (element .getNode ().getElementType () != RobotTokenTypes .ARGUMENT ) {
28+ // if (element.getNode().getElementType() != RobotTokenTypes.ARGUMENT) {
29+ // return true;
30+ // }
31+ if (!(element instanceof Argument )) {
2832 return true ;
2933 }
3034 PsiElement parent = element .getParent ();
Original file line number Diff line number Diff line change @@ -45,8 +45,8 @@ public boolean skip(PsiElement element) {
4545 container = container .getParent ();
4646 }
4747 if (container instanceof KeywordStatement ) {
48- KeywordInvokable invokable = ((KeywordStatement ) container ).getInvokable ();
49- String text = invokable == null ? null : invokable .getPresentableText ();
48+ // KeywordInvokable invokable = ((KeywordStatement) container).getInvokable();
49+ // String text = invokable == null ? null : invokable.getPresentableText();
5050// if (text != null) {
5151// if (text.startsWith(":")) {
5252// // TODO: for loops
Original file line number Diff line number Diff line change 1717 */
1818public class RobotKeywordDefinitionStartingWithGherkin extends SimpleRobotInspection {
1919
20+ private static final Collection <String > gherkin ;
21+
22+ static {
23+ gherkin = RobotKeywordProvider .getInstance ().getSyntaxOfType (RobotTokenTypes .GHERKIN );
24+ }
25+
2026 @ Nls
2127 @ NotNull
2228 @ Override
@@ -30,16 +36,12 @@ public boolean skip(PsiElement element) {
3036 }
3137
3238 private boolean valid (String text ) {
33- Collection <String > gherkin = RobotKeywordProvider .getInstance ().getSyntaxOfType (RobotTokenTypes .GHERKIN );
39+ // Collection<String> gherkin = RobotKeywordProvider.getInstance().getSyntaxOfType(RobotTokenTypes.GHERKIN);
3440 int firstSpace = text .indexOf (" " );
35-
36- String word ;
37- if (firstSpace < 0 ) {
38- word = text ;
39- } else {
40- word = text .substring (0 , firstSpace );
41+ if (firstSpace >= 0 ) {
42+ text = text .substring (0 , firstSpace );
4143 }
42- return !gherkin .contains (word );
44+ return !gherkin .contains (text );
4345 }
4446
4547 @ Override
Original file line number Diff line number Diff line change @@ -24,10 +24,11 @@ public PsiElement resolve() {
2424 String keyword = element .getPresentableText ();
2525 // all files we import are based off the file we are currently in
2626 // TODO: potentially unsafe cast
27- PerformanceCollector debug = new PerformanceCollector ((PerformanceEntity ) element , "resolve" );
28- PsiElement results = ResolverUtils .resolveKeywordFromFile (keyword , element .getContainingFile ());
29- debug .complete ();
30- return results ;
27+ // PerformanceCollector debug = new PerformanceCollector((PerformanceEntity) element, "resolve");
28+ // PsiElement results = ResolverUtils.resolveKeywordFromFile(keyword, element.getContainingFile());
29+ // debug.complete();
30+ // return results;
31+ return ResolverUtils .resolveKeywordFromFile (keyword , element .getContainingFile ());
3132 }
3233
3334 @ NotNull
You can’t perform that action at this time.
0 commit comments