make lsp better

This commit is contained in:
Dax Raad
2025-06-06 17:20:01 -04:00
parent b32cb2b932
commit d6afebf22a
9 changed files with 38 additions and 21 deletions

View File

@@ -90,7 +90,7 @@ export const EditTool = Tool.define({
FileTimes.read(ctx.sessionID, filepath)
let output = ""
await LSP.file(filepath)
await LSP.touchFile(filepath, true)
const diagnostics = await LSP.diagnostics()
for (const [file, issues] of Object.entries(diagnostics)) {
if (issues.length === 0) continue

View File

@@ -16,7 +16,7 @@ export const LspDiagnosticTool = Tool.define({
const normalized = path.isAbsolute(args.path)
? args.path
: path.join(app.path.cwd, args.path)
await LSP.file(normalized)
await LSP.touchFile(normalized, true)
const diagnostics = await LSP.diagnostics()
const file = diagnostics[normalized]
return {

View File

@@ -18,12 +18,12 @@ export const LspHoverTool = Tool.define({
const file = path.isAbsolute(args.file)
? args.file
: path.join(app.path.cwd, args.file)
await LSP.file(file)
await LSP.touchFile(file, true)
const result = await LSP.hover({
...args,
file,
})
console.log(result)
return {
metadata: {
result,

View File

@@ -88,7 +88,7 @@ export const ReadTool = Tool.define({
output += "\n</file>"
// just warms the lsp client
LSP.file(filePath)
await LSP.touchFile(filePath, true)
FileTimes.read(ctx.sessionID, filePath)
return {

View File

@@ -43,7 +43,7 @@ export const WriteTool = Tool.define({
FileTimes.read(ctx.sessionID, filepath)
let output = ""
await LSP.file(filepath)
await LSP.touchFile(filepath, true)
const diagnostics = await LSP.diagnostics()
for (const [file, issues] of Object.entries(diagnostics)) {
if (issues.length === 0) continue