MCPcopy Create free account
hub / github.com/Zoo-Code-Org/Zoo-Code / openMention

Function openMention

src/core/mentions/index.ts:23–44  ·  view source on GitHub ↗
(cwd: string, mention?: string)

Source from the content-addressed store, hash-verified

21import type { SkillContent } from "../../shared/skills"
22
23export 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.

Callers 1

webviewMessageHandlerFunction · 0.90

Calls 5

unescapeSpacesFunction · 0.90
openFileFunction · 0.90
executeCommandMethod · 0.80
fileMethod · 0.80
parseMethod · 0.80

Tested by

no test coverage detected