The LSP provides retrieving inlay hints information with the following request.
Client Capabilities:
InlayHintsClientCapabilities {
/**
* The text document client capabilities
*/
textDocument?: {
/**
* Capabilities specific to the `textDocument/inlayHints`
*/
inlayHints?: {
/**
* Whether implementation supports dynamic registration. If this is set to `true`
* the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)`
* return value for the corresponding server capability as well.
*/
dynamicRegistration?: boolean;
};
}
}Server Capabilities:
InlayHintsServerCapabilities {
/**
* The server provides Inlay Hint support.
*/
inlayHintsProvider?: boolean | (TextDocumentRegistrationOptions & StaticRegistrationOptions);
}Request:
The textDocument/inlayHints request is sent from the client to the server to request the hints for a given
text document.
Returns a collection of hints for the text document.
- method: ‘textDocument/inlayHints'
- params:
InlayHintsParamsdefined as follows:
export interface InlayHintsParams {
/**
* The text document
*/
textDocument: TextDocumentIdentifier;
}Response:
The server will send a collection of InlayHint objects, or null if no hints are found.
Each InlayHint object defines a range and kind corresponding to the hint and a label
to be displayed inline in the editor.
- result:
InlayHint[]|null
export interface InlayHint {
/**
* The source range of the hint.
*/
range: Range;
/**
* The type of hint.
*/
kind: InlayHintKind;
/**
* The label that is displayed the in editor
*/
label: string;
}
/**
* A set of predefined hint kinds
*/
export interface InlayHintKind {
/**
* The hint is for type information
*/
export const TypeHint: InlayHintKind = 'TypeHint';
/**
* The hint corresponds to parameter information
*/
export const ParameterHint: InlayHintKind = 'ParameterHint';
/**
* The hint corresponds to method chaining
*/
export const ChainingHint: InlayHintKind = 'ChainingHint';
}