Skip to content

Commit 78e5bf1

Browse files
committed
refactor(devti): improve code readability and accessibility
- Simplify FileSearchPopup.loadProjectFiles() by removing redundant Companion object call - Make SimilarChunksWithPaths.getMostRecentFiles() public for wider usage
1 parent 1d625c0 commit 78e5bf1

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

core/src/main/kotlin/cc/unitmesh/devti/gui/chat/ui/FileSearchPopup.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ class FileSearchPopup(
4343

4444
private fun loadProjectFiles() {
4545
allProjectFiles.clear()
46-
EditorHistoryManager.Companion.getInstance(project).fileList.forEach { file ->
46+
val fileList = EditorHistoryManager.getInstance(project).fileList
47+
fileList.forEach { file ->
4748
if (file.canBeAdded(project)) {
4849
val presentation = FilePresentation.from(project, file)
4950
presentation.isRecentFile = true

core/src/main/kotlin/cc/unitmesh/devti/inlay/chunks/SimilarChunksWithPaths.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ class SimilarChunksWithPaths(private var snippetLength: Int = 60, private var ma
132132
}
133133
}
134134

135-
private fun getMostRecentFiles(element: PsiElement): List<VirtualFile> {
135+
fun getMostRecentFiles(element: PsiElement): List<VirtualFile> {
136136
val fileType: FileType = element.containingFile?.fileType ?: return emptyList()
137137

138138
val recentFiles: List<VirtualFile> = EditorHistoryManager.getInstance(element.project).fileList.filter { file ->

0 commit comments

Comments
 (0)