mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[groovy] allow 'trait' as package name (IDEA-127422)
This commit is contained in:
+3
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -99,8 +99,8 @@ public class GrKeywordAndDeclarationHighlighter extends TextEditorHighlightingPa
|
||||
if (parent instanceof GrArgumentLabel) return false; //don't highlight: print (void:'foo')
|
||||
|
||||
if (PsiTreeUtil.getParentOfType(element, GrCodeReferenceElement.class) != null) {
|
||||
if (token == GroovyTokenTypes.kDEF || token == GroovyTokenTypes.kIN || token == GroovyTokenTypes.kAS) {
|
||||
return false; //It is allowed to name packages 'as', 'in' or 'def'
|
||||
if (TokenSets.CODE_REFERENCE_ELEMENT_NAME_TOKENS.contains(token)) {
|
||||
return false; //It is allowed to name packages 'as', 'in', 'def' or 'trait'
|
||||
}
|
||||
}
|
||||
else if (token == GroovyTokenTypes.kDEF && element.getParent() instanceof GrAnnotationNameValuePair) {
|
||||
|
||||
+2
-1
@@ -280,7 +280,8 @@ public abstract class TokenSets {
|
||||
GroovyElementTypes.COMPOSITE_RSHIFT_SIGN,
|
||||
GroovyElementTypes.COMPOSITE_TRIPLE_SHIFT_SIGN);
|
||||
public static final TokenSet CODE_REFERENCE_ELEMENT_NAME_TOKENS = TokenSet.create(GroovyTokenTypes.mIDENT, GroovyTokenTypes.kDEF,
|
||||
GroovyTokenTypes.kIN, GroovyTokenTypes.kAS);
|
||||
GroovyTokenTypes.kIN, GroovyTokenTypes.kAS,
|
||||
GroovyTokenTypes.kTRAIT);
|
||||
|
||||
public static final TokenSet BLOCK_SET = TokenSet.create(GroovyElementTypes.CLOSABLE_BLOCK, GroovyElementTypes.BLOCK_STATEMENT,
|
||||
GroovyElementTypes.CONSTRUCTOR_BODY, GroovyElementTypes.OPEN_BLOCK,
|
||||
|
||||
+10
@@ -2011,4 +2011,14 @@ def foo = new <error descr="Cannot resolve symbol 'Rrrrrrrr'">Rrrrrrrr</error>()
|
||||
void testLocalVariableModifiers() { doTest() }
|
||||
|
||||
void testFieldModifiers() { doTest() }
|
||||
|
||||
void "test allow and do not highlight 'trait', 'as', 'def', 'in' within package"() {
|
||||
myFixture.addClass '''\
|
||||
package a.b.c.trait.d.as.e.def.f.in.g;
|
||||
public class Foo {}
|
||||
'''
|
||||
testHighlighting '''\
|
||||
<info>import</info> a.b.c.trait.d.as.e.def.f.in.g.*
|
||||
''', false, true
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user