(cwd: string, mention?: string)
| 21 | import type { SkillContent } from "../../shared/skills" |
| 22 | |
| 23 | export async function openMention(cwd: string, mention?: string): Promise<void> { |
| 24 | if (!mention) { |
| 25 | return |
| 26 | } |
| 27 | |
| 28 | if (mention.startsWith("/")) { |
| 29 | // Slice off the leading slash and unescape any spaces in the path |
| 30 | const relPath = unescapeSpaces(mention.slice(1)) |
| 31 | const absPath = path.resolve(cwd, relPath) |
| 32 | if (mention.endsWith("/")) { |
| 33 | vscode.commands.executeCommand("revealInExplorer", vscode.Uri.file(absPath)) |
| 34 | } else { |
| 35 | openFile(absPath) |
| 36 | } |
| 37 | } else if (mention === "problems") { |
| 38 | vscode.commands.executeCommand("workbench.actions.view.problems") |
| 39 | } else if (mention === "terminal") { |
| 40 | vscode.commands.executeCommand("workbench.action.terminal.focus") |
| 41 | } else if (mention.startsWith("http")) { |
| 42 | vscode.env.openExternal(vscode.Uri.parse(mention)) |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | /** |
| 47 | * Represents a content block generated from an @ mention. |
no test coverage detected