Skip to content

Commit 19c2c49

Browse files
committed
refactor: remove unused token validation function and simplify token processing logic
1 parent 77bc9e6 commit 19c2c49

File tree

2 files changed

+2
-15
lines changed

2 files changed

+2
-15
lines changed

webview-ui/src/components/chat/CommandPatternSelector.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,6 @@ export const CommandPatternSelector: React.FC<CommandPatternSelectorProps> = ({
8585
<Info className="size-3.5 text-vscode-descriptionForeground" />
8686
</StandardTooltip>
8787
</div>
88-
<div className="flex items-center gap-2 text-xs text-vscode-descriptionForeground">
89-
<span>{allowedCommands.length} allowed</span>
90-
<span></span>
91-
<span>{deniedCommands.length} denied</span>
92-
</div>
9388
</button>
9489

9590
{isExpanded && (

webview-ui/src/utils/command-parser.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,6 @@ export function extractPatternsFromCommand(command: string): string[] {
4141
return Array.from(patterns).sort()
4242
}
4343

44-
function isValidToken(token: string): boolean {
45-
return !!token && !token.startsWith("-") && !token.match(/[/\\~:]/) && token !== "." && !token.match(/\.\w+$/)
46-
}
47-
4844
function extractFromTokens(tokens: string[], patterns: Set<string>): void {
4945
if (tokens.length === 0) return
5046

@@ -58,11 +54,7 @@ function extractFromTokens(tokens: string[], patterns: Set<string>): void {
5854
patterns.add(pattern)
5955

6056
for (let i = 1; i < Math.min(tokens.length, 3); i++) {
61-
if (isValidToken(tokens[i])) {
62-
pattern += ` ${tokens[i]}`
63-
patterns.add(pattern)
64-
} else {
65-
break // Stop at first invalid token
66-
}
57+
pattern += ` ${tokens[i]}`
58+
patterns.add(pattern)
6759
}
6860
}

0 commit comments

Comments
 (0)