fix(editor): better sorting of files when completing with / (#733)

Carlos Alexandro Becker and Andrey Nering created

* fix(editor): better sorting of files when completing with /

basically, show shorter paths first

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* Update internal/tui/components/chat/editor/editor.go

Co-authored-by: Andrey Nering <andreynering@users.noreply.github.com>

---------

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
Co-authored-by: Andrey Nering <andreynering@users.noreply.github.com>

Change summary

internal/tui/components/chat/editor/editor.go | 1 +
1 file changed, 1 insertion(+)

Detailed changes

internal/tui/components/chat/editor/editor.go 🔗

@@ -481,6 +481,7 @@ func (m *editorCmp) SetPosition(x, y int) tea.Cmd {
 
 func (m *editorCmp) startCompletions() tea.Msg {
 	files, _, _ := fsext.ListDirectory(".", nil, 0)
+	slices.Sort(files)
 	completionItems := make([]completions.Completion, 0, len(files))
 	for _, file := range files {
 		file = strings.TrimPrefix(file, "./")