File tree Expand file tree Collapse file tree 1 file changed +9
-14
lines changed
src/main/kotlin/cc/unitmesh/devti/context Expand file tree Collapse file tree 1 file changed +9
-14
lines changed Original file line number Diff line number Diff line change 1
1
package cc.unitmesh.devti.context
2
2
3
3
import cc.unitmesh.devti.context.base.NamedElementContext
4
- import com.google.gson.Gson
5
4
import com.intellij.openapi.application.runReadAction
6
5
import com.intellij.psi.PsiElement
7
6
import com.intellij.psi.PsiReference
@@ -18,20 +17,16 @@ class VariableContext(
18
17
) : NamedElementContext(
19
18
root, text, name
20
19
) {
21
- private val methodContext: MethodContext ?
22
- private val classContext: ClassContext ?
20
+ private val methodContext: MethodContext ? = if (includeMethodContext && enclosingMethod != null ) {
21
+ MethodContextProvider (false , false ).from(enclosingMethod)
22
+ } else {
23
+ null
24
+ }
23
25
24
- init {
25
- methodContext = if (includeMethodContext && enclosingMethod != null ) {
26
- MethodContextProvider (false , false ).from(enclosingMethod)
27
- } else {
28
- null
29
- }
30
- classContext = if (includeClassContext && enclosingClass != null ) {
31
- ClassContextProvider (false ).from(enclosingClass)
32
- } else {
33
- null
34
- }
26
+ private val classContext: ClassContext ? = if (includeClassContext && enclosingClass != null ) {
27
+ ClassContextProvider (false ).from(enclosingClass)
28
+ } else {
29
+ null
35
30
}
36
31
37
32
fun shortFormat (): String = runReadAction { root.text ? : " " }
You can’t perform that action at this time.
0 commit comments