IDE error when trying to reference specific files

Open
#1,172 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
55/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
java, kotlin

Research direction

Start with PromptTextFieldLookupManager.kt, especially showSearchResultsLookup, and follow the lookup refresh path through PromptTextField.kt. Reproduce the file-reference lookup in the IntelliJ plugin and confirm that the editor selection is read on the correct thread using IntelliJ's read-action APIs. Done means the lookup no longer throws an EDT read-access error, newly searched files remain available, and selecting a suggestion no longer removes all context files.

Written by the indexing model from the issue text.

Description

bug
What happened?

Steps I did:

  1. Tried adding X files to my prompt in ProxyAI
  2. When adding one of the files, I got an IntelliJ IDE error toast message.

After this, the file search in the ProxyAI chat window stopped working (or only showed files it had cached before)
Also interesting: I tried opening the file I wanted to mention in IntelliJ, then just clicking on the suggestion in the chat window to add it to the context, but clicking that just removed ALL files from the context with another error.

Relevant log output or stack trace
Error showing lookup: com.intellij.openapi.diagnostic.RuntimeExceptionWithAttachments: Read access is allowed from inside read-action only (see Application.runReadAction()); If you access or modify model on EDT consider wrapping your code in WriteIntentReadAction ; see https://jb.gg/ij-platform-threading for details
Current thread: Thread[#44,AWT-EventQueue-0,10,main] 1045165094 (EventQueue.isDispatchThread()=true)
SystemEventQueueThread: (same)

com.intellij.openapi.diagnostic.RuntimeExceptionWithAttachments: Read access is allowed from inside read-action only (see Application.runReadAction()); If you access or modify model on EDT consider wrapping your code in WriteIntentReadAction ; see https://jb.gg/ij-platform-threading for details
Current thread: Thread[#44,AWT-EventQueue-0,10,main] 1045165094 (EventQueue.isDispatchThread()=true)
SystemEventQueueThread: (same)
	at com.intellij.util.concurrency.ThreadingAssertions.createThreadAccessException(ThreadingAssertions.java:257)
	at com.intellij.util.concurrency.ThreadingAssertions.throwThreadAccessException(ThreadingAssertions.java:248)
	at com.intellij.util.concurrency.ThreadingAssertions.assertReadAccess(ThreadingAssertions.java:138)
	at com.intellij.openapi.editor.impl.EditorThreading.assertInteractionAllowed(EditorThreading.kt:30)
	at com.intellij.openapi.editor.impl.CaretImpl.hasSelection(CaretImpl.java:1019)
	at com.intellij.openapi.editor.SelectionModel.hasSelection(SelectionModel.java:133)
	at com.intellij.openapi.editor.SelectionModel.hasSelection(SelectionModel.java:122)
	at com.intellij.codeInsight.lookup.impl.LookupOffsets.getPivotOffset(LookupOffsets.java:72)
	at com.intellij.codeInsight.lookup.impl.LookupOffsets.calculateStartOffset(LookupOffsets.java:124)
	at com.intellij.codeInsight.lookup.impl.LookupOffsets.checkMinPrefixLengthChanges(LookupOffsets.java:113)
	at com.intellij.codeInsight.lookup.impl.LookupImpl.updateList(LookupImpl.java:505)
	at com.intellij.codeInsight.lookup.impl.LookupImpl.refreshUi(LookupImpl.java:1307)
	at ee.carlrobert.codegpt.ui.textarea.PromptTextFieldLookupManager.showSearchResultsLookup(PromptTextFieldLookupManager.kt:99)
	at ee.carlrobert.codegpt.ui.textarea.PromptTextField.showGlobalSearchResults(PromptTextField.kt:212)
	at ee.carlrobert.codegpt.ui.textarea.PromptTextField.access$showGlobalSearchResults(PromptTextField.kt:58)
	at ee.carlrobert.codegpt.ui.textarea.PromptTextField$updateLookupWithSearchResults$2.invokeSuspend(PromptTextField.kt:628)
	at ee.carlrobert.codegpt.ui.textarea.PromptTextField$updateLookupWithSearchResults$2.invoke(PromptTextField.kt)
	at ee.carlrobert.codegpt.ui.textarea.PromptTextField$updateLookupWithSearchResults$2.invoke(PromptTextField.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 ee.carlrobert.codegpt.ui.textarea.PromptTextField.updateLookupWithSearchResults(PromptTextField.kt:627)
	at ee.carlrobert.codegpt.ui.textarea.PromptTextField.access$updateLookupWithSearchResults(PromptTextField.kt:58)
	at ee.carlrobert.codegpt.ui.textarea.PromptTextField$updateLookupWithSearchResults$1.invokeSuspend(PromptTextField.kt)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:100)
	at com.intellij.openapi.application.TransactionGuardImpl$2.run(TransactionGuardImpl.java:225)
	at com.intellij.openapi.application.impl.FlushQueue.runNextEvent(FlushQueue.java:122)
	at com.intellij.openapi.application.impl.FlushQueue.flushNow(FlushQueue.java:43)
	at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:781)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:728)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:722)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:87)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:750)
	at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.kt:595)
	at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.kt:488)
	at com.intellij.ide.IdeEventQueue.dispatchEvent$lambda$12$lambda$11$lambda$10$lambda$9(IdeEventQueue.kt:313)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:865)
	at com.intellij.ide.IdeEventQueue.dispatchEvent$lambda$12$lambda$11$lambda$10(IdeEventQueue.kt:312)
	at com.intellij.ide.IdeEventQueueKt.performActivity$lambda$3(IdeEventQueue.kt:974)
	at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:110)
	at com.intellij.ide.IdeEventQueueKt.performActivity(IdeEventQueue.kt:974)
	at com.intellij.ide.IdeEventQueue.dispatchEvent$lambda$12(IdeEventQueue.kt:307)
	at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.kt:347)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:207)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:92)
Steps to reproduce

See description above

CodeGPT version

3.6.8-241.1

Operating System

Windows

Dominant language
Kotlin
Stars
1.9k
Forks
401
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from carlrobertoh/ProxyAI

All issues in carlrobertoh/ProxyAI

Similar issues

More Kotlin issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.