Skip to content

Commit 1b864fa

Browse files
Added support for wrong methodCodeObjectId
1 parent 4df4049 commit 1b864fa

File tree

4 files changed

+55
-20
lines changed

4 files changed

+55
-20
lines changed

CHANGELOG.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
# Changelog
22
All notable changes to this project will be documented in this file.
33

4+
## [2.0.37] - 2023-03-08
5+
### Changed
6+
- Added support for wrong methodCodeObjectId
7+
8+
## [2.0.36] - 2023-03-07
9+
### Changed
10+
- Add support for test files
11+
412
## [2.0.35] - 2023-03-01
513
### Changed
614
- Applied new UI theme styles for Jetbrains
@@ -30,4 +38,6 @@ All notable changes to this project will be documented in this file.
3038
[2.0.33]: https://github.com/digma-ai/digma-intellij-plugin/compare/v2.0.32...v2.0.33
3139
[2.0.34]: https://github.com/digma-ai/digma-intellij-plugin/compare/v2.0.33...v2.0.34
3240
[2.0.35]: https://github.com/digma-ai/digma-intellij-plugin/compare/v2.0.34...v2.0.35
33-
[Unreleased]: https://github.com/digma-ai/digma-intellij-plugin/compare/v2.0.35...HEAD
41+
[2.0.36]: https://github.com/digma-ai/digma-intellij-plugin/compare/v2.0.35...v2.0.36
42+
[2.0.37]: https://github.com/digma-ai/digma-intellij-plugin/compare/v2.0.36...v2.0.37
43+
[Unreleased]: https://github.com/digma-ai/digma-intellij-plugin/compare/v2.0.37...HEAD

build.gradle.kts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import common.properties
2+
import org.jetbrains.changelog.date
23
import org.jetbrains.changelog.markdownToHTML
34
import org.jetbrains.intellij.tasks.ListProductsReleasesTask
45
import org.jetbrains.changelog.exceptions.MissingVersionException
@@ -44,6 +45,15 @@ intellij {
4445
}
4546
}
4647

48+
// Configure Gradle Changelog Plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin
49+
changelog {
50+
version.set(project.semanticVersion.version.get().toString())
51+
path.set("${project.projectDir}/CHANGELOG.md")
52+
groups.set(listOf("Added", "Changed", "Deprecated", "Removed", "Fixed", "Security"))
53+
// groups.set(emptyList())
54+
header.set(provider { "[${version.get()}] - ${date()}" })
55+
keepUnreleasedSection.set(false)
56+
}
4757

4858
// Configure Gradle Qodana Plugin - read more: https://github.com/JetBrains/gradle-qodana-plugin
4959
qodana {

java/src/main/java/org/digma/intellij/plugin/idea/psi/java/JavaLanguageService.java

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -259,24 +259,26 @@ public Map<String, Pair<String, Integer>> findWorkspaceUrisForMethodCodeObjectId
259259

260260
methodCodeObjectIds.forEach(id -> {
261261

262-
var className = id.substring(0, id.indexOf("$_$"));
263-
264-
//the code object id for inner classes separates inner classes name with $, but intellij index them with a dot
265-
className = className.replace('$', '.');
266-
267-
//searching in project scope will find only project classes
268-
Collection<PsiClass> psiClasses =
269-
JavaFullClassNameIndex.getInstance().get(className, project, GlobalSearchScope.projectScope(project));
270-
if (!psiClasses.isEmpty()) {
271-
//hopefully there is only one class by that name in the project
272-
PsiClass psiClass = psiClasses.stream().findAny().get();
273-
PsiFile psiFile = PsiTreeUtil.getParentOfType(psiClass, PsiFile.class);
274-
for (PsiMethod method : psiClass.getMethods()) {
275-
String javaMethodCodeObjectId = createJavaMethodCodeObjectId(method);
276-
if (javaMethodCodeObjectId.equals(id)) {
277-
if (psiFile != null) {
278-
String url = PsiUtils.psiFileToUri(psiFile);
279-
workspaceUrls.put(id, new Pair<>(url, method.getTextOffset()));
262+
if (id.contains("$_$")) {
263+
var className = id.substring(0, id.indexOf("$_$"));
264+
265+
//the code object id for inner classes separates inner classes name with $, but intellij index them with a dot
266+
className = className.replace('$', '.');
267+
268+
//searching in project scope will find only project classes
269+
Collection<PsiClass> psiClasses =
270+
JavaFullClassNameIndex.getInstance().get(className, project, GlobalSearchScope.projectScope(project));
271+
if (!psiClasses.isEmpty()) {
272+
//hopefully there is only one class by that name in the project
273+
PsiClass psiClass = psiClasses.stream().findAny().get();
274+
PsiFile psiFile = PsiTreeUtil.getParentOfType(psiClass, PsiFile.class);
275+
for (PsiMethod method : psiClass.getMethods()) {
276+
String javaMethodCodeObjectId = createJavaMethodCodeObjectId(method);
277+
if (javaMethodCodeObjectId.equals(id)) {
278+
if (psiFile != null) {
279+
String url = PsiUtils.psiFileToUri(psiFile);
280+
workspaceUrls.put(id, new Pair<>(url, method.getTextOffset()));
281+
}
280282
}
281283
}
282284
}

src/main/resources/META-INF/plugin.xml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,20 @@
11
<!-- Plugin Configuration File. Read more: https://plugins.jetbrains.com/docs/intellij/plugin-configuration-file.html -->
22
<idea-plugin require-restart="true">
33

4-
<change-notes/>
4+
<change-notes>
5+
<![CDATA[
6+
# Changelog
7+
8+
## [2.0.37] - 2023-03-08
9+
### Changed
10+
- Added support for wrong methodCodeObjectId
11+
12+
## [2.0.36] - 2023-03-07
13+
### Changed
14+
- Add support for test files
15+
16+
]]>
17+
</change-notes>
518
<id>org.digma.intellij</id>
619
<version>${project.version}</version>
720
<name>Digma Continuous Feedback</name>

0 commit comments

Comments
 (0)