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.
This commit is contained in:
parent
36e42057d4
commit
46a990cd42
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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{
|
||||
|
|
|
|||
Loading…
Reference in New Issue