lsp4intellij icon indicating copy to clipboard operation
lsp4intellij copied to clipboard

Add support for Intellij 2020.1

Open gayanper opened this issue 4 years ago • 13 comments

I tried testing my STS4 plugin with 2020.1 seems like even though the language server process is started, the messages are not sent to the language server. The language server icon stays yellow forever.

Since this is the upcoming release of IntelliJ we might need to look at what going on soon and apply a fix for it.

gayanper avatar Mar 26 '20 07:03 gayanper

Yeah we should check on that. One possible reason might be registering the client as an application component (application components are not recommended in the dynamic plugin concept which will be available with the 2020.1 release). Thanks for bringing this up.

NipunaRanasinghe avatar Apr 02 '20 07:04 NipunaRanasinghe

I checked the code and it seems it was a issue in the plugin that i have been working on. But it seems that there are some generic type changes in latest IDEA platform which causes compilation errors. But i think that won't be a issue until we try to compile the plugin against 2020.1. Shall we close this issue @NipunaRanasinghe ?

gayanper avatar Apr 12 '20 12:04 gayanper

@gayanper Yeah when I tried to compile against IDEA 2020.1, compilation was failed due to few deprecated icons and type changes in LSPSymbolContributor, but the library seems to be running fine so far. Anyway we better keep this opened until we fix the above compilation issues, IMO.

NipunaRanasinghe avatar Apr 14 '20 06:04 NipunaRanasinghe

@NipunaRanasinghe following issues stops me from submitting my spring plugin into marketplace

Compatibility problems (1): 
    #Access to unresolved field com.intellij.icons.AllIcons.Nodes.DataSource : Icon
        Method org.wso2.lsp4intellij.contributors.icon.LSPDefaultIconProvider.getCompletionIcon(org.eclipse.lsp4j.CompletionItemKind kind) : javax.swing.Icon contains a *getstatic* instruction referencing an unresolved field com.intellij.icons.AllIcons.Nodes.DataSource : javax.swing.Icon. This can lead to **NoSuchFieldError** exception at runtime.
Deprecated API usages (23): 
    #Deprecated method com.intellij.openapi.components.BaseComponent.initComponent() is overridden
        Deprecated method com.intellij.openapi.components.BaseComponent.initComponent() : void is overridden in class org.wso2.lsp4intellij.IntellijLanguageClient
    #Deprecated method com.intellij.openapi.wm.StatusBarWidget.getPresentation(StatusBarWidget.PlatformType) is overridden
        Deprecated method com.intellij.openapi.wm.StatusBarWidget.getPresentation(com.intellij.openapi.wm.StatusBarWidget.PlatformType type) : com.intellij.openapi.wm.StatusBarWidget.WidgetPresentation is overridden in class org.wso2.lsp4intellij.client.languageserver.LSPServerStatusWidget. This method will be removed in 2020.2
    #Deprecated method com.intellij.refactoring.rename.RenamePsiElementProcessor.findReferences(PsiElement) is overridden
        Deprecated method com.intellij.refactoring.rename.RenamePsiElementProcessor.findReferences(com.intellij.psi.PsiElement element) : java.util.Collection is overridden in class org.wso2.lsp4intellij.contributors.rename.LSPRenameProcessor
    #Deprecated method com.intellij.openapi.vfs.VirtualFileManager.addVirtualFileListener(VirtualFileListener) invocation
        Deprecated method com.intellij.openapi.vfs.VirtualFileManager.addVirtualFileListener(com.intellij.openapi.vfs.VirtualFileListener arg0) : void is invoked in org.wso2.lsp4intellij.IntellijLanguageClient.initComponent() : void
    #Deprecated method com.intellij.openapi.wm.StatusBar.addWidget(StatusBarWidget, String) invocation
        Deprecated method com.intellij.openapi.wm.StatusBar.addWidget(com.intellij.openapi.wm.StatusBarWidget arg0, java.lang.String arg1) : void is invoked in org.wso2.lsp4intellij.client.languageserver.LSPServerStatusWidget.createWidgetFor(LanguageServerWrapper) : LSPServerStatusWidget. This method will be removed in  a future release
    #Deprecated enum com.intellij.openapi.wm.StatusBarWidget.PlatformType reference
        Deprecated enum com.intellij.openapi.wm.StatusBarWidget.PlatformType is referenced in org.wso2.lsp4intellij.client.languageserver.LSPServerStatusWidget.getPresentation(StatusBarWidget.PlatformType) : StatusBarWidget.WidgetPresentation. This enum will be removed in 2020.2
        Deprecated enum com.intellij.openapi.wm.StatusBarWidget.PlatformType is referenced in org.wso2.lsp4intellij.client.languageserver.LSPServerStatusWidget.getPresentation(StatusBarWidget.PlatformType) : StatusBarWidget.IconPresentation. This enum will be removed in 2020.2
    #Deprecated method com.intellij.openapi.components.BaseComponent.disposeComponent() is overridden
        Deprecated method com.intellij.openapi.components.BaseComponent.disposeComponent() : void is overridden in class org.wso2.lsp4intellij.IntellijLanguageClient
    #Deprecated method com.intellij.refactoring.rename.RenamePsiElementProcessor.findReferences(PsiElement, boolean) is overridden
        Deprecated method com.intellij.refactoring.rename.RenamePsiElementProcessor.findReferences(com.intellij.psi.PsiElement element, boolean searchInCommentsAndStrings) : java.util.Collection is overridden in class org.wso2.lsp4intellij.contributors.rename.LSPRenameProcessor
    #Deprecated method com.intellij.navigation.ChooseByNameContributorEx.getItemsByName(String, String, Project, boolean) is overridden
        Deprecated method com.intellij.navigation.ChooseByNameContributorEx.getItemsByName(java.lang.String name, java.lang.String pattern, com.intellij.openapi.project.Project project, boolean includeNonProjectItems) : com.intellij.navigation.NavigationItem[] is overridden in class org.wso2.lsp4intellij.contributors.symbol.LSPSymbolContributor
    #Deprecated method com.intellij.lang.annotation.AnnotationHolder.createWarningAnnotation(TextRange, String) invocation
        Deprecated method com.intellij.lang.annotation.AnnotationHolder.createWarningAnnotation(com.intellij.openapi.util.TextRange arg0, java.lang.String arg1) : com.intellij.lang.annotation.Annotation is invoked in org.wso2.lsp4intellij.contributors.annotator.LSPAnnotator.lambda$createAnnotations$2(Editor, AnnotationHolder, List, Diagnostic) : void
    #Deprecated method com.intellij.openapi.editor.ex.EditorSettingsExternalizable.getQuickDocOnMouseOverElementDelayMillis() invocation
        Deprecated method com.intellij.openapi.editor.ex.EditorSettingsExternalizable.getQuickDocOnMouseOverElementDelayMillis() : int is invoked in org.wso2.lsp4intellij.editor.EditorEventManagerBase.<clinit>() : void
    #Deprecated method com.intellij.lang.annotation.AnnotationHolder.createAnnotation(HighlightSeverity, TextRange, String) invocation
        Deprecated method com.intellij.lang.annotation.AnnotationHolder.createAnnotation(com.intellij.lang.annotation.HighlightSeverity arg0, com.intellij.openapi.util.TextRange arg1, java.lang.String arg2) : com.intellij.lang.annotation.Annotation is invoked in org.wso2.lsp4intellij.contributors.annotator.LSPAnnotator.lambda$updateAnnotations$1(AnnotationHolder, Annotation) : void
    #Deprecated method com.intellij.codeInsight.completion.CompletionContributor.invokeAutoPopup(PsiElement, char) is overridden
        Deprecated method com.intellij.codeInsight.completion.CompletionContributor.invokeAutoPopup(com.intellij.psi.PsiElement position, char typeChar) : boolean is overridden in class org.wso2.lsp4intellij.contributors.LSPCompletionContributor
    #Deprecated interface com.intellij.openapi.components.ApplicationComponent reference
        Deprecated interface com.intellij.openapi.components.ApplicationComponent is referenced in org.wso2.lsp4intellij.IntellijLanguageClient
    #Deprecated method com.intellij.lang.annotation.AnnotationHolder.createInfoAnnotation(TextRange, String) invocation
        Deprecated method com.intellij.lang.annotation.AnnotationHolder.createInfoAnnotation(com.intellij.openapi.util.TextRange arg0, java.lang.String arg1) : com.intellij.lang.annotation.Annotation is invoked in org.wso2.lsp4intellij.contributors.annotator.LSPAnnotator.lambda$createAnnotations$2(Editor, AnnotationHolder, List, Diagnostic) : void
        Deprecated method com.intellij.lang.annotation.AnnotationHolder.createInfoAnnotation(com.intellij.openapi.util.TextRange arg0, java.lang.String arg1) : com.intellij.lang.annotation.Annotation is invoked in org.wso2.lsp4intellij.editor.EditorEventManager.lambda$requestAndShowCodeActions$44(int, Either) : void
    #Deprecated method com.intellij.psi.PsiElement.checkAdd(PsiElement) is overridden
        Deprecated method com.intellij.psi.PsiElement.checkAdd(com.intellij.psi.PsiElement arg0) : void is overridden in class org.wso2.lsp4intellij.contributors.psi.LSPPsiElement
    #Deprecated class com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil reference
        Deprecated class com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil is referenced in org.wso2.lsp4intellij.contributors.rename.LSPRenameHandler.doRename(PsiElement, Editor) : InplaceRefactoring
    #Deprecated method com.intellij.lang.annotation.AnnotationHolder.createErrorAnnotation(TextRange, String) invocation
        Deprecated method com.intellij.lang.annotation.AnnotationHolder.createErrorAnnotation(com.intellij.openapi.util.TextRange arg0, java.lang.String arg1) : com.intellij.lang.annotation.Annotation is invoked in org.wso2.lsp4intellij.contributors.annotator.LSPAnnotator.lambda$createAnnotations$2(Editor, AnnotationHolder, List, Diagnostic) : void
    #Deprecated method com.intellij.lang.annotation.AnnotationHolder.createWeakWarningAnnotation(TextRange, String) invocation
        Deprecated method com.intellij.lang.annotation.AnnotationHolder.createWeakWarningAnnotation(com.intellij.openapi.util.TextRange arg0, java.lang.String arg1) : com.intellij.lang.annotation.Annotation is invoked in org.wso2.lsp4intellij.contributors.annotator.LSPAnnotator.lambda$createAnnotations$2(Editor, AnnotationHolder, List, Diagnostic) : void
    #Deprecated method com.intellij.navigation.ChooseByNameContributorEx.getNames(Project, boolean) is overridden
        Deprecated method com.intellij.navigation.ChooseByNameContributorEx.getNames(com.intellij.openapi.project.Project project, boolean includeNonProjectItems) : java.lang.String[] is overridden in class org.wso2.lsp4intellij.contributors.symbol.LSPSymbolContributor
    #Deprecated method com.intellij.psi.PsiElement.checkDelete() is overridden
        Deprecated method com.intellij.psi.PsiElement.checkDelete() : void is overridden in class org.wso2.lsp4intellij.contributors.psi.LSPPsiElement
Experimental API usages (2): 
    #Experimental API method com.intellij.model.psi.PsiSymbolReference.getElement() is overridden
        Experimental API method com.intellij.model.psi.PsiSymbolReference.getElement() : com.intellij.psi.PsiElement is overridden in class org.wso2.lsp4intellij.contributors.psi.LSPPsiReference. This method can be changed in a future release leading to incompatibilities
    #Experimental API method com.intellij.model.psi.PsiSymbolReference.getRangeInElement() is overridden
        Experimental API method com.intellij.model.psi.PsiSymbolReference.getRangeInElement() : com.intellij.openapi.util.TextRange is overridden in class org.wso2.lsp4intellij.contributors.psi.LSPPsiReference. This method can be changed in a future release leading to incompatibilities
Internal API usages (1): 
    #Internal method com.intellij.openapi.wm.StatusBar.removeWidget(String) invocation
        Internal method com.intellij.openapi.wm.StatusBar.removeWidget(java.lang.String arg0) : void is invoked in org.wso2.lsp4intellij.client.languageserver.LSPServerStatusWidget.lambda$dispose$0(StatusBar) : void. This method is marked with @org.jetbrains.annotations.ApiStatus.Internal annotation and indicates that the method is not supposed to be used in client code.
    Plugin cannot be loaded/unloaded without IDE restart: Plugin cannot be loaded/unloaded without IDE restart because it declares application components: `org.wso2.lsp4intellij.IntellijLanguageClient`

This is the output from intellij plugin verifier.

Verified against : IC-201.6668.121

gayanper avatar May 18 '20 20:05 gayanper

I believe my PR #188 (which has been merged to master) should take care of this issue. I am currently in the process of experimenting with it in my own plugin to see if I can get it working. For those already using this library, you could confirm if the latest master fixes compatibility.

carymrobbins avatar May 22 '20 16:05 carymrobbins

@carymrobbins yes those were the same change I did locally to get it compiled. I do see we have switched to build against 2020.1, this might introduce problems with lower versions if we start using new APIs. @NipunaRanasinghe WDYT ?, if we want to be safe I suggest we run the intellij plugin verifier as part of the builds.

gayanper avatar May 22 '20 18:05 gayanper

@carymrobbins yes those were the same change I did locally to get it compiled. I do see we have switched to build against 2020.1, this might introduce problems with lower versions if we start using new APIs. @NipunaRanasinghe WDYT ?, if we want to be safe I suggest we run the intellij plugin verifier as part of the builds.

we've been keeping the minimum compatible version in order to make sure that all our changes + compatibility fixes are doesn't affect the oldest version of the compatible range (and if not, we have to bump the minimum compatible version). But on the other hand, we also have to validate against the latest stable version as well. So I'm okay with either approach until we figure out a way validate the build against multiple IDEA versions.

@gayanper AFAIK currently intellij plugin verifier can be used only when publishing a plugin build to jetbrains plugin repository. Is there anyway we can add that as a task to our build script or something like that?

NipunaRanasinghe avatar May 23 '20 08:05 NipunaRanasinghe

The build version in the gradle file will make sure we use 2020.1 for compiling our library. So I think we need the plugin verifier to make sure we are compatible with 2017.3 for example as well.

The plugin verifier can be used locally. See the script https://github.com/izhangzhihao/intellij-rainbow-brackets/blob/2020.1/verifier.gradle and usage https://github.com/izhangzhihao/intellij-rainbow-brackets/blob/2020.1/build.gradle

But we will need to add a plugin.xml with the plugin id, since and until versions and create a plugin zip file for this to work. I suggest we do it as a separate step in the build pipeline. WDYT ?

gayanper avatar May 23 '20 08:05 gayanper

You could also make an "example" plugin as a subproject and run the verifier on that.

carymrobbins avatar May 23 '20 16:05 carymrobbins

You could also make an "example" plugin as a subproject and run the verifier on that.

Yes this would make things easy, maybe we could couple it with a simple LSP server and run some automated integration tests in the long run.

gayanper avatar May 23 '20 17:05 gayanper

You could also make an "example" plugin as a subproject and run the verifier on that.

I also think that this is a good suggestion and the easiest way to run the version verifier. Lets do this.

NipunaRanasinghe avatar May 29 '20 13:05 NipunaRanasinghe

Is this issue actually closed? since there is a merge?

Neppord avatar Jan 31 '21 10:01 Neppord

It's working for me on 2020.3. I think the issue has been resolved.

Trias avatar Feb 16 '21 17:02 Trias