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

bug: com.intellij.codeInsight.intention.impl.preview.IntentionPreviewUnsupportedOperationException: It's unexpected to invoke this... #1485

Closed
AhriCat opened this issue May 11, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@AhriCat
Copy link

AhriCat commented May 11, 2024

Cody Version

nightly

IDE Information

pycharm

Describe the bug

cody crashed when analyzing my code repeatedly but I didn't like how I saw it uses lamda to store and predict my private intellectual property with no safe guards

Expected behavior

code prediction lines are predicting code that it itself thinks is incorrect seems to be the source.

Additional context

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.GeneratedMethodAccessor227.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.$Proxy77.documentChanged(Unknown Source)
 at com.intellij.openapi.editor.impl.DocumentImpl.lambda$changedUpdate$1(DocumentImpl.java:917)
 at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeNonCancelableSection$3(CoreProgressManager.java:269)
 at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:684)
 at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$computeInNonCancelableSection$4(CoreProgressManager.java:277)
 at com.intellij.openapi.progress.Cancellation.computeInNonCancelableSection(Cancellation.java:53)
 at com.intellij.openapi.progress.impl.CoreProgressManager.computeInNonCancelableSection(CoreProgressManager.java:277)
 at com.intellij.openapi.progress.impl.CoreProgressManager.executeNonCancelableSection(CoreProgressManager.java:268)
 at com.intellij.openapi.editor.impl.DocumentImpl.changedUpdate(DocumentImpl.java:914)
 at com.intellij.openapi.editor.impl.DocumentImpl.updateText(DocumentImpl.java:818)
 at com.intellij.openapi.editor.impl.DocumentImpl.replaceString(DocumentImpl.java:658)
 at com.intellij.openapi.editor.impl.DocumentImpl.replaceString(DocumentImpl.java:595)
 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:681)
 at com.intellij.formatting.FormatterImpl.execute(FormatterImpl.java:260)
 at com.intellij.formatting.FormatterImpl.format(FormatterImpl.java:228)
 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:508)
 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$3(CoreProgressManager.java:269)
 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.lambda$computeInNonCancelableSection$4(CoreProgressManager.java:277)
 at com.intellij.openapi.progress.Cancellation.computeInNonCancelableSection(Cancellation.java:57)
 at com.intellij.openapi.progress.impl.CoreProgressManager.computeInNonCancelableSection(CoreProgressManager.java:277)
 at com.intellij.openapi.progress.impl.CoreProgressManager.executeNonCancelableSection(CoreProgressManager.java:268)
 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(Intentio...
@AhriCat AhriCat added the bug Something isn't working label May 11, 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants