* Save a file in LSP servers (sends didSave notification) * Called after file is written to disk to trigger diagnostics
(filePath: string)
| 347 | * Called after file is written to disk to trigger diagnostics |
| 348 | */ |
| 349 | async function saveFile(filePath: string): Promise<void> { |
| 350 | const server = getServerForFile(filePath) |
| 351 | if (!server || server.state !== 'running') return |
| 352 | |
| 353 | try { |
| 354 | await server.sendNotification('textDocument/didSave', { |
| 355 | textDocument: { |
| 356 | uri: pathToFileURL(path.resolve(filePath)).href, |
| 357 | }, |
| 358 | }) |
| 359 | logForDebugging(`LSP: Sent didSave for ${filePath}`) |
| 360 | } catch (error) { |
| 361 | const err = new Error( |
| 362 | `Failed to sync file save ${filePath}: ${errorMessage(error)}`, |
| 363 | ) |
| 364 | logError(err) |
| 365 | // Re-throw to propagate error to caller |
| 366 | throw err |
| 367 | } |
| 368 | } |
| 369 | |
| 370 | /** |
| 371 | * Close a file in LSP servers (sends didClose notification) |
nothing calls this directly
no test coverage detected