]> git.lizzy.rs Git - rust.git/commitdiff
Merge #6706
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>
Tue, 8 Dec 2020 13:10:28 +0000 (13:10 +0000)
committerGitHub <noreply@github.com>
Tue, 8 Dec 2020 13:10:28 +0000 (13:10 +0000)
6706: Move import text edit calculation into a completion resolve request r=matklad a=SomeoneToIgnore

Part of https://github.com/rust-analyzer/rust-analyzer/issues/6612 (presumably fixing it)
Part of https://github.com/rust-analyzer/rust-analyzer/issues/6366 (does not cover all possible resolve capabilities we can do)
Closes https://github.com/rust-analyzer/rust-analyzer/issues/6594

Further improves imports on completion performance by deferring the computations for import inserts.

To use the new mode, you have to have the experimental completions enabled and use the LSP 3.16-compliant client that reports `additionalTextEdits` in its `CompletionItemCapabilityResolveSupport` field in the client capabilities.
rust-analyzer VSCode extension does this already hence picks up the changes completely.

Performance implications are descrbed in: https://github.com/rust-analyzer/rust-analyzer/issues/6633#issuecomment-737295182

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
editors/code/src/net.ts

index 9ba17b7b5dba2ffe5802aad95968652fa2902fa5..1ab21e7262dc383f34ff34f14afd1d20e741b545 100644 (file)
@@ -1,7 +1,4 @@
-// Replace with `import fetch from "node-fetch"` once this is fixed in rollup:
-// https://github.com/rollup/plugins/issues/491
-const fetch = require("node-fetch") as typeof import("node-fetch")["default"];
-
+import fetch from "node-fetch";
 import * as vscode from "vscode";
 import * as stream from "stream";
 import * as crypto from "crypto";