Refine highlighting of '@'

- Do not highlight '@' as separate token.

- Highlight '@' the same way as element where it's located: annotation, label or modifier.

- Extend text range when positioning unresolved reference in annotation with '@'.

Note that currently '@' is collapsed with modifiers tokens
This commit is contained in:
Denis Zharkov
2015-05-05 15:16:41 +03:00
parent aa7bae213d
commit 1d77f50903
12 changed files with 125 additions and 3 deletions
+24
View File
@@ -0,0 +1,24 @@
<info descr="null">annotation</info> class <info descr="null">Ann</info>
<info descr="null" textAttributesKey="KOTLIN_ANNOTATION">Ann</info> class <info descr="null">A1</info>
<info descr="null" textAttributesKey="KOTLIN_ANNOTATION">@Ann</info> class <info descr="null">A2</info>
fun <info descr="null">bar</info>(<info descr="null">block</info>: () -> <info descr="null">Int</info>) = <info descr="null"><info descr="null">block</info></info>()
<info descr="null" textAttributesKey="KOTLIN_BUILTIN_ANNOTATION">@private</info>
fun <info descr="null">foo</info>() {
1 + [<info descr="null" textAttributesKey="KOTLIN_ANNOTATION">Ann</info>] 2
<info descr="null" textAttributesKey="KOTLIN_ANNOTATION">@Ann</info> 3 + 4
<info descr="null"><info descr="null">bar</info></info> <info descr="null" textAttributesKey="KOTLIN_ANNOTATION">@Ann</info> { 1 }
<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: Err" textAttributesKey="WRONG_REFERENCES_ATTRIBUTES">@Err</error>
<warning descr="[UNUSED_EXPRESSION] The expression is unused" textAttributesKey="WARNING_ATTRIBUTES">5</warning>
}
<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: Err" textAttributesKey="WRONG_REFERENCES_ATTRIBUTES">@Err</error> class <info descr="null" textAttributesKey="KOTLIN_CLASS">Err1</info>
class <info descr="null">NotAnn</info>
<error descr="[NOT_AN_ANNOTATION_CLASS] 'NotAnn' is not an annotation class" textAttributesKey="ERRORS_ATTRIBUTES">@NotAnn</error>
class <info descr="null">C</info>
+17
View File
@@ -0,0 +1,17 @@
fun <info descr="null">bar</info>(<info descr="null">block</info>: () -> <info descr="null">Int</info>) = <info descr="null"><info descr="null">block</info></info>()
fun <info descr="null">foo</info>(): <info descr="null">Int</info> {
<info descr="null"><info descr="null">bar</info></info> <info descr="null" textAttributesKey="KOTLIN_LABEL">label@</info> {
return<info descr="null" textAttributesKey="KOTLIN_LABEL">@label</info> 2
}
<info descr="null" textAttributesKey="KOTLIN_LABEL">loop@</info> for (<info descr="null">i</info> in 1..100) {
break<info descr="null" textAttributesKey="KOTLIN_LABEL">@loop</info>
}
<info descr="null" textAttributesKey="KOTLIN_LABEL">loop2@</info> for (<info descr="null">i</info> in 1..100) {
break<error descr="There should be no space or comments before '@' in label reference"> </error><info descr="null" textAttributesKey="KOTLIN_LABEL">@loop2</info>
}
return 1
}