/** * This file mirrors `crates/rust-analyzer/src/lsp_ext.rs` declarations. */ import * as lc from "vscode-languageclient"; export interface AnalyzerStatusParams { textDocument?: lc.TextDocumentIdentifier; } export const analyzerStatus = new lc.RequestType( "rust-analyzer/analyzerStatus" ); export const memoryUsage = new lc.RequestType0("rust-analyzer/memoryUsage"); export const shuffleCrateGraph = new lc.RequestType0("rust-analyzer/shuffleCrateGraph"); export interface ServerStatusParams { health: "ok" | "warning" | "error"; quiescent: boolean; message?: string; } export const serverStatus = new lc.NotificationType( "experimental/serverStatus" ); export const openServerLogs = new lc.NotificationType0("rust-analyzer/openServerLogs"); export const reloadWorkspace = new lc.RequestType0("rust-analyzer/reloadWorkspace"); export const hover = new lc.RequestType("textDocument/hover"); export interface HoverParams extends lc.WorkDoneProgressParams { textDocument: lc.TextDocumentIdentifier; position: lc.Range | lc.Position; } export interface SyntaxTreeParams { textDocument: lc.TextDocumentIdentifier; range: lc.Range | null; } export const syntaxTree = new lc.RequestType( "rust-analyzer/syntaxTree" ); export const viewHir = new lc.RequestType( "rust-analyzer/viewHir" ); export const viewFileText = new lc.RequestType( "rust-analyzer/viewFileText" ); export interface ViewItemTreeParams { textDocument: lc.TextDocumentIdentifier; } export const viewItemTree = new lc.RequestType( "rust-analyzer/viewItemTree" ); export interface ViewCrateGraphParams { full: boolean; } export const viewCrateGraph = new lc.RequestType( "rust-analyzer/viewCrateGraph" ); export interface ExpandMacroParams { textDocument: lc.TextDocumentIdentifier; position: lc.Position; } export interface ExpandedMacro { name: string; expansion: string; } export const expandMacro = new lc.RequestType( "rust-analyzer/expandMacro" ); export const relatedTests = new lc.RequestType( "rust-analyzer/relatedTests" ); export const cancelFlycheck = new lc.NotificationType0("rust-analyzer/cancelFlycheck"); export const clearFlycheck = new lc.NotificationType0("rust-analyzer/clearFlycheck"); export const runFlycheck = new lc.NotificationType<{ textDocument: lc.TextDocumentIdentifier | null; }>("rust-analyzer/runFlycheck"); // Experimental extensions export interface SsrParams { query: string; parseOnly: boolean; textDocument: lc.TextDocumentIdentifier; position: lc.Position; selections: readonly lc.Range[]; } export const ssr = new lc.RequestType("experimental/ssr"); export interface MatchingBraceParams { textDocument: lc.TextDocumentIdentifier; positions: lc.Position[]; } export const matchingBrace = new lc.RequestType( "experimental/matchingBrace" ); export const parentModule = new lc.RequestType< lc.TextDocumentPositionParams, lc.LocationLink[] | null, void >("experimental/parentModule"); export interface JoinLinesParams { textDocument: lc.TextDocumentIdentifier; ranges: lc.Range[]; } export const joinLines = new lc.RequestType( "experimental/joinLines" ); export const onEnter = new lc.RequestType( "experimental/onEnter" ); export interface RunnablesParams { textDocument: lc.TextDocumentIdentifier; position: lc.Position | null; } export interface Runnable { label: string; location?: lc.LocationLink; kind: "cargo"; args: { workspaceRoot?: string; cargoArgs: string[]; cargoExtraArgs: string[]; executableArgs: string[]; expectTest?: boolean; overrideCargo?: string; }; } export const runnables = new lc.RequestType( "experimental/runnables" ); export interface TestInfo { runnable: Runnable; } 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[]; } export const openDocs = new lc.RequestType( "experimental/externalDocs" ); export const openCargoToml = new lc.RequestType( "experimental/openCargoToml" ); export interface OpenCargoTomlParams { textDocument: lc.TextDocumentIdentifier; } export const moveItem = new lc.RequestType( "experimental/moveItem" ); export interface MoveItemParams { textDocument: lc.TextDocumentIdentifier; range: lc.Range; direction: Direction; } export const enum Direction { Up = "Up", Down = "Down", }