2020-05-25 14:56:26 +02:00
|
|
|
/**
|
2020-08-28 21:55:24 +03:00
|
|
|
* This file mirrors `crates/rust-analyzer/src/lsp_ext.rs` declarations.
|
2020-05-25 14:56:26 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
import * as lc from "vscode-languageclient";
|
|
|
|
|
2020-09-29 22:05:18 +02:00
|
|
|
export interface AnalyzerStatusParams {
|
|
|
|
textDocument?: lc.TextDocumentIdentifier;
|
|
|
|
}
|
|
|
|
export const analyzerStatus = new lc.RequestType<AnalyzerStatusParams, string, void>("rust-analyzer/analyzerStatus");
|
2020-09-17 13:31:42 +03:00
|
|
|
export const memoryUsage = new lc.RequestType0<string, void>("rust-analyzer/memoryUsage");
|
2020-05-25 14:56:26 +02:00
|
|
|
|
2021-04-06 14:16:35 +03:00
|
|
|
export interface ServerStatusParams {
|
2021-04-06 15:50:02 +03:00
|
|
|
health: "ok" | "warning" | "error";
|
|
|
|
quiescent: boolean;
|
|
|
|
message?: string;
|
2020-08-17 14:56:27 +03:00
|
|
|
}
|
2021-04-06 14:16:35 +03:00
|
|
|
export const serverStatus = new lc.NotificationType<ServerStatusParams>("experimental/serverStatus");
|
2020-07-02 12:37:04 +02:00
|
|
|
|
2020-09-17 13:31:42 +03:00
|
|
|
export const reloadWorkspace = new lc.RequestType0<null, void>("rust-analyzer/reloadWorkspace");
|
2020-05-25 14:56:26 +02:00
|
|
|
|
2021-07-25 17:26:54 -04:00
|
|
|
export const hoverRange = new lc.RequestType<HoverRangeParams, lc.Hover | null, void>("rust-analyzer/hoverRange");
|
|
|
|
|
|
|
|
export interface HoverRangeParams {
|
|
|
|
textDocument: lc.TextDocumentIdentifier;
|
|
|
|
range: lc.Range;
|
|
|
|
}
|
|
|
|
|
2020-05-25 14:56:26 +02:00
|
|
|
export interface SyntaxTreeParams {
|
|
|
|
textDocument: lc.TextDocumentIdentifier;
|
|
|
|
range: lc.Range | null;
|
|
|
|
}
|
|
|
|
export const syntaxTree = new lc.RequestType<SyntaxTreeParams, string, void>("rust-analyzer/syntaxTree");
|
|
|
|
|
2020-12-28 18:29:58 +00:00
|
|
|
export const viewHir = new lc.RequestType<lc.TextDocumentPositionParams, string, void>("rust-analyzer/viewHir");
|
2020-05-25 14:56:26 +02:00
|
|
|
|
2021-05-21 23:59:52 +02:00
|
|
|
export interface ViewItemTreeParams {
|
|
|
|
textDocument: lc.TextDocumentIdentifier;
|
|
|
|
}
|
|
|
|
|
|
|
|
export const viewItemTree = new lc.RequestType<ViewItemTreeParams, string, void>("rust-analyzer/viewItemTree");
|
|
|
|
|
2021-07-02 00:08:05 +02:00
|
|
|
export interface ViewCrateGraphParams {
|
|
|
|
full: boolean;
|
|
|
|
}
|
|
|
|
|
|
|
|
export const viewCrateGraph = new lc.RequestType<ViewCrateGraphParams, string, void>("rust-analyzer/viewCrateGraph");
|
2021-05-11 16:15:31 +02:00
|
|
|
|
2020-05-25 14:56:26 +02:00
|
|
|
export interface ExpandMacroParams {
|
|
|
|
textDocument: lc.TextDocumentIdentifier;
|
|
|
|
position: lc.Position;
|
|
|
|
}
|
|
|
|
export interface ExpandedMacro {
|
|
|
|
name: string;
|
|
|
|
expansion: string;
|
|
|
|
}
|
|
|
|
export const expandMacro = new lc.RequestType<ExpandMacroParams, ExpandedMacro | null, void>("rust-analyzer/expandMacro");
|
|
|
|
|
|
|
|
export interface MatchingBraceParams {
|
|
|
|
textDocument: lc.TextDocumentIdentifier;
|
|
|
|
positions: lc.Position[];
|
|
|
|
}
|
|
|
|
export const matchingBrace = new lc.RequestType<MatchingBraceParams, lc.Position[], void>("experimental/matchingBrace");
|
|
|
|
|
2020-05-25 15:55:25 +02:00
|
|
|
export const parentModule = new lc.RequestType<lc.TextDocumentPositionParams, lc.LocationLink[], void>("experimental/parentModule");
|
2020-05-25 14:56:26 +02:00
|
|
|
|
|
|
|
export interface JoinLinesParams {
|
|
|
|
textDocument: lc.TextDocumentIdentifier;
|
|
|
|
ranges: lc.Range[];
|
|
|
|
}
|
|
|
|
export const joinLines = new lc.RequestType<JoinLinesParams, lc.TextEdit[], void>("experimental/joinLines");
|
|
|
|
|
|
|
|
export const onEnter = new lc.RequestType<lc.TextDocumentPositionParams, lc.TextEdit[], void>("experimental/onEnter");
|
|
|
|
|
|
|
|
export interface RunnablesParams {
|
|
|
|
textDocument: lc.TextDocumentIdentifier;
|
|
|
|
position: lc.Position | null;
|
|
|
|
}
|
2020-05-31 05:13:08 +03:00
|
|
|
|
2020-05-25 14:56:26 +02:00
|
|
|
export interface Runnable {
|
|
|
|
label: string;
|
2020-06-02 17:22:23 +02:00
|
|
|
location?: lc.LocationLink;
|
|
|
|
kind: "cargo";
|
|
|
|
args: {
|
|
|
|
workspaceRoot?: string;
|
|
|
|
cargoArgs: string[];
|
2020-09-05 16:21:14 +03:00
|
|
|
cargoExtraArgs: string[];
|
2020-06-02 17:22:23 +02:00
|
|
|
executableArgs: string[];
|
2020-06-27 17:53:50 +02:00
|
|
|
expectTest?: boolean;
|
2020-09-05 16:21:14 +03:00
|
|
|
overrideCargo?: string;
|
2020-06-02 17:22:23 +02:00
|
|
|
};
|
2020-05-25 14:56:26 +02:00
|
|
|
}
|
2020-06-02 17:34:18 +02:00
|
|
|
export const runnables = new lc.RequestType<RunnablesParams, Runnable[], void>("experimental/runnables");
|
2020-05-25 14:56:26 +02:00
|
|
|
|
2021-02-27 20:04:43 +03:00
|
|
|
export interface TestInfo {
|
|
|
|
runnable: Runnable;
|
|
|
|
}
|
|
|
|
|
2021-03-11 17:39:41 +03:00
|
|
|
export const relatedTests = new lc.RequestType<lc.TextDocumentPositionParams, TestInfo[], void>("rust-analyzer/relatedTests");
|
2021-02-27 20:04:43 +03:00
|
|
|
|
2020-05-25 14:56:26 +02:00
|
|
|
export type InlayHint = InlayHint.TypeHint | InlayHint.ParamHint | InlayHint.ChainingHint;
|
|
|
|
|
|
|
|
export namespace InlayHint {
|
|
|
|
export const enum Kind {
|
|
|
|
TypeHint = "TypeHint",
|
|
|
|
ParamHint = "ParameterHint",
|
|
|
|
ChainingHint = "ChainingHint",
|
|
|
|
}
|
|
|
|
interface Common {
|
|
|
|
range: lc.Range;
|
|
|
|
label: string;
|
|
|
|
}
|
|
|
|
export type TypeHint = Common & { kind: Kind.TypeHint };
|
|
|
|
export type ParamHint = Common & { kind: Kind.ParamHint };
|
|
|
|
export type ChainingHint = Common & { kind: Kind.ChainingHint };
|
|
|
|
}
|
|
|
|
export interface InlayHintsParams {
|
|
|
|
textDocument: lc.TextDocumentIdentifier;
|
|
|
|
}
|
|
|
|
export const inlayHints = new lc.RequestType<InlayHintsParams, InlayHint[], void>("rust-analyzer/inlayHints");
|
|
|
|
|
|
|
|
export interface SsrParams {
|
|
|
|
query: string;
|
|
|
|
parseOnly: boolean;
|
2020-07-22 15:00:28 +10:00
|
|
|
textDocument: lc.TextDocumentIdentifier;
|
|
|
|
position: lc.Position;
|
2020-07-29 11:44:01 +10:00
|
|
|
selections: lc.Range[];
|
2020-05-25 14:56:26 +02:00
|
|
|
}
|
|
|
|
export const ssr = new lc.RequestType<SsrParams, lc.WorkspaceEdit, void>('experimental/ssr');
|
2020-06-03 14:15:54 +03:00
|
|
|
|
|
|
|
export interface CommandLink extends lc.Command {
|
|
|
|
/**
|
|
|
|
* A tooltip for the command, when represented in the UI.
|
|
|
|
*/
|
|
|
|
tooltip?: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface CommandLinkGroup {
|
|
|
|
title?: string;
|
|
|
|
commands: CommandLink[];
|
|
|
|
}
|
2020-08-30 20:02:29 +12:00
|
|
|
|
2020-09-01 20:26:10 +12:00
|
|
|
export const openDocs = new lc.RequestType<lc.TextDocumentPositionParams, string | void, void>('experimental/externalDocs');
|
2020-11-12 17:48:07 -08:00
|
|
|
|
|
|
|
export const openCargoToml = new lc.RequestType<OpenCargoTomlParams, lc.Location, void>("experimental/openCargoToml");
|
|
|
|
|
|
|
|
export interface OpenCargoTomlParams {
|
|
|
|
textDocument: lc.TextDocumentIdentifier;
|
|
|
|
}
|
2021-03-16 14:37:00 +02:00
|
|
|
|
2021-04-13 20:32:45 +02:00
|
|
|
export const moveItem = new lc.RequestType<MoveItemParams, lc.TextEdit[], void>("experimental/moveItem");
|
2021-03-16 14:37:00 +02:00
|
|
|
|
|
|
|
export interface MoveItemParams {
|
2021-03-16 17:11:50 +02:00
|
|
|
textDocument: lc.TextDocumentIdentifier;
|
|
|
|
range: lc.Range;
|
|
|
|
direction: Direction;
|
2021-03-16 14:37:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
export const enum Direction {
|
|
|
|
Up = "Up",
|
|
|
|
Down = "Down"
|
|
|
|
}
|