Hanzo
OpenapiLsp

Offers the candidates a language server has at a position, typed and resolved…

Offers the candidates a language server has at a position, typed and resolved through the repository's dependencies rather than guessed from text.

POST /v1/lsp/complete

Addresshttps://api.hanzo.ai/v1/lsp/complete
MethodPOST
Operationpost_lsp_complete
AuthAuthorization: Bearer $HANZO_API_KEY

Offers the candidates a language server has at a position, typed and resolved through the repository's dependencies rather than guessed from text.

Request

6 fields, body application/json (required).

FieldInTypeRequiredDescription
characterbodyintegerCharacter is a 0-based UTF-16 code-unit offset within Line, per the LSP specification — not a byte offset and not a rune index.
linebodyintegerLine is 0-based, per the LSP specification.
pathbodystringPath is the repo-relative file, e.g.
relationbodystringRelation refines locate: definition, reference, type or implementation.
repobodystringRepo is the repository NAME within the caller's own org, e.g. "cloud".
revbodystringRev is a branch, tag or commit sha. Empty means the default branch.

Response

StatusBodyMeaning
200Answerok

200 body — 44 fields.

FieldInTypeAlwaysDescription
coldbodybooleanCold reports that this request paid to PREPARE the revision — the tree write, the dependency fetch and the language server's first index.
completionsbodyCompletion[]Completions is complete's answer: the candidates at the position, typed and resolved through the repository's dependencies rather than guessed from text.
completions[].detailbodystringDetail is the server's short elaboration, typically the type or signature.
completions[].kindbodyintegerKind is the LSP CompletionItemKind number (2 method, 3 function, 5 field, 6 variable, …), passed through as the protocol spells it.
completions[].labelbodystringLabel is the text a client would insert, and what an editor lists.
diagnosticsbodyDiagnostic[]Diagnostics is diagnostics' answer: every problem the server finds in the whole file, position ignored.
diagnostics[].codebodyobjectCode is the checker's own identifier for the rule, a string or a number depending on the server.
diagnostics[].messagebodystringMessage is the problem in the server's own words, meant to be shown.
diagnostics[].rangebodyRange
diagnostics[].range.endbodyPosition
diagnostics[].range.end.characterbodyintegerCharacter is a 0-based UTF-16 code-unit offset within Line, per the LSP specification: not a byte offset and not a rune index.
diagnostics[].range.end.linebodyintegerLine is 0-BASED, per the LSP specification — one less than the line an editor shows a human.
diagnostics[].range.startbodyPosition
diagnostics[].range.start.characterbodyintegerCharacter is a 0-based UTF-16 code-unit offset within Line, per the LSP specification: not a byte offset and not a rune index.
diagnostics[].range.start.linebodyintegerLine is 0-BASED, per the LSP specification — one less than the line an editor shows a human.
diagnostics[].severitybodyintegerSeverity is the LSP's: 1 error, 2 warning, 3 information, 4 hint.
diagnostics[].sourcebodystringSource is which checker reported it ("compiler", "go vet", a linter's name), which is what separates a build error from a style opinion.
hoverbodystringHover is hover's answer: the type and documentation as the language server itself renders them, so it is prose meant to be shown, not parsed.
langbodystringLang is the language the server that answered speaks ("go"), as the daemon reports it.
locationsbodyLocation[]Locations is locate's answer: where the symbol is defined, referenced, typed or implemented, per the relation asked for.
locations[].externalbodybooleanExternal is true when the answer left the repository — the case a static index cannot answer, and the reason this service resolves through dependencies.
locations[].pathbodystringPath is repo-relative while External is false, and the module coordinate ("golang.org/x/[email protected]/semver/semver.go") once it is true.
locations[].rangebodyRange
locations[].range.endbodyPosition
locations[].range.end.characterbodyintegerCharacter is a 0-based UTF-16 code-unit offset within Line, per the LSP specification: not a byte offset and not a rune index.
locations[].range.end.linebodyintegerLine is 0-BASED, per the LSP specification — one less than the line an editor shows a human.
locations[].range.startbodyPosition
locations[].range.start.characterbodyintegerCharacter is a 0-based UTF-16 code-unit offset within Line, per the LSP specification: not a byte offset and not a rune index.
locations[].range.start.linebodyintegerLine is 0-BASED, per the LSP specification — one less than the line an editor shows a human.
opbodystringOp is the question that was asked: hover, locate, symbols, diagnostics or complete.
pathbodystringPath is the repo-relative file the question was about, echoed back.
repobodystringRepo is the repository the question was about, echoed back.
revbodystringRev is the RESOLVED commit sha, never the branch or tag that was asked for.
symbolsbodySymbol[]Symbols is symbols' answer: the file's whole outline, position ignored.
symbols[].detailbodystringDetail is the server's short elaboration, typically the signature.
symbols[].kindbodyintegerKind is the LSP SymbolKind number (5 class, 6 method, 12 function, 23 struct, …), passed through rather than translated to a word — these callers already speak…
symbols[].namebodystringName is the declared identifier.
symbols[].rangebodyRange
symbols[].range.endbodyPosition
symbols[].range.end.characterbodyintegerCharacter is a 0-based UTF-16 code-unit offset within Line, per the LSP specification: not a byte offset and not a rune index.
symbols[].range.end.linebodyintegerLine is 0-BASED, per the LSP specification — one less than the line an editor shows a human.
symbols[].range.startbodyPosition
symbols[].range.start.characterbodyintegerCharacter is a 0-based UTF-16 code-unit offset within Line, per the LSP specification: not a byte offset and not a rune index.
symbols[].range.start.linebodyintegerLine is 0-BASED, per the LSP specification — one less than the line an editor shows a human.

Failure carries the platform error shape — see Errors.

Examples

hanzo has no subcommand for this operation — the CLI serves only what cloud's live route table confirms. Use HTTP or an SDK.


Lsp API · All Hanzo APIs · Interactive reference

How is this guide?

On this page