From 2734ffa20c4c38f57bb6808d6cf87d0a8aaf1ea5 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Sat, 7 Mar 2020 14:34:09 +0200 Subject: vscode: remove logging from inlays, run fix lint issues --- editors/code/src/inlay_hints.ts | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) (limited to 'editors/code') diff --git a/editors/code/src/inlay_hints.ts b/editors/code/src/inlay_hints.ts index 6d084362d..d7fabe795 100644 --- a/editors/code/src/inlay_hints.ts +++ b/editors/code/src/inlay_hints.ts @@ -3,7 +3,7 @@ import * as vscode from 'vscode'; import * as ra from './rust-analyzer-api'; import { Ctx, Disposable } from './ctx'; -import { sendRequestWithRetry, isRustDocument, RustDocument, RustEditor, log } from './util'; +import { sendRequestWithRetry, isRustDocument, RustDocument, RustEditor } from './util'; export function activateInlayHints(ctx: Ctx) { @@ -86,7 +86,8 @@ class HintsUpdater implements Disposable { // Set up initial cache shape ctx.visibleRustEditors.forEach(editor => self.sourceFiles.set( - editor.document.uri.toString(), { + editor.document.uri.toString(), + { document: editor.document, inlaysRequest: null, cachedDecorations: null @@ -104,9 +105,8 @@ class HintsUpdater implements Disposable { this.disposables.forEach(d => d.dispose()); } - onDidChangeTextDocument({contentChanges, document}: vscode.TextDocumentChangeEvent) { + onDidChangeTextDocument({ contentChanges, document }: vscode.TextDocumentChangeEvent) { if (contentChanges.length === 0 || !isRustDocument(document)) return; - log.debug(`[inlays]: changed text doc!`); this.syncCacheAndRenderHints(); } @@ -126,7 +126,6 @@ class HintsUpdater implements Disposable { } onDidChangeVisibleTextEditors() { - log.debug(`[inlays]: changed visible text editors`); const newSourceFiles = new Map(); // Rerendering all, even up-to-date editors for simplicity @@ -184,11 +183,7 @@ class HintsUpdater implements Disposable { return decorations; } - lastReqId = 0; private async fetchHints(file: RustSourceFile): Promise { - const reqId = ++this.lastReqId; - - log.debug(`[inlays]: ${reqId} requesting`); file.inlaysRequest?.cancel(); const tokenSource = new vscode.CancellationTokenSource(); @@ -197,18 +192,12 @@ class HintsUpdater implements Disposable { const request = { textDocument: { uri: file.document.uri.toString() } }; return sendRequestWithRetry(this.ctx.client, ra.inlayHints, request, tokenSource.token) - .catch(_ => { - log.debug(`[inlays]: ${reqId} err`); - return null; - }) + .catch(_ => null) .finally(() => { if (file.inlaysRequest === tokenSource) { file.inlaysRequest = null; - log.debug(`[inlays]: ${reqId} got response!`); - } else { - log.debug(`[inlays]: ${reqId} cancelled!`); } - }) + }); } } @@ -227,5 +216,5 @@ interface RustSourceFile { */ cachedDecorations: null | InlaysDecorations; - document: RustDocument + document: RustDocument; } -- cgit v1.2.3