MCPcopy Create free account
hub / github.com/codeaashu/claude-code / saveFile

Function saveFile

src/services/lsp/LSPServerManager.ts:349–368  ·  view source on GitHub ↗

* Save a file in LSP servers (sends didSave notification) * Called after file is written to disk to trigger diagnostics

(filePath: string)

Source from the content-addressed store, hash-verified

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)

Callers

nothing calls this directly

Calls 5

getServerForFileFunction · 0.85
logForDebuggingFunction · 0.85
errorMessageFunction · 0.50
logErrorFunction · 0.50
resolveMethod · 0.45

Tested by

no test coverage detected