diff --git a/agent/src/agent.ts b/agent/src/agent.ts index 86a3f22012d..b18741d71e4 100644 --- a/agent/src/agent.ts +++ b/agent/src/agent.ts @@ -308,7 +308,7 @@ export class Agent extends MessageHandler implements ExtensionClient { this.notify('debug/message', { channel: 'Document Sync Check', message: panicMessage + '\n' + message, - level: 'error' + level: 'error', }) }, edit: (uri, callback, options) => { diff --git a/agent/src/vscode-shim.ts b/agent/src/vscode-shim.ts index fd1db1e80a9..6a45fc2abca 100644 --- a/agent/src/vscode-shim.ts +++ b/agent/src/vscode-shim.ts @@ -53,7 +53,7 @@ import { AgentTabGroups } from './AgentTabGroups' import { AgentWorkspaceConfiguration } from './AgentWorkspaceConfiguration' import type { Agent } from './agent' import { matchesGlobPatterns } from './cli/command-bench/matchesGlobPatterns' -import {ClientInfo, DebugMessageLogLevel, ExtensionConfiguration} from './protocol-alias' +import type { ClientInfo, DebugMessageLogLevel, ExtensionConfiguration } from './protocol-alias' // Not using CODY_TESTING because it changes the URL endpoint we send requests // to and we want to send requests to sourcegraph.com because we record the HTTP @@ -532,25 +532,42 @@ export namespace UriString { function outputChannel(name: string): vscode.LogOutputChannel { function notifyAgent(level: DebugMessageLogLevel, message: string, ...args: any[]): void { if (agent) { - const formattedMessage = args.length ? String(message).replace(/{(\d+)}/g, (match, num) => args[num]?.toString() ?? match) : message + const formattedMessage = args.length + ? String(message).replace(/{(\d+)}/g, (match, num) => args[num]?.toString() ?? match) + : message agent.notify('debug/message', { channel: name, message: formattedMessage, level }) - } } return { name, - append: message => { notifyAgent('info', message) }, - appendLine: message => { notifyAgent('trace', message) }, - replace: message => { notifyAgent('trace', message) }, + append: message => { + notifyAgent('info', message) + }, + appendLine: message => { + notifyAgent('trace', message) + }, + replace: message => { + notifyAgent('trace', message) + }, clear: () => {}, show: () => {}, hide: () => {}, dispose: () => {}, - trace: (message: string, ...args: any[]) => { notifyAgent('trace', message, args) }, - debug: (message: string, ...args: any[]) => { notifyAgent('debug', message, args) }, - info: (message: string, ...args: any[]) => { notifyAgent('info', message, args) }, - warn: (message: string, ...args: any[]) => { notifyAgent('warn', message, args) }, - error: (message: string, ...args: any[]) => { notifyAgent('error', message, args) }, + trace: (message: string, ...args: any[]) => { + notifyAgent('trace', message, args) + }, + debug: (message: string, ...args: any[]) => { + notifyAgent('debug', message, args) + }, + info: (message: string, ...args: any[]) => { + notifyAgent('info', message, args) + }, + warn: (message: string, ...args: any[]) => { + notifyAgent('warn', message, args) + }, + error: (message: string, ...args: any[]) => { + notifyAgent('error', message, args) + }, logLevel: LogLevel.Trace, onDidChangeLogLevel: emptyEvent(), }