@@ -9,9 +9,7 @@ export function activateInlayHints(ctx: Ctx) {
9
9
const hintsUpdater = new HintsUpdater ( ctx . client ) ;
10
10
11
11
vscode . window . onDidChangeVisibleTextEditors (
12
- visibleEditors => hintsUpdater . refreshVisibleRustEditors (
13
- visibleEditors . filter ( isRustTextEditor )
14
- ) ,
12
+ ( ) => hintsUpdater . refreshVisibleRustEditors ( ) ,
15
13
null ,
16
14
ctx . subscriptions
17
15
) ;
@@ -21,7 +19,7 @@ export function activateInlayHints(ctx: Ctx) {
21
19
if ( contentChanges . length === 0 ) return ;
22
20
if ( ! isRustTextDocument ( document ) ) return ;
23
21
24
- hintsUpdater . refreshRustDocument ( document ) ;
22
+ hintsUpdater . forceRefreshVisibleRustEditors ( ) ;
25
23
} ,
26
24
null ,
27
25
ctx . subscriptions
@@ -92,7 +90,7 @@ class HintsUpdater {
92
90
this . enabled = enabled ;
93
91
94
92
if ( this . enabled ) {
95
- this . refreshVisibleRustEditors ( vscode . window . visibleTextEditors . filter ( isRustTextEditor ) ) ;
93
+ this . refreshVisibleRustEditors ( ) ;
96
94
} else {
97
95
this . clearHints ( ) ;
98
96
}
@@ -105,20 +103,20 @@ class HintsUpdater {
105
103
}
106
104
}
107
105
108
- refreshRustDocument ( document : RustTextDocument ) {
106
+ forceRefreshVisibleRustEditors ( ) {
109
107
if ( ! this . enabled ) return ;
110
108
111
- const file = this . sourceFiles . getSourceFile ( document . uri . toString ( ) ) ;
112
-
113
- assert ( ! ! file , "Document must be opened in some text editor!" ) ;
114
-
115
- void file . fetchAndRenderHints ( this . client ) ;
109
+ for ( const file of this . sourceFiles ) {
110
+ void file . fetchAndRenderHints ( this . client ) ;
111
+ }
116
112
}
117
113
118
- refreshVisibleRustEditors ( visibleEditors : RustTextEditor [ ] ) {
114
+ refreshVisibleRustEditors ( ) {
119
115
if ( ! this . enabled ) return ;
120
116
121
- const visibleSourceFiles = this . sourceFiles . drainEditors ( visibleEditors ) ;
117
+ const visibleSourceFiles = this . sourceFiles . drainEditors (
118
+ vscode . window . visibleTextEditors . filter ( isRustTextEditor )
119
+ ) ;
122
120
123
121
// Cancel requests for source files whose editors were disposed (leftovers after drain).
124
122
for ( const { inlaysRequest } of this . sourceFiles ) inlaysRequest ?. cancel ( ) ;
0 commit comments