|
|
@@ -8,6 +8,7 @@ import { extractTextFromFile } from "../../integrations/misc/extract-text"
|
|
|
import { isBinaryFile } from "isbinaryfile"
|
|
|
import { diagnosticsToProblemsString } from "../../integrations/diagnostics"
|
|
|
import { getCommitInfo, getWorkingState } from "../../utils/git"
|
|
|
+import { getLatestTerminalOutput } from "../../integrations/terminal/get-latest-output"
|
|
|
|
|
|
export async function openMention(mention?: string): Promise<void> {
|
|
|
if (!mention) {
|
|
|
@@ -29,6 +30,8 @@ export async function openMention(mention?: string): Promise<void> {
|
|
|
}
|
|
|
} else if (mention === "problems") {
|
|
|
vscode.commands.executeCommand("workbench.actions.view.problems")
|
|
|
+ } else if (mention === "terminal") {
|
|
|
+ vscode.commands.executeCommand("workbench.action.terminal.focus")
|
|
|
} else if (mention.startsWith("http")) {
|
|
|
vscode.env.openExternal(vscode.Uri.parse(mention))
|
|
|
}
|
|
|
@@ -51,6 +54,8 @@ export async function parseMentions(text: string, cwd: string, urlContentFetcher
|
|
|
return `Working directory changes (see below for details)`
|
|
|
} else if (/^[a-f0-9]{7,40}$/.test(mention)) {
|
|
|
return `Git commit '${mention}' (see below for commit info)`
|
|
|
+ } else if (mention === "terminal") {
|
|
|
+ return `Terminal Output (see below for output)`
|
|
|
}
|
|
|
return match
|
|
|
})
|
|
|
@@ -118,6 +123,13 @@ export async function parseMentions(text: string, cwd: string, urlContentFetcher
|
|
|
} catch (error) {
|
|
|
parsedText += `\n\n<git_commit hash="${mention}">\nError fetching commit info: ${error.message}\n</git_commit>`
|
|
|
}
|
|
|
+ } else if (mention === "terminal") {
|
|
|
+ try {
|
|
|
+ const terminalOutput = await getLatestTerminalOutput()
|
|
|
+ parsedText += `\n\n<terminal_output>\n${terminalOutput}\n</terminal_output>`
|
|
|
+ } catch (error) {
|
|
|
+ parsedText += `\n\n<terminal_output>\nError fetching terminal output: ${error.message}\n</terminal_output>`
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|