OpenLiberty / liberty-tools-intellij

IntelliJ IDEA extension for Liberty
https://plugins.jetbrains.com/plugin/14856-open-liberty-tools
Eclipse Public License 2.0
11 stars 20 forks source link

IntelliJ IDEA 2024.1 support: flexmark dependency is missing; server.xml hover text is not displayed. #721

Closed mrglavas closed 2 months ago

mrglavas commented 2 months ago

After upgrading to IntelliJ IDEA 2024.1, documentation is not displayed when hovering over any of the contents of server.xml. A pop-up is shown to the user that documentation is being fetched, but that never completes.

image

A NoClassDefFoundError is thrown in the background while attempting to produce the documentation. It seems this dependency is missing from the Liberty Tools for IntelliJ plug-in. Perhaps this worked in the past because IntelliJ bundled the flexmark code, but perhaps removed it in 2024.1.

java.lang.NoClassDefFoundError: com/vladsch/flexmark/util/data/DataHolder
    at org.microshed.lsp4ij.features.documentation.LSPDocumentationProvider.generateDoc(LSPDocumentationProvider.java:135)
    at com.intellij.lang.documentation.DocumentationProvider.getDocumentationParts(DocumentationProvider.java:199)
    at com.intellij.lang.documentation.CompositeDocumentationProvider.getDocumentationParts(CompositeDocumentationProvider.java:295)
    at com.intellij.lang.documentation.psi.PsiElementDocumentationTarget.localDocParts(PsiElementDocumentationTarget.kt:115)
    at com.intellij.lang.documentation.psi.PsiElementDocumentationTarget.localDoc(PsiElementDocumentationTarget.kt:98)
    at com.intellij.lang.documentation.psi.PsiElementDocumentationTarget.doComputeDocumentation(PsiElementDocumentationTarget.kt:85)
    at com.intellij.lang.documentation.psi.PsiElementDocumentationTarget.access$doComputeDocumentation(PsiElementDocumentationTarget.kt:29)
    at com.intellij.lang.documentation.psi.PsiElementDocumentationTarget$computeDocumentation$1.invoke(PsiElementDocumentationTarget.kt:79)
    at com.intellij.lang.documentation.psi.PsiElementDocumentationTarget$computeDocumentation$1.invoke(PsiElementDocumentationTarget.kt:78)
    at com.intellij.openapi.progress.CoroutinesKt.jobToIndicator$lambda$2(coroutines.kt:422)
    at com.intellij.openapi.progress.ProgressManager.lambda$runProcess$0(ProgressManager.java:100)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:217)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$13(CoreProgressManager.java:660)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:735)
    at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:691)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:659)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:79)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:202)
    at com.intellij.openapi.progress.ProgressManager.runProcess(ProgressManager.java:100)
    at com.intellij.openapi.progress.CoroutinesKt.jobToIndicator(coroutines.kt:410)
    at com.intellij.openapi.progress.CoroutinesKt.contextToIndicator(coroutines.kt:402)
    at com.intellij.openapi.progress.CoroutinesKt.blockingContextToIndicator(coroutines.kt:381)
    at com.intellij.lang.documentation.psi.PsiElementDocumentationTarget.computeDocumentation(PsiElementDocumentationTarget.kt:78)
    ...
mrglavas commented 2 months ago

I was able to resolve this locally by adding implementation 'com.vladsch.flexmark:flexmark-all:0.64.8' to build.gradle. I have a feeling that this (or some subset of flexmark-all) is a dependency for lsp4j that we somehow excluded as a transitive dependency. We should probably revisit how we're declaring these dependencies to make them easier to manage.

angelozerr commented 2 months ago

In our LSP4IJ we embed flexmark https://github.com/redhat-developer/lsp4ij/blob/07be3fdaf449ac04f3734abf5d28fb89ce6ac510/gradle.properties#L21 but I think we should replace flexmark (in several months) with https://github.com/redhat-developer/lsp4ij/issues/236

mrglavas commented 2 months ago

We seem to be getting flexmark from IntelliJ:

image

MicroShed LSP4iJ dependencies:

compileClasspath - Compile classpath for source set 'main'.
+--- org.eclipse.lsp4j:org.eclipse.lsp4j:0.21.0
|    \--- org.eclipse.lsp4j:org.eclipse.lsp4j.jsonrpc:0.21.0
|         \--- com.google.code.gson:gson:[2.9.1,2.11) -> 2.10.1
+--- org.eclipse.lsp4j:org.eclipse.lsp4j.jsonrpc:0.21.0 (*)
+--- com.google.code.gson:gson:2.8.9 -> 2.10.1
+--- org.jetbrains:annotations:24.0.0
+--- unzipped.com.jetbrains.plugins:java:ideaIC-IC-231.8109.175-withSources
+--- unzipped.com.jetbrains.plugins:gradle-java:ideaIC-IC-231.8109.175-withSources
+--- unzipped.com.jetbrains.plugins:gradle:ideaIC-IC-231.8109.175-withSources
\--- com.jetbrains:ideaIC:2023.1

I guess JetBrains removed flexmark in 2024.1.

mrglavas commented 2 months ago

Resolved by https://github.com/MicroShed/lsp4ij/pull/18.