Skip to content

Conversation

@angelozerr
Copy link
Contributor

fix: Remove LSP4J libraries.

@angelozerr
Copy link
Contributor Author

After testing this PR, it doesn't work -(

LSP4J libraries ar eused for compliation but when you execute LSP request it doesn't work because lsp'J libraries seems not accessible. It is a real nightmare!

@fbricon
Copy link
Contributor

fbricon commented Nov 27, 2025

you probably need to add a reference to

<idea-plugin>
  <!-- ... -->
  <depends>com.intellij.modules.lsp</depends>
</idea-plugin>

see https://plugins.jetbrains.com/docs/intellij/language-server-protocol.html#g8razd_49

@angelozerr angelozerr force-pushed the remove_lsp4j_lib branch 2 times, most recently from d226413 to a8a7201 Compare November 28, 2025 13:53
@angelozerr
Copy link
Contributor Author

you probably need to add a reference to

<idea-plugin>
  <!-- ... -->
  <depends>com.intellij.modules.lsp</depends>
</idea-plugin>

see https://plugins.jetbrains.com/docs/intellij/language-server-protocol.html#g8razd_49

Thanks @fbricon for your feedback. After spending a lot of time, I discover the problem. It is because of telemetry which provides Gson. We should use Gson from plateform otherwise LSP4J fails. I have removed telemetry and it seems it is working pretty well!

@InSyncWithFoo please test this PR

To test this PR you will need to install build zip, see https://github.com/redhat-developer/lsp4ij?tab=readme-ov-file#testing-the-ci-builds

@angelozerr
Copy link
Contributor Author

@sbouchet @adietish have you some idea how to exclude Gson from telemetry?

@InSyncWithFoo
Copy link
Contributor

InSyncWithFoo commented Nov 30, 2025

I tried out the build. It seems to work fine, though there's this error:

Stacktrace
java.lang.NullPointerException: Cannot invoke "org.eclipse.lsp4j.jsonrpc.messages.Either.isRight()" because "saveOptions" is null
	at com.redhat.devtools.lsp4ij.LanguageServerWrapper.isSaveSupported(LanguageServerWrapper.java:731)
	at com.redhat.devtools.lsp4ij.features.files.AbstractLSPFileListener.getSupportedEvents(AbstractLSPFileListener.java:111)
	at com.redhat.devtools.lsp4ij.features.files.AbstractLSPFileListener.prepareChange(AbstractLSPFileListener.java:80)
	at com.intellij.openapi.vfs.newvfs.AsyncEventSupport.lambda$collectAppliers$0(AsyncEventSupport.java:132)
	at com.intellij.openapi.application.impl.AppImplKt$runnableUnitFunction$1.invoke(appImpl.kt:124)
	at com.intellij.openapi.application.impl.AppImplKt$runnableUnitFunction$1.invoke(appImpl.kt:124)
	at com.intellij.platform.locking.impl.NestedLocksThreadingSupport.runReadAction(NestedLocksThreadingSupport.kt:856)
	at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:1059)
	at com.intellij.openapi.vfs.newvfs.AsyncEventSupport.collectAppliers(AsyncEventSupport.java:132)
	at com.intellij.openapi.vfs.newvfs.AsyncEventSupport.runAsyncListeners(AsyncEventSupport.java:98)
	at com.intellij.openapi.vfs.newvfs.RefreshQueueImpl$Companion.runAsyncListeners(RefreshQueueImpl.kt:355)
	at com.intellij.openapi.vfs.newvfs.RefreshQueueImpl$Companion.access$runAsyncListeners(RefreshQueueImpl.kt:328)
	at com.intellij.openapi.vfs.newvfs.RefreshQueueImpl.collectChangeAppliersInReadAction(RefreshQueueImpl.kt:219)
	at com.intellij.openapi.vfs.newvfs.RefreshQueueImpl.processEventsSuspending$lambda$0(RefreshQueueImpl.kt:184)
	at com.intellij.openapi.application.rw.PlatformReadWriteActionSupport.executeReadAndWriteAction$lambda$0(PlatformReadWriteActionSupport.kt:83)
	at com.intellij.openapi.application.rw.InternalReadAction.insideReadAction(InternalReadAction.kt:111)
	at com.intellij.openapi.application.rw.InternalReadAction.tryReadCancellable$lambda$0(InternalReadAction.kt:101)
	at com.intellij.openapi.application.rw.CancellableReadActionKt.cancellableReadActionInternal$lambda$0$0$0(cancellableReadAction.kt:32)
	at com.intellij.platform.locking.impl.NestedLocksThreadingSupport.tryRunReadAction(NestedLocksThreadingSupport.kt:902)
	at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1237)
	at com.intellij.openapi.application.rw.CancellableReadActionKt.cancellableReadActionInternal$lambda$0$0(cancellableReadAction.kt:30)
	at com.intellij.openapi.progress.util.ProgressIndicatorUtilService.runActionAndCancelBeforeWrite(ProgressIndicatorUtilService.java:73)
	at com.intellij.openapi.progress.util.ProgressIndicatorUtils.runActionAndCancelBeforeWrite(ProgressIndicatorUtils.java:152)
	at com.intellij.openapi.application.rw.CancellableReadActionKt.cancellableReadActionInternal$lambda$0(cancellableReadAction.kt:28)
	at com.intellij.concurrency.ThreadContext.installThreadContext(threadContext.kt:305)
	at com.intellij.concurrency.ThreadContext.installThreadContext$default(threadContext.kt:303)
	at com.intellij.openapi.application.rw.CancellableReadActionKt.cancellableReadActionInternal(cancellableReadAction.kt:24)
	at com.intellij.openapi.application.rw.InternalReadAction.tryReadCancellable(InternalReadAction.kt:100)
	at com.intellij.openapi.application.rw.InternalReadAction.tryReadAction(InternalReadAction.kt:86)
	at com.intellij.openapi.application.rw.InternalReadAction.readLoop(InternalReadAction.kt:73)
	at com.intellij.openapi.application.rw.InternalReadAction.access$readLoop(InternalReadAction.kt:15)
	at com.intellij.openapi.application.rw.InternalReadAction$runReadAction$6.invokeSuspend(InternalReadAction.kt:52)
	at com.intellij.openapi.application.rw.InternalReadAction$runReadAction$6.invoke(InternalReadAction.kt)
	at com.intellij.openapi.application.rw.InternalReadAction$runReadAction$6.invoke(InternalReadAction.kt)
	at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:44)
	at kotlinx.coroutines.BuildersKt__Builders_commonKt.withContext(Builders.common.kt:166)
	at kotlinx.coroutines.BuildersKt.withContext(Unknown Source)
	at com.intellij.openapi.application.rw.InternalReadAction.runReadAction(InternalReadAction.kt:50)
	at com.intellij.openapi.application.rw.PlatformReadWriteActionSupport.executeReadAction(PlatformReadWriteActionSupport.kt:66)
	at com.intellij.openapi.application.rw.PlatformReadWriteActionSupport.executeReadAndWriteAction(PlatformReadWriteActionSupport.kt:82)
	at com.intellij.openapi.application.CoroutinesKt.readAndBackgroundWriteAction(coroutines.kt:165)
	at com.intellij.openapi.vfs.newvfs.RefreshQueueImpl.processEventsSuspending(RefreshQueueImpl.kt:182)
	at com.intellij.openapi.vfs.newvfs.RefreshQueueImpl.access$processEventsSuspending(RefreshQueueImpl.kt:42)
	at com.intellij.openapi.vfs.newvfs.RefreshQueueImpl$executeSuspending$2.invokeSuspend(RefreshQueueImpl.kt:142)
	at com.intellij.openapi.vfs.newvfs.RefreshQueueImpl$executeSuspending$2.invoke(RefreshQueueImpl.kt)
	at com.intellij.openapi.vfs.newvfs.RefreshQueueImpl$executeSuspending$2.invoke(RefreshQueueImpl.kt)
	at com.intellij.openapi.vfs.newvfs.RefreshQueueImpl$Companion.executeWithParallelizationGuard(RefreshQueueImpl.kt:396)
	at com.intellij.openapi.vfs.newvfs.RefreshQueueImpl.executeWithParallelizationGuard(RefreshQueueImpl.kt:103)
	at com.intellij.openapi.vfs.newvfs.RefreshQueueImpl.executeSuspending$intellij_platform_ide_impl(RefreshQueueImpl.kt:141)
	at com.intellij.openapi.vfs.newvfs.RefreshSessionImpl.executeInBackgroundWriteAction(RefreshSessionImpl.kt:117)
	at com.intellij.openapi.vfs.newvfs.RefreshQueueImpl.processEvents(RefreshQueueImpl.kt:430)
	at com.intellij.configurationStore.SaveSessionProducerManagerKt.saveSessions(SaveSessionProducerManager.kt:76)
	at com.intellij.configurationStore.ProjectStoreImpl$doSave$2$1.invokeSuspend(ProjectStoreImpl.kt:256)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:34)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:100)
	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:610)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runDefaultDispatcherTask(CoroutineScheduler.kt:1194)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:906)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:775)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:762)

I installed the build to my regular instance of PyCharm, which has RyeCharm installed, and got this error right after switching Ruff's running mode to LSP4IJ.

@angelozerr
Copy link
Contributor Author

I tried out the build. It seems to work fine,

Thats great! Thanks for your feedback.

though there's this error:

Stacktrace
java.lang.NullPointerException: Cannot invoke "org.eclipse.lsp4j.jsonrpc.messages.Either.isRight()" because "saveOptions" is null
	at com.redhat.devtools.lsp4ij.LanguageServerWrapper.isSaveSupported(LanguageServerWrapper.java:731)

You should have this same error with nighthy. Let me understand what it happens.

at com.redhat.devtools.lsp4ij.features.files.AbstractLSPFileListener.getSupportedEvents(AbstractLSPFileListener.java:111)
at com.redhat.devtools.lsp4ij.features.files.AbstractLSPFileListener.prepareChange(AbstractLSPFileListener.java:80)
at com.intellij.openapi.vfs.newvfs.AsyncEventSupport.lambda$collectAppliers$0(AsyncEventSupport.java:132)
at com.intellij.openapi.application.impl.AppImplKt$runnableUnitFunction$1.invoke(appImpl.kt:124)
at com.intellij.openapi.application.impl.AppImplKt$runnableUnitFunction$1.invoke(appImpl.kt:124)
at com.intellij.platform.locking.impl.NestedLocksThreadingSupport.runReadAction(NestedLocksThreadingSupport.kt:856)
at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:1059)
at com.intellij.openapi.vfs.newvfs.AsyncEventSupport.collectAppliers(AsyncEventSupport.java:132)
at com.intellij.openapi.vfs.newvfs.AsyncEventSupport.runAsyncListeners(AsyncEventSupport.java:98)
at com.intellij.openapi.vfs.newvfs.RefreshQueueImpl$Companion.runAsyncListeners(RefreshQueueImpl.kt:355)
at com.intellij.openapi.vfs.newvfs.RefreshQueueImpl$Companion.access$runAsyncListeners(RefreshQueueImpl.kt:328)
at com.intellij.openapi.vfs.newvfs.RefreshQueueImpl.collectChangeAppliersInReadAction(RefreshQueueImpl.kt:219)
at com.intellij.openapi.vfs.newvfs.RefreshQueueImpl.processEventsSuspending$lambda$0(RefreshQueueImpl.kt:184)
at com.intellij.openapi.application.rw.PlatformReadWriteActionSupport.executeReadAndWriteAction$lambda$0(PlatformReadWriteActionSupport.kt:83)
at com.intellij.openapi.application.rw.InternalReadAction.insideReadAction(InternalReadAction.kt:111)
at com.intellij.openapi.application.rw.InternalReadAction.tryReadCancellable$lambda$0(InternalReadAction.kt:101)
at com.intellij.openapi.application.rw.CancellableReadActionKt.cancellableReadActionInternal$lambda$0$0$0(cancellableReadAction.kt:32)
at com.intellij.platform.locking.impl.NestedLocksThreadingSupport.tryRunReadAction(NestedLocksThreadingSupport.kt:902)
at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1237)
at com.intellij.openapi.application.rw.CancellableReadActionKt.cancellableReadActionInternal$lambda$0$0(cancellableReadAction.kt:30)
at com.intellij.openapi.progress.util.ProgressIndicatorUtilService.runActionAndCancelBeforeWrite(ProgressIndicatorUtilService.java:73)
at com.intellij.openapi.progress.util.ProgressIndicatorUtils.runActionAndCancelBeforeWrite(ProgressIndicatorUtils.java:152)
at com.intellij.openapi.application.rw.CancellableReadActionKt.cancellableReadActionInternal$lambda$0(cancellableReadAction.kt:28)
at com.intellij.concurrency.ThreadContext.installThreadContext(threadContext.kt:305)
at com.intellij.concurrency.ThreadContext.installThreadContext$default(threadContext.kt:303)
at com.intellij.openapi.application.rw.CancellableReadActionKt.cancellableReadActionInternal(cancellableReadAction.kt:24)
at com.intellij.openapi.application.rw.InternalReadAction.tryReadCancellable(InternalReadAction.kt:100)
at com.intellij.openapi.application.rw.InternalReadAction.tryReadAction(InternalReadAction.kt:86)
at com.intellij.openapi.application.rw.InternalReadAction.readLoop(InternalReadAction.kt:73)
at com.intellij.openapi.application.rw.InternalReadAction.access$readLoop(InternalReadAction.kt:15)
at com.intellij.openapi.application.rw.InternalReadAction$runReadAction$6.invokeSuspend(InternalReadAction.kt:52)
at com.intellij.openapi.application.rw.InternalReadAction$runReadAction$6.invoke(InternalReadAction.kt)
at com.intellij.openapi.application.rw.InternalReadAction$runReadAction$6.invoke(InternalReadAction.kt)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:44)
at kotlinx.coroutines.BuildersKt__Builders_commonKt.withContext(Builders.common.kt:166)
at kotlinx.coroutines.BuildersKt.withContext(Unknown Source)
at com.intellij.openapi.application.rw.InternalReadAction.runReadAction(InternalReadAction.kt:50)
at com.intellij.openapi.application.rw.PlatformReadWriteActionSupport.executeReadAction(PlatformReadWriteActionSupport.kt:66)
at com.intellij.openapi.application.rw.PlatformReadWriteActionSupport.executeReadAndWriteAction(PlatformReadWriteActionSupport.kt:82)
at com.intellij.openapi.application.CoroutinesKt.readAndBackgroundWriteAction(coroutines.kt:165)
at com.intellij.openapi.vfs.newvfs.RefreshQueueImpl.processEventsSuspending(RefreshQueueImpl.kt:182)
at com.intellij.openapi.vfs.newvfs.RefreshQueueImpl.access$processEventsSuspending(RefreshQueueImpl.kt:42)
at com.intellij.openapi.vfs.newvfs.RefreshQueueImpl$executeSuspending$2.invokeSuspend(RefreshQueueImpl.kt:142)
at com.intellij.openapi.vfs.newvfs.RefreshQueueImpl$executeSuspending$2.invoke(RefreshQueueImpl.kt)
at com.intellij.openapi.vfs.newvfs.RefreshQueueImpl$executeSuspending$2.invoke(RefreshQueueImpl.kt)
at com.intellij.openapi.vfs.newvfs.RefreshQueueImpl$Companion.executeWithParallelizationGuard(RefreshQueueImpl.kt:396)
at com.intellij.openapi.vfs.newvfs.RefreshQueueImpl.executeWithParallelizationGuard(RefreshQueueImpl.kt:103)
at com.intellij.openapi.vfs.newvfs.RefreshQueueImpl.executeSuspending$intellij_platform_ide_impl(RefreshQueueImpl.kt:141)
at com.intellij.openapi.vfs.newvfs.RefreshSessionImpl.executeInBackgroundWriteAction(RefreshSessionImpl.kt:117)
at com.intellij.openapi.vfs.newvfs.RefreshQueueImpl.processEvents(RefreshQueueImpl.kt:430)
at com.intellij.configurationStore.SaveSessionProducerManagerKt.saveSessions(SaveSessionProducerManager.kt:76)
at com.intellij.configurationStore.ProjectStoreImpl$doSave$2$1.invokeSuspend(ProjectStoreImpl.kt:256)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:34)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:100)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:610)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runDefaultDispatcherTask(CoroutineScheduler.kt:1194)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:906)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:775)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:762)

</details>

I installed the build to my regular instance of PyCharm, which has RyeCharm installed, and got this error right after switching Ruff's running mode to <i>LSP4IJ</i>. 

@angelozerr
Copy link
Contributor Author

I tried out the build. It seems to work fine, though there's this error:

Stacktrace

java.lang.NullPointerException: Cannot invoke "org.eclipse.lsp4j.jsonrpc.messages.Either.isRight()" because "saveOptions" is null

It was a bug that I have fixed. Please retry when https://github.com/redhat-developer/lsp4ij/actions/runs/19802033305/job/56730721625?pr=1379 will be finished.

@InSyncWithFoo
Copy link
Contributor

Thanks. I no longer see the error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants