Specification
This document describes the extended LSP methods supported by ChatLSP.
For the full LSP specifications, check the Official Page for Language Server Protocol.
textDocument/expectedType
Returns the expected type of an incomplete expression.
Request:
ExpectedTypeParams
defined as follows:
export interface expectedTypeParams extends TextDocumentPositionParams,
WorkDoneProgressParams, PartialResultParams {
}
Response:
ExtectedType
defined as follows:
/**
* The result of an ExpectedType request.
*/
export interface ExpectedType {
/**
* The expected type content
*/
content: MarkupContent;
/**
* The expected type location
*/
location: Location;
}
textDocument/relevantTypes
Returns a list of strings, each representing a type definition that may be relevant at a given cursor location. The returned list contains components that can be used to build up the expected type.
Request:
RelevantTypesParams
defined as follows:
export interface RelevantTypesParams extends TextDocumentPositionParams,
WorkDoneProgressParams, PartialResultParams {
}
Response:
RelevantTypes
defined as follows:
/**
* The result of an RelevantTypes request.
*/
export interface RelevantTypes {
/**
* The list of relevant types contents
*/
contents: MarkupContent[];
/**
* The list of relevant types locations
*/
locations: Location[];
}
textDocument/relevantHeaders
Returns a list of strings, each representing a function header that we can call to return the expected type, or part of it, at a given cursor location.
Request:
RelevantHeadersParams
defined as follows:
export interface RelevantHeadersParams extends TextDocumentPositionParams,
WorkDoneProgressParams, PartialResultParams {
}
Response:
RelevantHeaders
defined as follows:
/**
* The result of an RelevantHeaders request.
*/
export interface RelevantHeaders {
/**
* The list of relevant headers contents
*/
contents: MarkupContent[];
/**
* The list of relevant headers locations
*/
locations: Location[];
}
textDocument/llmCompletion
Works similarly to the previously existing completion method, but uses LLM to complete the code, akin to GitHub copilot. The result is immediately visible in the editor, and users will be able to tab through different completions.
Request:
LLMCompletionParams
defined as follows:
export interface LLMCompletionParams extends TextDocumentPositionParams,
WorkDoneProgressParams, PartialResultParams {
}
Response:
LLMCompletion
defined as follows:
/**
* The result of a LLMCompletion request.
*/
export interface LLMCompletion {
/**
* Completed snippet
*/
snippet: string;
/**
* The context returned by LLM
*/
context: object;
}
textDocument/llmCompletionResolveErrors
Will attempt to resolve incorrect completions by using error rounds, iteratively fixing the generated code by replying with static errors and prompting for a corrected version.
Request:
LLMCompletionResolveErrorsParams
defined as follows:
export interface LLMCompletionResolveErrorsParams extends TextDocumentPositionParams,
WorkDoneProgressParams, PartialResultParams {
}
Response:
LLMCompletionResolveErrors
defined as follows:
/**
* The result of a LLMCompletionResolveErrors request.
*/
export interface LLMCompletionResolveErrors {
/**
* Completed snippet
*/
snippet: string;
/**
* The context returned by LLM
*/
context: object;
}