|
@@ -47,7 +47,7 @@ export const WriteTool = Tool.define("write", {
|
|
|
})
|
|
})
|
|
|
FileTime.read(ctx.sessionID, filepath)
|
|
FileTime.read(ctx.sessionID, filepath)
|
|
|
|
|
|
|
|
- let output = ""
|
|
|
|
|
|
|
+ let output = "Wrote file successfully."
|
|
|
await LSP.touchFile(filepath, true)
|
|
await LSP.touchFile(filepath, true)
|
|
|
const diagnostics = await LSP.diagnostics()
|
|
const diagnostics = await LSP.diagnostics()
|
|
|
const normalizedFilepath = Filesystem.normalizePath(filepath)
|
|
const normalizedFilepath = Filesystem.normalizePath(filepath)
|
|
@@ -59,12 +59,12 @@ export const WriteTool = Tool.define("write", {
|
|
|
const suffix =
|
|
const suffix =
|
|
|
errors.length > MAX_DIAGNOSTICS_PER_FILE ? `\n... and ${errors.length - MAX_DIAGNOSTICS_PER_FILE} more` : ""
|
|
errors.length > MAX_DIAGNOSTICS_PER_FILE ? `\n... and ${errors.length - MAX_DIAGNOSTICS_PER_FILE} more` : ""
|
|
|
if (file === normalizedFilepath) {
|
|
if (file === normalizedFilepath) {
|
|
|
- output += `\nThis file has errors, please fix\n<file_diagnostics>\n${limited.map(LSP.Diagnostic.pretty).join("\n")}${suffix}\n</file_diagnostics>\n`
|
|
|
|
|
|
|
+ output += `\n\nLSP errors detected in this file:\n<diagnostics file="${filepath}">\n${limited.map(LSP.Diagnostic.pretty).join("\n")}${suffix}\n</diagnostics>`
|
|
|
continue
|
|
continue
|
|
|
}
|
|
}
|
|
|
if (projectDiagnosticsCount >= MAX_PROJECT_DIAGNOSTICS_FILES) continue
|
|
if (projectDiagnosticsCount >= MAX_PROJECT_DIAGNOSTICS_FILES) continue
|
|
|
projectDiagnosticsCount++
|
|
projectDiagnosticsCount++
|
|
|
- output += `\n<project_diagnostics>\n${file}\n${limited.map(LSP.Diagnostic.pretty).join("\n")}${suffix}\n</project_diagnostics>\n`
|
|
|
|
|
|
|
+ output += `\n\nLSP errors detected in other files:\n<diagnostics file="${file}">\n${limited.map(LSP.Diagnostic.pretty).join("\n")}${suffix}\n</diagnostics>`
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return {
|
|
return {
|