mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-04-03 15:43:45 +00:00
make lsp better
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user