Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JetBrains: Crash occurred when clicking on JB's Intention Bulb icon for some error code. #1435

Closed
jay-fibi opened this issue May 1, 2024 · 3 comments · Fixed by #1588
Closed
Assignees
Labels

Comments

@jay-fibi
Copy link
Collaborator

jay-fibi commented May 1, 2024

Cody Version

v5.5.8

IDE Information

IntelliJ IDEA 2023.3.4 (Community Edition)
Build #IC-233.14475.28, built on February 13, 2024
Runtime version: 17.0.10+1-b1087.17 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 11.0
GC: G1 Young Generation, G1 Old Generation
Memory: 2048M
Cores: 12
Registry:
ide.experimental.ui=true
Non-Bundled Plugins:
PythonCore (233.14475.9)
com.soywiz.korge.korge-intellij-plugin (4.0.4)
com.sourcegraph.jetbrains (5.5.8)
Kotlin: 233.14475.28-IJ

Describe the bug

Platform: Windows

Steps to reproduce:

  1. Have Cody plugin installed in your JB IntelliJ IDEA editor
  2. Login to Cody with PRO user
  3. Close the IDE and relaunch it again. Let the Cody initialize correctly
  4. Open a source code file and write some erroneous code
  5. Verify that Red bulb icon aka Intention icon appear
  6. Click on it and mouse hove the suggestions

Observed behavior:

Crash occurred with following stacktrace,
Stacktrace:

com.intellij.codeInsight.intention.impl.preview.IntentionPreviewUnsupportedOperationException: It's unexpected to invoke this method on an intention preview calculating.
	at com.intellij.codeInsight.intention.impl.preview.IntentionPreviewEditor.notImplemented(IntentionPreviewEditor.kt:15)
	at com.intellij.openapi.editor.impl.ImaginaryEditor.getInlayModel(ImaginaryEditor.java:268)
	at com.sourcegraph.cody.autocomplete.render.InlayModelUtil.getAllInlaysForEditor(InlayModelUtil.kt:25)
	at com.sourcegraph.cody.autocomplete.CodyAutocompleteManager.disposeInlays(CodyAutocompleteManager.kt:111)
	at com.sourcegraph.cody.autocomplete.CodyAutocompleteManager.clearAutocompleteSuggestions(CodyAutocompleteManager.kt:84)
	at com.sourcegraph.cody.listeners.CodyDocumentListener.documentChangedNonBulk(CodyDocumentListener.kt:38)
	at com.intellij.openapi.editor.event.BulkAwareDocumentListener.documentChanged(BulkAwareDocumentListener.java:21)
	at jdk.internal.reflect.GeneratedMethodAccessor95.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at com.intellij.util.EventDispatcher.dispatchVoidMethod(EventDispatcher.java:119)
	at com.intellij.util.EventDispatcher.lambda$createMulticaster$1(EventDispatcher.java:84)
	at jdk.proxy2/jdk.proxy2.$Proxy76.documentChanged(Unknown Source)
	at com.intellij.openapi.editor.impl.DocumentImpl.lambda$changedUpdate$1(DocumentImpl.java:913)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeNonCancelableSection$2(CoreProgressManager.java:228)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:634)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$computeInNonCancelableSection$3(CoreProgressManager.java:236)
	at com.intellij.openapi.progress.Cancellation.computeInNonCancelableSection(Cancellation.java:53)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computeInNonCancelableSection(CoreProgressManager.java:236)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeNonCancelableSection(CoreProgressManager.java:227)
	at com.intellij.openapi.editor.impl.DocumentImpl.changedUpdate(DocumentImpl.java:910)
	at com.intellij.openapi.editor.impl.DocumentImpl.updateText(DocumentImpl.java:814)
	at com.intellij.openapi.editor.impl.DocumentImpl.replaceString(DocumentImpl.java:654)
	at com.intellij.openapi.editor.impl.DocumentImpl.replaceString(DocumentImpl.java:591)
	at com.intellij.psi.formatter.DocumentBasedFormattingModel.replaceWhiteSpace(DocumentBasedFormattingModel.java:146)
	at com.intellij.formatting.engine.FormatProcessorUtils.replaceWhiteSpace(FormatProcessorUtils.java:31)
	at com.intellij.formatting.engine.ApplyChangesState.doIteration(ApplyChangesState.java:160)
	at com.intellij.formatting.engine.State.iteration(State.java:25)
	at com.intellij.formatting.engine.StateProcessor.iteration(StateProcessor.java:26)
	at com.intellij.formatting.FormatProcessor.iteration(FormatProcessor.java:92)
	at com.intellij.formatting.FormatterImpl$MyFormattingTask.iteration(FormatterImpl.java:674)
	at com.intellij.formatting.FormatterImpl.execute(FormatterImpl.java:259)
	at com.intellij.formatting.FormatterImpl.format(FormatterImpl.java:227)
	at com.intellij.psi.impl.source.codeStyle.CodeFormatterFacade.processText(CodeFormatterFacade.java:203)
	at com.intellij.formatting.service.CoreFormattingService.formatRanges(CoreFormattingService.java:92)
	at com.intellij.psi.impl.source.PostprocessReformattingAspectImpl$ReformatRangesAction.execute(PostprocessReformattingAspectImpl.java:811)
	at com.intellij.psi.impl.source.PostprocessReformattingAspectImpl.lambda$doPostponedFormattingInner$9(PostprocessReformattingAspectImpl.java:422)
	at com.intellij.psi.impl.source.codeStyle.CodeStyleManagerImpl.runWithDocCommentFormattingDisabled(CodeStyleManagerImpl.java:491)
	at com.intellij.psi.impl.source.PostprocessReformattingAspectImpl.doPostponedFormattingInner(PostprocessReformattingAspectImpl.java:421)
	at com.intellij.psi.impl.source.PostprocessReformattingAspectImpl.lambda$doPostponedFormatting$7(PostprocessReformattingAspectImpl.java:298)
	at com.intellij.psi.impl.source.PostprocessReformattingAspectImpl.lambda$disablePostprocessFormattingInside$1(PostprocessReformattingAspectImpl.java:119)
	at com.intellij.psi.impl.source.PostprocessReformattingAspectImpl.disablePostprocessFormattingInside(PostprocessReformattingAspectImpl.java:128)
	at com.intellij.psi.impl.source.PostprocessReformattingAspectImpl.disablePostprocessFormattingInside(PostprocessReformattingAspectImpl.java:118)
	at com.intellij.psi.impl.source.PostprocessReformattingAspectImpl.lambda$doPostponedFormatting$8(PostprocessReformattingAspectImpl.java:298)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeNonCancelableSection$2(CoreProgressManager.java:228)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:685)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:641)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$computeInNonCancelableSection$3(CoreProgressManager.java:236)
	at com.intellij.openapi.progress.Cancellation.computeInNonCancelableSection(Cancellation.java:57)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computeInNonCancelableSection(CoreProgressManager.java:236)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeNonCancelableSection(CoreProgressManager.java:227)
	at com.intellij.psi.impl.source.PostprocessReformattingAspectImpl.doPostponedFormatting(PostprocessReformattingAspectImpl.java:296)
	at com.intellij.psi.impl.source.PostprocessReformattingAspectImpl.doPostponedFormatting(PostprocessReformattingAspectImpl.java:281)
	at com.intellij.psi.impl.source.PostprocessReformattingAspectImpl.decrementPostponedCounter(PostprocessReformattingAspectImpl.java:180)
	at com.intellij.psi.impl.source.PostprocessReformattingAspectImpl.postponeFormattingInside(PostprocessReformattingAspectImpl.java:151)
	at com.intellij.psi.impl.source.PostprocessReformattingAspectImpl.postponeFormattingInside(PostprocessReformattingAspectImpl.java:138)
	at com.intellij.codeInsight.intention.impl.preview.IntentionPreviewComputable.invokePreview$lambda$2(Intention...

Expected behavior

Cody crash should not occur.

Additional context

Video link:

https://drive.google.com/file/d/1XO-uPXmQMwRUx1JLPfsptXBJCqS1rwkc/view?usp=drive_link

@jay-fibi jay-fibi added bug Something isn't working fibilabs-qa fibilabs-qa-p0 labels May 1, 2024
@dominiccooney dominiccooney self-assigned this May 13, 2024
dominiccooney added a commit that referenced this issue May 13, 2024
…ch don't support inlay models. (#1490)

ImaginaryEditor does not support InlayModel and throws an
UnsupportedOperationException; IntentionPreviewEditor throws an
IntentionPreviewUnsupportedOperationException:
UnsupportedOperationException, etc.

Fixes #1488, #1486, #1485, #1480, #1466, #1462, #1435, #1363

## Test plan

```
./gradlew test --tests InlayModelUtilTest
```

Ran the IDE and clicked between editors, requesting autocompletes.
@taylorsperry
Copy link
Contributor

@dominiccooney I'm seeing this on 5.5.11 as well, though my stacktrace looks different from @jay-fibi 's:

Stacktrace:

java.lang.RuntimeException: Side effect not allowed: INVOKE_LATER
	at com.intellij.model.SideEffectGuard$Companion.checkSideEffectAllowed(SideEffectGuard.kt:21)
	at com.intellij.model.SideEffectGuard.checkSideEffectAllowed(SideEffectGuard.kt)
	at com.intellij.openapi.application.impl.LaterInvocator.invokeLater(LaterInvocator.java:79)
	at com.intellij.openapi.application.impl.ApplicationImpl.invokeLater(ApplicationImpl.java:348)
	at com.intellij.openapi.application.impl.ApplicationImpl.invokeLater(ApplicationImpl.java:332)
	at com.sourcegraph.cody.listeners.CodyDocumentListener.documentChangedNonBulk(CodyDocumentListener.kt:80)
	at com.intellij.openapi.editor.event.BulkAwareDocumentListener.documentChanged(BulkAwareDocumentListener.java:21)
	at jdk.internal.reflect.GeneratedMethodAccessor236.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at com.intellij.util.EventDispatcher.dispatchVoidMethod(EventDispatcher.java:119)
	at com.intellij.util.EventDispatcher.lambda$createMulticaster$1(EventDispatcher.java:84)
	at jdk.proxy1/jdk.proxy1.$Proxy86.documentChanged(Unknown Source)
	at com.intellij.openapi.editor.impl.DocumentImpl.lambda$changedUpdate$1(DocumentImpl.java:913)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeNonCancelableSection$2(CoreProgressManager.java:228)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:634)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$computeInNonCancelableSection$3(CoreProgressManager.java:236)
	at com.intellij.openapi.progress.Cancellation.computeInNonCancelableSection(Cancellation.java:53)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computeInNonCancelableSection(CoreProgressManager.java:236)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeNonCancelableSection(CoreProgressManager.java:227)
	at com.intellij.openapi.editor.impl.DocumentImpl.changedUpdate(DocumentImpl.java:910)
	at com.intellij.openapi.editor.impl.DocumentImpl.updateText(DocumentImpl.java:814)
	at com.intellij.openapi.editor.impl.DocumentImpl.replaceString(DocumentImpl.java:654)
	at com.intellij.openapi.editor.impl.DocumentImpl.replaceString(DocumentImpl.java:591)
	at com.intellij.psi.impl.PsiToDocumentSynchronizer.doCommitTransaction(PsiToDocumentSynchronizer.java:212)
	at com.intellij.psi.impl.PsiToDocumentSynchronizer.lambda$commitTransaction$1(PsiToDocumentSynchronizer.java:188)
	at com.intellij.psi.impl.PsiToDocumentSynchronizer.lambda$doSync$0(PsiToDocumentSynchronizer.java:106)
	at com.intellij.psi.impl.PsiToDocumentSynchronizer.performAtomically(PsiToDocumentSynchronizer.java:124)
	at com.intellij.psi.impl.PsiToDocumentSynchronizer.doSync(PsiToDocumentSynchronizer.java:106)
	at com.intellij.psi.impl.PsiToDocumentSynchronizer.commitTransaction(PsiToDocumentSynchronizer.java:188)
	at com.intellij.pom.core.impl.PomModelImpl.commitTransaction(PomModelImpl.java:195)
	at com.intellij.pom.core.impl.PomModelImpl.lambda$runTransaction$1(PomModelImpl.java:151)
	at com.intellij.psi.impl.DebugUtil.performPsiModification(DebugUtil.java:535)
	at com.intellij.pom.core.impl.PomModelImpl.lambda$runTransaction$2(PomModelImpl.java:103)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeNonCancelableSection$2(CoreProgressManager.java:228)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:685)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:641)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$computeInNonCancelableSection$3(CoreProgressManager.java:236)
	at com.intellij.openapi.progress.Cancellation.computeInNonCancelableSection(Cancellation.java:57)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computeInNonCancelableSection(CoreProgressManager.java:236)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeNonCancelableSection(CoreProgressManager.java:227)
	at com.intellij.pom.core.impl.PomModelImpl.runTransaction(PomModelImpl.java:92)
	at com.intellij.psi.impl.source.tree.ChangeUtil.prepareAndRunChangeAction(ChangeUtil.java:141)
	at com.intellij.psi.impl.source.tree.CompositeElement.replaceChild(CompositeElement.java:632)
	at com.intellij.lang.javascript.psi.impl.JSElementImpl.replaceInParent(JSElementImpl.java:148)
	at com.intellij.lang.javascript.psi.impl.JSChangeUtil.replaceExpression(JSChangeUtil.java:404)
	at com.intellij.lang.javascript.refactoring.util.JSRefactoringUtil.replaceExpressionAndReformat(JSRefactoringUtil.java:1214)
	at org.intellij.idea.lang.javascript.intention.number.JSFlipArithmeticOperationIntention.processIntention(JSFlipArithmeticOperationIntention.java:48)
	at org.intellij.idea.lang.javascript.intention.JSIntention.invoke(JSIntention.java:51)
	at com.intellij.codeInsight.intention.PsiElementBaseIntentionAction.invoke(PsiElementBaseIntentionAction.java:27)
	at com.intellij.codeInsight.intention.IntentionAction.generatePreview(IntentionAction.java:113)
	at com.intellij.codeInsight.intention.impl.config.IntentionActionWrapper.generatePreview(IntentionActionWrapper.java:90)
	at com.intellij.codeInsight.intention.impl.IntentionActionWithTextCaching$MyIntentionAction.generatePreview(IntentionActionWithTextCaching.java:254)
	at com.intellij.codeInsight.intention.impl.preview.IntentionPreviewComputable$invokePreview$1$1$1.invoke(IntentionPreviewComputable.kt:122)
	at com.intellij.codeInsight.intention.impl.preview.IntentionPreviewComputable$invokePreview$1$1$1.invoke(IntentionPreviewComputable.kt:121)
	at com.intellij.model.SideEffectGuard$Companion.computeWithAllowedSideEffectsBlocking(SideEffectGuard.kt:42)
	at com.intellij.model.SideEffectGuard$Companion.computeWithoutSideEffects(SideEffectGuard.kt:27)
	at com.intellij.codeInsight.intention.impl.preview.IntentionPreviewComputable.invokePreview$lambda$2$lambda$1(IntentionPreviewComputable.kt:121)
	at com.intellij.psi.impl.source.PostprocessReformattingAspectImpl.lambda$postponeFormattingInside$2(PostprocessReformattingAspectImpl.java:139)
	at com.intellij.psi.impl.source.PostprocessReformattingAspectImpl.postponeFormattingInside(PostprocessReformattingAspectImpl.java:148)
	at com.intellij.psi.impl.source.PostprocessReformattingAspectImpl.postponeFormattingInside(Postpr...

@taylorsperry taylorsperry reopened this May 20, 2024
@taylorsperry
Copy link
Contributor

Might be related to this too? #1538

@mkondratek
Copy link
Contributor

The issue does not appear in the default version of IDE we use in development. It does occur for 2023.3.

mkondratek added a commit that referenced this issue May 22, 2024
)

Fixes #1435.

## Test plan
1. Run IntelliJ 2023.3 or later 
2. Have a file with an error in the code (e.g. val field without
initialisation in Kotlin).
3. Hover on the error (red underlined text), open the red light bulb
icon

### Expected
No error.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants