From 46a990cd42d2dfeb71135219b9c227c516eed786 Mon Sep 17 00:00:00 2001 From: Ollie Agent Date: Thu, 30 Jul 2026 22:47:27 +0200 Subject: [PATCH] tools/lsp: fix arg field names to match .meta schema Binaries now read path/line/col (matching the .meta schema the model sees) instead of file/line/character. Also fix col to be 1-indexed (matching the schema description) with proper -1 conversion to LSP 0-indexed protocol. --- tools/lsp/cmd/lsp_completion/main.go | 8 ++++---- tools/lsp/cmd/lsp_definition/main.go | 10 +++++----- tools/lsp/cmd/lsp_diagnostics/main.go | 4 ++-- tools/lsp/cmd/lsp_hover/main.go | 8 ++++---- tools/lsp/cmd/lsp_references/main.go | 8 ++++---- tools/lsp/cmd/lsp_rename/main.go | 8 ++++---- tools/lsp/cmd/lsp_symbols/main.go | 4 ++-- 7 files changed, 25 insertions(+), 25 deletions(-) diff --git a/tools/lsp/cmd/lsp_completion/main.go b/tools/lsp/cmd/lsp_completion/main.go index c2b1218..d45f589 100644 --- a/tools/lsp/cmd/lsp_completion/main.go +++ b/tools/lsp/cmd/lsp_completion/main.go @@ -18,16 +18,16 @@ func main() { } var args struct { - File string `json:"file"` + Path string `json:"path"` Line string `json:"line"` - Col string `json:"character"` + Col string `json:"col"` } if err := json.NewDecoder(os.Stdin).Decode(&args); err != nil { fmt.Fprintf(os.Stderr, "error: %v\n", err) os.Exit(1) } - file, _ := filepath.Abs(args.File) + file, _ := filepath.Abs(args.Path) line, _ := strconv.Atoi(args.Line) col, _ := strconv.Atoi(args.Col) @@ -35,7 +35,7 @@ func main() { Method: "completion", File: file, Line: line - 1, - Col: col, + Col: col - 1, }) if err != nil { fmt.Fprintf(os.Stderr, "error: %v\n", err) diff --git a/tools/lsp/cmd/lsp_definition/main.go b/tools/lsp/cmd/lsp_definition/main.go index 45909bb..ee82a83 100644 --- a/tools/lsp/cmd/lsp_definition/main.go +++ b/tools/lsp/cmd/lsp_definition/main.go @@ -21,24 +21,24 @@ func main() { } var args struct { - File string `json:"file"` + Path string `json:"path"` Line string `json:"line"` - Col string `json:"character"` + Col string `json:"col"` } if err := json.NewDecoder(os.Stdin).Decode(&args); err != nil { fmt.Fprintf(os.Stderr, "error: %v\n", err) os.Exit(1) } - file, _ := filepath.Abs(args.File) + file, _ := filepath.Abs(args.Path) line, _ := strconv.Atoi(args.Line) col, _ := strconv.Atoi(args.Col) result, err := lsp.ClientRequest(&lsp.BridgeRequest{ Method: "definition", File: file, - Line: line - 1, // 1-indexed → 0-indexed - Col: col, // already 0-indexed per .meta schema + Line: line - 1, // 1-indexed → 0-indexed + Col: col - 1, // 1-indexed → 0-indexed }) if err != nil { fmt.Fprintf(os.Stderr, "error: %v\n", err) diff --git a/tools/lsp/cmd/lsp_diagnostics/main.go b/tools/lsp/cmd/lsp_diagnostics/main.go index 26be33c..4f2c54a 100644 --- a/tools/lsp/cmd/lsp_diagnostics/main.go +++ b/tools/lsp/cmd/lsp_diagnostics/main.go @@ -17,14 +17,14 @@ func main() { } var args struct { - File string `json:"file"` + Path string `json:"path"` } if err := json.NewDecoder(os.Stdin).Decode(&args); err != nil { fmt.Fprintf(os.Stderr, "error: %v\n", err) os.Exit(1) } - file, _ := filepath.Abs(args.File) + file, _ := filepath.Abs(args.Path) result, err := lsp.ClientRequest(&lsp.BridgeRequest{ Method: "diagnostics", diff --git a/tools/lsp/cmd/lsp_hover/main.go b/tools/lsp/cmd/lsp_hover/main.go index 3abf010..ba97e84 100644 --- a/tools/lsp/cmd/lsp_hover/main.go +++ b/tools/lsp/cmd/lsp_hover/main.go @@ -18,16 +18,16 @@ func main() { } var args struct { - File string `json:"file"` + Path string `json:"path"` Line string `json:"line"` - Col string `json:"character"` + Col string `json:"col"` } if err := json.NewDecoder(os.Stdin).Decode(&args); err != nil { fmt.Fprintf(os.Stderr, "error: %v\n", err) os.Exit(1) } - file, _ := filepath.Abs(args.File) + file, _ := filepath.Abs(args.Path) line, _ := strconv.Atoi(args.Line) col, _ := strconv.Atoi(args.Col) @@ -35,7 +35,7 @@ func main() { Method: "hover", File: file, Line: line - 1, - Col: col, + Col: col - 1, }) if err != nil { fmt.Fprintf(os.Stderr, "error: %v\n", err) diff --git a/tools/lsp/cmd/lsp_references/main.go b/tools/lsp/cmd/lsp_references/main.go index c714edd..bc6b876 100644 --- a/tools/lsp/cmd/lsp_references/main.go +++ b/tools/lsp/cmd/lsp_references/main.go @@ -18,16 +18,16 @@ func main() { } var args struct { - File string `json:"file"` + Path string `json:"path"` Line string `json:"line"` - Col string `json:"character"` + Col string `json:"col"` } if err := json.NewDecoder(os.Stdin).Decode(&args); err != nil { fmt.Fprintf(os.Stderr, "error: %v\n", err) os.Exit(1) } - file, _ := filepath.Abs(args.File) + file, _ := filepath.Abs(args.Path) line, _ := strconv.Atoi(args.Line) col, _ := strconv.Atoi(args.Col) @@ -35,7 +35,7 @@ func main() { Method: "references", File: file, Line: line - 1, - Col: col, + Col: col - 1, }) if err != nil { fmt.Fprintf(os.Stderr, "error: %v\n", err) diff --git a/tools/lsp/cmd/lsp_rename/main.go b/tools/lsp/cmd/lsp_rename/main.go index 48e7afa..aba371d 100644 --- a/tools/lsp/cmd/lsp_rename/main.go +++ b/tools/lsp/cmd/lsp_rename/main.go @@ -20,9 +20,9 @@ func main() { } var args struct { - File string `json:"file"` + Path string `json:"path"` Line string `json:"line"` - Col string `json:"character"` + Col string `json:"col"` NewName string `json:"new_name"` } if err := json.NewDecoder(os.Stdin).Decode(&args); err != nil { @@ -30,7 +30,7 @@ func main() { os.Exit(1) } - file, _ := filepath.Abs(args.File) + file, _ := filepath.Abs(args.Path) line, _ := strconv.Atoi(args.Line) col, _ := strconv.Atoi(args.Col) @@ -38,7 +38,7 @@ func main() { Method: "rename", File: file, Line: line - 1, - Col: col, + Col: col - 1, NewName: args.NewName, }) if err != nil { diff --git a/tools/lsp/cmd/lsp_symbols/main.go b/tools/lsp/cmd/lsp_symbols/main.go index 57c3ea2..a835987 100644 --- a/tools/lsp/cmd/lsp_symbols/main.go +++ b/tools/lsp/cmd/lsp_symbols/main.go @@ -17,7 +17,7 @@ func main() { } var args struct { - File string `json:"file"` + Path string `json:"path"` Query string `json:"query"` } if err := json.NewDecoder(os.Stdin).Decode(&args); err != nil { @@ -25,7 +25,7 @@ func main() { os.Exit(1) } - file, _ := filepath.Abs(args.File) + file, _ := filepath.Abs(args.Path) workspace := args.Query != "" result, err := lsp.ClientRequest(&lsp.BridgeRequest{