File tree 2 files changed +11
-6
lines changed
src/tools/rust-analyzer/editors/code/src
2 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -392,14 +392,18 @@ function isCodeActionWithoutEditsAndCommands(value: any): boolean {
392
392
// to proxy around that. We store the last hover's reference command link
393
393
// here, as only one hover can be active at a time, and we don't need to
394
394
// keep a history of these.
395
- export let HOVER_REFERENCE_COMMAND : ra . CommandLink | undefined = undefined ;
395
+ export let HOVER_REFERENCE_COMMAND : ra . CommandLink [ ] = [ ] ;
396
396
397
397
function renderCommand ( cmd : ra . CommandLink ) : string {
398
- HOVER_REFERENCE_COMMAND = cmd ;
399
- return `[${ cmd . title } ](command:rust-analyzer.hoverRefCommandProxy '${ cmd . tooltip } ')` ;
398
+ HOVER_REFERENCE_COMMAND . push ( cmd ) ;
399
+ return `[${ cmd . title } ](command:rust-analyzer.hoverRefCommandProxy?${
400
+ HOVER_REFERENCE_COMMAND . length - 1
401
+ } '${ cmd . tooltip } ')`;
400
402
}
401
403
402
404
function renderHoverActions ( actions : ra . CommandLinkGroup [ ] ) : vscode . MarkdownString {
405
+ // clean up the previous hover ref command
406
+ HOVER_REFERENCE_COMMAND = [ ] ;
403
407
const text = actions
404
408
. map (
405
409
( group ) =>
Original file line number Diff line number Diff line change @@ -1203,9 +1203,10 @@ export function newDebugConfig(ctx: CtxInit): Cmd {
1203
1203
}
1204
1204
1205
1205
export function hoverRefCommandProxy ( _ : Ctx ) : Cmd {
1206
- return async ( ) => {
1207
- if ( HOVER_REFERENCE_COMMAND ) {
1208
- const { command, arguments : args = [ ] } = HOVER_REFERENCE_COMMAND ;
1206
+ return async ( index : number ) => {
1207
+ const link = HOVER_REFERENCE_COMMAND [ index ] ;
1208
+ if ( link ) {
1209
+ const { command, arguments : args = [ ] } = link ;
1209
1210
await vscode . commands . executeCommand ( command , ...args ) ;
1210
1211
}
1211
1212
} ;
You can’t perform that action at this time.
0 commit comments