@@ -21,7 +21,10 @@ const typeHintDecorationType = vscode.window.createTextEditorDecorationType({
21
21
22
22
export class HintsUpdater {
23
23
private displayHints = true ;
24
- private drawnDecorations = new Map < string , vscode . DecorationOptions [ ] > ( ) ;
24
+ private drawnDecorations = new WeakMap <
25
+ vscode . Uri ,
26
+ vscode . DecorationOptions [ ]
27
+ > ( ) ;
25
28
26
29
public async loadHints ( editor ?: vscode . TextEditor ) : Promise < void > {
27
30
if ( this . displayHints ) {
@@ -48,7 +51,7 @@ export class HintsUpdater {
48
51
public async toggleHintsDisplay ( displayHints : boolean ) : Promise < void > {
49
52
if ( this . displayHints !== displayHints ) {
50
53
this . displayHints = displayHints ;
51
- this . drawnDecorations . clear ( ) ;
54
+ this . drawnDecorations = new WeakMap ( ) ;
52
55
53
56
if ( displayHints ) {
54
57
return this . updateHints ( ) ;
@@ -78,7 +81,7 @@ export class HintsUpdater {
78
81
}
79
82
80
83
return await this . updateDecorationsFromServer (
81
- document . uri . toString ( ) ,
84
+ document . uri ,
82
85
editor
83
86
) ;
84
87
}
@@ -88,10 +91,10 @@ export class HintsUpdater {
88
91
}
89
92
90
93
private async updateDecorationsFromServer (
91
- documentUri : string ,
94
+ documentUri : vscode . Uri ,
92
95
editor : TextEditor
93
96
) : Promise < void > {
94
- const newHints = await this . queryHints ( documentUri ) ;
97
+ const newHints = await this . queryHints ( documentUri . toString ( ) ) ;
95
98
if ( newHints != null ) {
96
99
const newDecorations = newHints . map ( hint => ( {
97
100
range : hint . range ,
@@ -127,9 +130,9 @@ export class HintsUpdater {
127
130
) ;
128
131
}
129
132
130
- private getEditorDocumentUri ( editor ?: vscode . TextEditor ) : string | null {
133
+ private getEditorDocumentUri ( editor ?: vscode . TextEditor ) : vscode . Uri | null {
131
134
if ( editor && this . isRustDocument ( editor . document ) ) {
132
- return editor . document . uri . toString ( ) ;
135
+ return editor . document . uri ;
133
136
}
134
137
return null ;
135
138
}
0 commit comments