ocaml-lsp
ocaml-lsp copied to clipboard
Documentation query
In the objective of restoring classic Merlin workflows in text-based editors we need a custom query to get a symbol's documentation.
Proposed interface:
Client capability:
export interface GetDocClientCapabilities {
/**
* Client supports the follow content formats if the content
* property refers to a `literal of type MarkupContent`.
* The order describes the preferred format of the client.
*/
contentFormat?: MarkupKind[];
}
Query:
export interface GetDocParams extends TextDocumentPositionParams
{
/**
* An optional identifier. If provided, documentation for this ident
* is looked up from the environment at the given position. Else the
* server will look for the documentation of the identifier under
* the cursor if used.
*/
identifier?:string;
/**
* Optionally override the result's format.
*/
contentFormat?:MarkupKind;
}
Response:
result: GetDoc | null
export interface GetDoc {
/**
* The documentation
*/
doc: MarkupContent;
}
We could also have the format choice be made a part of t capability, but I am not sure this is worth the added complexity ?
A response with null
result is returned of the identifier doesn't have documentation.
An error is returned if the identifier is invalid.