diff options
Diffstat (limited to 'editors/code/src')
| -rw-r--r-- | editors/code/src/dependencies_provider.ts | 10 | ||||
| -rw-r--r-- | editors/code/src/lsp_ext.ts | 16 |
2 files changed, 23 insertions, 3 deletions
diff --git a/editors/code/src/dependencies_provider.ts b/editors/code/src/dependencies_provider.ts index 18a96be1248..f2838af6e06 100644 --- a/editors/code/src/dependencies_provider.ts +++ b/editors/code/src/dependencies_provider.ts @@ -4,6 +4,9 @@ import * as fs from "fs"; import { CtxInit } from "./ctx"; import * as ra from "./lsp_ext"; import { FetchDependencyGraphResult } from "./lsp_ext"; +import { Ctx } from "./ctx"; +import { setFlagsFromString } from "v8"; +import * as ra from "./lsp_ext"; @@ -13,9 +16,8 @@ export class RustDependenciesProvider dependenciesMap: { [id: string]: Dependency | DependencyFile };ctx: CtxInit; - constructor( - private readonly workspaceRoot: string,ctx: CtxInit) { - this.dependenciesMap = {}; + constructor(private readonly workspaceRoot: string,ctx: CtxInit) { + this.dependenciesMap = {}; this.ctx = ctx; } @@ -78,6 +80,8 @@ export class RustDependenciesProvider } private async getRootDependencies(): Promise<Dependency[]> { + const crates = await this.ctx.client.sendRequest(ra.fetchDependencyGraph, {}); + const dependenciesResult: FetchDependencyGraphResult = await this.ctx.client.sendRequest(ra.fetchDependencyGraph, {}); const crates = dependenciesResult.crates; const deps = crates.map((crate) => { diff --git a/editors/code/src/lsp_ext.ts b/editors/code/src/lsp_ext.ts index 1a887b37201..f066a1c6548 100644 --- a/editors/code/src/lsp_ext.ts +++ b/editors/code/src/lsp_ext.ts @@ -86,6 +86,22 @@ export const fetchDependencyGraph = new lc.RequestType< void >("rust-analyzer/fetchDependencyGraph"); +export interface FetchDependencyGraphParams {} + +export interface FetchDependencyGraphResult { + crates: { + name: string; + version: string; + path: string; + }[]; +} + +export const fetchDependencyGraph = new lc.RequestType< + FetchDependencyGraphParams, + FetchDependencyGraphResult, + void +>("rust-analyzer/fetchDependencyGraph"); + export type ExpandMacroParams = { textDocument: lc.TextDocumentIdentifier; position: lc.Position; |
