Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ class EventNames {
IS_CHAT_STREAMING("ide/isChatStreaming"),
CHAT_PAGE_CHANGE("ide/chatPageChange"),
IDE_TOOL_EDIT("ide/toolEdit"),
FORCE_RELOAD_FILE_BY_PATH("ide/forceReloadFileByPath")
FORCE_RELOAD_FILE_BY_PATH("ide/forceReloadFileByPath"),
FORCE_RELOAD_PROJECT_TREE_FILES("ide/forceReloadProjectTreeFiles"),
}

enum class ToChat(val value: String) {
Expand Down Expand Up @@ -145,6 +146,10 @@ class Events {
return Editor.ForceReloadFileByPath(filePath)
}

EventNames.FromChat.FORCE_RELOAD_PROJECT_TREE_FILES.value -> {
return Editor.ForceReloadProjectTreeFiles()
}

else -> null
}
}
Expand Down Expand Up @@ -382,6 +387,7 @@ class Events {

class SetSnippetToChat(payload: Snippet) : ToChat<Payload>(EventNames.ToChat.SET_SELECTED_SNIPPET, payload)
class ForceReloadFileByPath(val path: String) : FromChat(EventNames.FromChat.FORCE_RELOAD_FILE_BY_PATH, path)
class ForceReloadProjectTreeFiles(): FromChat(EventNames.FromChat.FORCE_RELOAD_PROJECT_TREE_FILES, null)
}

object NewChat : ToChat<Unit>(EventNames.ToChat.NEW_CHAT, Unit)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import com.intellij.openapi.Disposable
import com.intellij.openapi.actionSystem.DataContext
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.application.invokeLater
import com.intellij.openapi.command.WriteCommandAction
import com.intellij.openapi.diagnostic.Logger
import com.intellij.openapi.editor.Caret
import com.intellij.openapi.editor.EditorFactory
Expand Down Expand Up @@ -49,6 +48,7 @@ import javax.swing.JPanel
import com.intellij.openapi.fileEditor.FileDocumentManager
import com.intellij.openapi.fileEditor.FileEditorManagerEvent
import com.intellij.openapi.fileEditor.FileEditorManagerListener
import com.intellij.openapi.roots.ProjectRootManager

class SharedChatPane(val project: Project) : JPanel(), Disposable {
private val logger = Logger.getInstance(SharedChatPane::class.java)
Expand Down Expand Up @@ -179,7 +179,7 @@ class SharedChatPane(val project: Project) : JPanel(), Disposable {
logger.warn("handleForceReloadFileByPath: File not found: $fileName (sanitized: $sanitizedFileName)")
return@invokeLater
}
VfsUtil.markDirtyAndRefresh(true, false, true, virtualFile)
VfsUtil.markDirtyAndRefresh(true, true, true, virtualFile)
logger.warn("handleForceReloadFileByPath: done for $fileName")
}
}
Expand Down Expand Up @@ -621,6 +621,12 @@ class SharedChatPane(val project: Project) : JPanel(), Disposable {
this.handleForceReloadFileByPath(event.path)
}

is Events.Editor.ForceReloadProjectTreeFiles -> {
ProjectRootManager.getInstance(project).contentRoots.forEach {
this.handleForceReloadFileByPath(it.path)
}
}

else -> Unit
}
}
Expand Down
Loading