Skip to content

Commit b411789

Browse files
committed
refactor(omnibar): remove built-in commands and fuzzy match
Eliminates built-in command items and fuzzy matching functions from Omnibar, simplifying data provider and search engine logic.
1 parent 0ab2bc4 commit b411789

File tree

2 files changed

+0
-118
lines changed

2 files changed

+0
-118
lines changed

mpp-ui/src/commonMain/kotlin/cc/unitmesh/devins/ui/compose/omnibar/ComposeOmnibarDataProvider.kt

Lines changed: 0 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,7 @@ class ComposeOmnibarDataProvider(
2020

2121
override suspend fun getItems(): List<OmnibarItem> {
2222
val items = mutableListOf<OmnibarItem>()
23-
24-
// Add built-in commands
25-
items.addAll(getBuiltinCommands())
26-
27-
// Add settings/actions
2823
items.addAll(getSettingsItems())
29-
3024
return items
3125
}
3226

@@ -67,83 +61,6 @@ class ComposeOmnibarDataProvider(
6761
}
6862
}
6963

70-
private fun getBuiltinCommands(): List<OmnibarItem> {
71-
return listOf(
72-
OmnibarItem(
73-
id = "cmd_file",
74-
title = "/file",
75-
type = OmnibarItemType.COMMAND,
76-
description = "Read file content from project",
77-
category = "Commands",
78-
weight = 100,
79-
metadata = mapOf("commandName" to "file")
80-
),
81-
OmnibarItem(
82-
id = "cmd_write",
83-
title = "/write",
84-
type = OmnibarItemType.COMMAND,
85-
description = "Write content to a file",
86-
category = "Commands",
87-
weight = 95,
88-
metadata = mapOf("commandName" to "write")
89-
),
90-
OmnibarItem(
91-
id = "cmd_shell",
92-
title = "/shell",
93-
type = OmnibarItemType.COMMAND,
94-
description = "Execute shell commands",
95-
category = "Commands",
96-
weight = 90,
97-
metadata = mapOf("commandName" to "shell")
98-
),
99-
OmnibarItem(
100-
id = "cmd_search",
101-
title = "/search",
102-
type = OmnibarItemType.COMMAND,
103-
description = "Search for files or content",
104-
category = "Commands",
105-
weight = 85,
106-
metadata = mapOf("commandName" to "search")
107-
),
108-
OmnibarItem(
109-
id = "cmd_patch",
110-
title = "/patch",
111-
type = OmnibarItemType.COMMAND,
112-
description = "Apply code patches",
113-
category = "Commands",
114-
weight = 80,
115-
metadata = mapOf("commandName" to "patch")
116-
),
117-
OmnibarItem(
118-
id = "cmd_browse",
119-
title = "/browse",
120-
type = OmnibarItemType.COMMAND,
121-
description = "Browse web pages",
122-
category = "Commands",
123-
weight = 75,
124-
metadata = mapOf("commandName" to "browse")
125-
),
126-
OmnibarItem(
127-
id = "cmd_commit",
128-
title = "/commit",
129-
type = OmnibarItemType.COMMAND,
130-
description = "Git commit changes",
131-
category = "Commands",
132-
weight = 70,
133-
metadata = mapOf("commandName" to "commit")
134-
),
135-
OmnibarItem(
136-
id = "cmd_help",
137-
title = "/help",
138-
type = OmnibarItemType.COMMAND,
139-
description = "Show available commands",
140-
category = "Commands",
141-
weight = 50,
142-
metadata = mapOf("commandName" to "help")
143-
)
144-
)
145-
}
146-
14764
private fun getSettingsItems(): List<OmnibarItem> {
14865
return listOf(
14966
OmnibarItem(

mpp-ui/src/commonMain/kotlin/cc/unitmesh/devins/ui/compose/omnibar/OmnibarSearchEngine.kt

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -109,38 +109,3 @@ class OmnibarSearchEngine {
109109
return matchCount * 50
110110
}
111111
}
112-
113-
/**
114-
* Extension function for fuzzy matching on strings.
115-
* Returns true if all characters in query appear in text in order.
116-
*/
117-
fun String.fuzzyContains(query: String): Boolean {
118-
if (query.isEmpty()) return true
119-
var queryIndex = 0
120-
for (char in this) {
121-
if (char.lowercaseChar() == query[queryIndex].lowercaseChar()) {
122-
queryIndex++
123-
if (queryIndex == query.length) return true
124-
}
125-
}
126-
return false
127-
}
128-
129-
/**
130-
* Get fuzzy match positions for highlighting.
131-
* Returns list of character indices that match the query.
132-
*/
133-
fun String.fuzzyMatchPositions(query: String): List<Int> {
134-
if (query.isEmpty()) return emptyList()
135-
val positions = mutableListOf<Int>()
136-
var queryIndex = 0
137-
for ((index, char) in this.withIndex()) {
138-
if (queryIndex < query.length &&
139-
char.lowercaseChar() == query[queryIndex].lowercaseChar()) {
140-
positions.add(index)
141-
queryIndex++
142-
}
143-
}
144-
return if (queryIndex == query.length) positions else emptyList()
145-
}
146-

0 commit comments

Comments
 (0)