File tree Expand file tree Collapse file tree 3 files changed +24
-3
lines changed Expand file tree Collapse file tree 3 files changed +24
-3
lines changed Original file line number Diff line number Diff line change @@ -655,6 +655,7 @@ impl GlobalState {
655
655
. on_sync_mut :: < lsp_ext:: ReloadWorkspace > ( handlers:: handle_workspace_reload)
656
656
. on_sync_mut :: < lsp_ext:: RebuildProcMacros > ( handlers:: handle_proc_macros_rebuild)
657
657
. on_sync_mut :: < lsp_ext:: MemoryUsage > ( handlers:: handle_memory_usage)
658
+ . on_sync_mut :: < lsp_ext:: FetchDependencyGraph > ( handlers:: fetch_dependency_graph)
658
659
. on_sync_mut :: < lsp_ext:: ShuffleCrateGraph > ( handlers:: handle_shuffle_crate_graph)
659
660
. on_sync :: < lsp_ext:: JoinLines > ( handlers:: handle_join_lines)
660
661
. on_sync :: < lsp_ext:: OnEnter > ( handlers:: handle_on_enter)
Original file line number Diff line number Diff line change @@ -4,6 +4,9 @@ import * as fs from "fs";
4
4
import { CtxInit } from "./ctx" ;
5
5
import * as ra from "./lsp_ext" ;
6
6
import { FetchDependencyGraphResult } from "./lsp_ext" ;
7
+ import { Ctx } from "./ctx" ;
8
+ import { setFlagsFromString } from "v8" ;
9
+ import * as ra from "./lsp_ext" ;
7
10
8
11
9
12
@@ -13,9 +16,8 @@ export class RustDependenciesProvider
13
16
14
17
dependenciesMap : { [ id : string ] : Dependency | DependencyFile } ; ctx : CtxInit ;
15
18
16
- constructor (
17
- private readonly workspaceRoot : string , ctx : CtxInit ) {
18
- this . dependenciesMap = { } ;
19
+ constructor ( private readonly workspaceRoot : string , ctx : CtxInit ) {
20
+ this . dependenciesMap = { } ;
19
21
this . ctx = ctx ;
20
22
}
21
23
@@ -78,6 +80,8 @@ export class RustDependenciesProvider
78
80
}
79
81
80
82
private async getRootDependencies ( ) : Promise < Dependency [ ] > {
83
+ const crates = await this . ctx . client . sendRequest ( ra . fetchDependencyGraph , { } ) ;
84
+
81
85
const dependenciesResult : FetchDependencyGraphResult = await this . ctx . client . sendRequest ( ra . fetchDependencyGraph , { } ) ;
82
86
const crates = dependenciesResult . crates ;
83
87
const deps = crates . map ( ( crate ) => {
Original file line number Diff line number Diff line change @@ -86,6 +86,22 @@ export const fetchDependencyGraph = new lc.RequestType<
86
86
void
87
87
> ( "rust-analyzer/fetchDependencyGraph" ) ;
88
88
89
+ export interface FetchDependencyGraphParams { }
90
+
91
+ export interface FetchDependencyGraphResult {
92
+ crates : {
93
+ name : string ;
94
+ version : string ;
95
+ path : string ;
96
+ } [ ] ;
97
+ }
98
+
99
+ export const fetchDependencyGraph = new lc . RequestType <
100
+ FetchDependencyGraphParams ,
101
+ FetchDependencyGraphResult ,
102
+ void
103
+ > ( "rust-analyzer/fetchDependencyGraph" ) ;
104
+
89
105
export type ExpandMacroParams = {
90
106
textDocument : lc . TextDocumentIdentifier ;
91
107
position : lc . Position ;
You can’t perform that action at this time.
0 commit comments