Skip to content

Commit

Permalink
fix: don't depend on the java extension
Browse files Browse the repository at this point in the history
Signed-off-by: Fred Bricon <fbricon@gmail.com>
  • Loading branch information
fbricon authored and angelozerr committed Jan 10, 2024
1 parent 7d9c260 commit a846eeb
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 36 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ platformType=IC
platformVersion=2022.2.3
# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
# Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22
platformPlugins=com.intellij.java, com.redhat.devtools.intellij.telemetry:1.0.0.44
platformPlugins=com.redhat.devtools.intellij.telemetry:1.1.0.52
# Gradle Releases -> https://github.com/gradle/gradle/releases
gradleVersion=8.4
channel=nightly
Expand Down
32 changes: 0 additions & 32 deletions src/main/java/com/redhat/devtools/lsp4ij/LSPIJUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,8 @@
import com.intellij.openapi.roots.ProjectRootManager;
import com.intellij.openapi.util.TextRange;
import com.intellij.openapi.vfs.*;
import com.intellij.psi.PsiDocumentManager;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.psi.impl.light.LightRecordField;
import com.redhat.devtools.lsp4ij.internal.StringUtils;
import org.apache.commons.io.FileUtils;
import org.eclipse.lsp4j.*;
Expand Down Expand Up @@ -289,36 +287,6 @@ public static Range toRange(TextRange range, Document document) {
}
}

public static Location toLocation(PsiElement psiMember) {
PsiElement sourceElement = getNavigationElement(psiMember);

if (sourceElement != null) {
PsiFile file = sourceElement.getContainingFile();
Document document = PsiDocumentManager.getInstance(psiMember.getProject()).getDocument(file);
if (document != null) {
TextRange range = sourceElement.getTextRange();
return toLocation(file, toRange(range, document));
}
}
return null;
}

private static @Nullable PsiElement getNavigationElement(PsiElement psiMember) {
//FIXME LightRecordField depends on the com.intellij.java plugin
if (psiMember instanceof LightRecordField) {
psiMember = ((LightRecordField) psiMember).getRecordComponent();
}
return psiMember.getNavigationElement();
}

public static Location toLocation(PsiFile file, Range range) {
return toLocation(file.getVirtualFile(), range);
}

public static Location toLocation(VirtualFile file, Range range) {
return new Location(toUriAsString(file), range);
}

public static void applyWorkspaceEdit(WorkspaceEdit edit) {
applyWorkspaceEdit(edit, null);
}
Expand Down
3 changes: 0 additions & 3 deletions src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,8 @@
</description>

<depends>com.intellij.modules.platform</depends>
<!-- FIXME we shouldn't have a dependency to Java, this is caused by using 'LightRecordField' (e.g. in LSPIJUtils.getNavigationElement(PsiElement)) -->
<depends>com.intellij.modules.java</depends>
<depends>com.redhat.devtools.intellij.telemetry</depends>


<!-- please see http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/build_number_ranges.html for description -->
<idea-version since-build="223"/>

Expand Down

0 comments on commit a846eeb

Please sign in to comment.