@@ -3,7 +3,7 @@ import * as vscode from 'vscode';
3
3
import * as ra from './rust-analyzer-api' ;
4
4
5
5
import { Ctx , Disposable } from './ctx' ;
6
- import { sendRequestWithRetry , isRustDocument , RustDocument , RustEditor , log } from './util' ;
6
+ import { sendRequestWithRetry , isRustDocument , RustDocument , RustEditor } from './util' ;
7
7
8
8
9
9
export function activateInlayHints ( ctx : Ctx ) {
@@ -86,7 +86,8 @@ class HintsUpdater implements Disposable {
86
86
87
87
// Set up initial cache shape
88
88
ctx . visibleRustEditors . forEach ( editor => self . sourceFiles . set (
89
- editor . document . uri . toString ( ) , {
89
+ editor . document . uri . toString ( ) ,
90
+ {
90
91
document : editor . document ,
91
92
inlaysRequest : null ,
92
93
cachedDecorations : null
@@ -104,9 +105,8 @@ class HintsUpdater implements Disposable {
104
105
this . disposables . forEach ( d => d . dispose ( ) ) ;
105
106
}
106
107
107
- onDidChangeTextDocument ( { contentChanges, document} : vscode . TextDocumentChangeEvent ) {
108
+ onDidChangeTextDocument ( { contentChanges, document } : vscode . TextDocumentChangeEvent ) {
108
109
if ( contentChanges . length === 0 || ! isRustDocument ( document ) ) return ;
109
- log . debug ( `[inlays]: changed text doc!` ) ;
110
110
this . syncCacheAndRenderHints ( ) ;
111
111
}
112
112
@@ -126,7 +126,6 @@ class HintsUpdater implements Disposable {
126
126
}
127
127
128
128
onDidChangeVisibleTextEditors ( ) {
129
- log . debug ( `[inlays]: changed visible text editors` ) ;
130
129
const newSourceFiles = new Map < string , RustSourceFile > ( ) ;
131
130
132
131
// Rerendering all, even up-to-date editors for simplicity
@@ -184,11 +183,7 @@ class HintsUpdater implements Disposable {
184
183
return decorations ;
185
184
}
186
185
187
- lastReqId = 0 ;
188
186
private async fetchHints ( file : RustSourceFile ) : Promise < null | ra . InlayHint [ ] > {
189
- const reqId = ++ this . lastReqId ;
190
-
191
- log . debug ( `[inlays]: ${ reqId } requesting` ) ;
192
187
file . inlaysRequest ?. cancel ( ) ;
193
188
194
189
const tokenSource = new vscode . CancellationTokenSource ( ) ;
@@ -197,18 +192,12 @@ class HintsUpdater implements Disposable {
197
192
const request = { textDocument : { uri : file . document . uri . toString ( ) } } ;
198
193
199
194
return sendRequestWithRetry ( this . ctx . client , ra . inlayHints , request , tokenSource . token )
200
- . catch ( _ => {
201
- log . debug ( `[inlays]: ${ reqId } err` ) ;
202
- return null ;
203
- } )
195
+ . catch ( _ => null )
204
196
. finally ( ( ) => {
205
197
if ( file . inlaysRequest === tokenSource ) {
206
198
file . inlaysRequest = null ;
207
- log . debug ( `[inlays]: ${ reqId } got response!` ) ;
208
- } else {
209
- log . debug ( `[inlays]: ${ reqId } cancelled!` ) ;
210
199
}
211
- } )
200
+ } ) ;
212
201
}
213
202
}
214
203
@@ -227,5 +216,5 @@ interface RustSourceFile {
227
216
*/
228
217
cachedDecorations : null | InlaysDecorations ;
229
218
230
- document : RustDocument
219
+ document : RustDocument ;
231
220
}
0 commit comments