Skip to content

Commit 2734ffa

Browse files
author
Veetaha
committed
vscode: remove logging from inlays, run fix lint issues
1 parent ef52fd5 commit 2734ffa

File tree

1 file changed

+7
-18
lines changed

1 file changed

+7
-18
lines changed

editors/code/src/inlay_hints.ts

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as vscode from 'vscode';
33
import * as ra from './rust-analyzer-api';
44

55
import { Ctx, Disposable } from './ctx';
6-
import { sendRequestWithRetry, isRustDocument, RustDocument, RustEditor, log } from './util';
6+
import { sendRequestWithRetry, isRustDocument, RustDocument, RustEditor } from './util';
77

88

99
export function activateInlayHints(ctx: Ctx) {
@@ -86,7 +86,8 @@ class HintsUpdater implements Disposable {
8686

8787
// Set up initial cache shape
8888
ctx.visibleRustEditors.forEach(editor => self.sourceFiles.set(
89-
editor.document.uri.toString(), {
89+
editor.document.uri.toString(),
90+
{
9091
document: editor.document,
9192
inlaysRequest: null,
9293
cachedDecorations: null
@@ -104,9 +105,8 @@ class HintsUpdater implements Disposable {
104105
this.disposables.forEach(d => d.dispose());
105106
}
106107

107-
onDidChangeTextDocument({contentChanges, document}: vscode.TextDocumentChangeEvent) {
108+
onDidChangeTextDocument({ contentChanges, document }: vscode.TextDocumentChangeEvent) {
108109
if (contentChanges.length === 0 || !isRustDocument(document)) return;
109-
log.debug(`[inlays]: changed text doc!`);
110110
this.syncCacheAndRenderHints();
111111
}
112112

@@ -126,7 +126,6 @@ class HintsUpdater implements Disposable {
126126
}
127127

128128
onDidChangeVisibleTextEditors() {
129-
log.debug(`[inlays]: changed visible text editors`);
130129
const newSourceFiles = new Map<string, RustSourceFile>();
131130

132131
// Rerendering all, even up-to-date editors for simplicity
@@ -184,11 +183,7 @@ class HintsUpdater implements Disposable {
184183
return decorations;
185184
}
186185

187-
lastReqId = 0;
188186
private async fetchHints(file: RustSourceFile): Promise<null | ra.InlayHint[]> {
189-
const reqId = ++this.lastReqId;
190-
191-
log.debug(`[inlays]: ${reqId} requesting`);
192187
file.inlaysRequest?.cancel();
193188

194189
const tokenSource = new vscode.CancellationTokenSource();
@@ -197,18 +192,12 @@ class HintsUpdater implements Disposable {
197192
const request = { textDocument: { uri: file.document.uri.toString() } };
198193

199194
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)
204196
.finally(() => {
205197
if (file.inlaysRequest === tokenSource) {
206198
file.inlaysRequest = null;
207-
log.debug(`[inlays]: ${reqId} got response!`);
208-
} else {
209-
log.debug(`[inlays]: ${reqId} cancelled!`);
210199
}
211-
})
200+
});
212201
}
213202
}
214203

@@ -227,5 +216,5 @@ interface RustSourceFile {
227216
*/
228217
cachedDecorations: null | InlaysDecorations;
229218

230-
document: RustDocument
219+
document: RustDocument;
231220
}

0 commit comments

Comments
 (0)