( filePath: string, oldContent: string | null, newContent: string | null, )
| 37 | * notify VSCode when files are edited or written by Claude. |
| 38 | */ |
| 39 | export function notifyVscodeFileUpdated( |
| 40 | filePath: string, |
| 41 | oldContent: string | null, |
| 42 | newContent: string | null, |
| 43 | ): void { |
| 44 | if (process.env.USER_TYPE !== 'ant' || !vscodeMcpClient) { |
| 45 | return |
| 46 | } |
| 47 | |
| 48 | void vscodeMcpClient.client |
| 49 | .notification({ |
| 50 | method: 'file_updated', |
| 51 | params: { filePath, oldContent, newContent }, |
| 52 | }) |
| 53 | .catch((error: Error) => { |
| 54 | // Do not throw if the notification failed |
| 55 | logForDebugging( |
| 56 | `[VSCode] Failed to send file_updated notification: ${error.message}`, |
| 57 | ) |
| 58 | }) |
| 59 | } |
| 60 | |
| 61 | /** |
| 62 | * Sets up the speicial internal VSCode MCP for bidirectional communication using notifications. |
no test coverage detected