Skip to content

Commit f4cec7d

Browse files
committed
check valid virtual file
1 parent fc9f5f8 commit f4cec7d

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

jvm-common/src/main/kotlin/org/digma/intellij/plugin/idea/AbstractJvmLanguageService.kt

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ abstract class AbstractJvmLanguageService(protected val project: Project, protec
8080
*/
8181
override suspend fun buildDocumentInfo(virtualFile: VirtualFile): DocumentInfo? {
8282

83+
Log.trace(logger, project, "buildDocumentInfo called {}", virtualFile)
8384
/*
8485
Important notice:
8586
building document info may be a long operation for large files.
@@ -235,6 +236,9 @@ abstract class AbstractJvmLanguageService(protected val project: Project, protec
235236

236237

237238
override suspend fun detectMethodUnderCaret(virtualFile: VirtualFile, editor: Editor, caretOffset: Int): MethodUnderCaret {
239+
240+
Log.trace(logger, project, "detectMethodUnderCaret called {}", virtualFile)
241+
238242
if (isSupportedFile(virtualFile).not()) {
239243
return MethodUnderCaret.Companion.empty(virtualFile.url)
240244
}
@@ -299,7 +303,7 @@ abstract class AbstractJvmLanguageService(protected val project: Project, protec
299303

300304
override suspend fun navigateToMethod(methodId: String) {
301305

302-
Log.trace(logger, project, "got navigate to method request {}", methodId)
306+
Log.trace(logger, project, "navigateToMethod called {}", methodId)
303307

304308
if (methodId.indexOf("\$_$") <= 0) {
305309
Log.trace(logger, project, "method id in navigateToMethod does not contain \$_$, can not navigate {}", methodId)
@@ -333,10 +337,10 @@ abstract class AbstractJvmLanguageService(protected val project: Project, protec
333337

334338
override suspend fun findMethodPsiElementByMethodId(methodId: String): PsiElement? {
335339

336-
Log.trace(logger, project, "got getPsiElementForMethod request {}", methodId)
340+
Log.trace(logger, project, "findMethodPsiElementByMethodId called {}", methodId)
337341

338342
if (methodId.indexOf("\$_$") <= 0) {
339-
Log.trace(logger, project, "method id in getPsiElementForMethod does not contain \$_$, can not find psi element {}", methodId)
343+
Log.trace(logger, project, "method id in findMethodPsiElementByMethodId does not contain \$_$, can not find psi element {}", methodId)
340344
return null
341345
}
342346

@@ -355,7 +359,7 @@ abstract class AbstractJvmLanguageService(protected val project: Project, protec
355359

356360
override suspend fun findClassPsiElementByMethodId(methodId: String): PsiElement? {
357361

358-
Log.trace(logger, project, "got getClassPsiElementByMethodId request {}", methodId)
362+
Log.trace(logger, project, "findClassPsiElementByMethodId called {}", methodId)
359363

360364
if (methodId.indexOf("\$_$") <= 0) {
361365
Log.trace(logger, project, "method id in getClassPsiElementByMethodId does not contain \$_$, can not navigate {}", methodId)
@@ -369,7 +373,7 @@ abstract class AbstractJvmLanguageService(protected val project: Project, protec
369373

370374
override suspend fun findClassPsiElementByClassName(className: String): PsiElement? {
371375

372-
Log.trace(logger, project, "got getClassPsiElementByClassName request {}", className)
376+
Log.trace(logger, project, "findClassPsiElementByClassName called {}", className)
373377

374378
//the code object id for inner classes separates inner classes name with $, but intellij index them with a dot
375379
val classNameToFind = className.replace('$', '.')

0 commit comments

Comments
 (0)