aboutsummaryrefslogtreecommitdiff
path: root/editors/code/package.json
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-05-20 09:27:16 +0100
committerGitHub <[email protected]>2021-05-20 09:27:16 +0100
commit8bb37737c9e8b7a390ae29d5fb0daaeeb495d2b5 (patch)
tree0f8d45124abe86151e1954c1766534116e174209 /editors/code/package.json
parent764241e38e46316b6370977e8b51e841e93e84b9 (diff)
parent2bf720900f94e36969af44ff8ac52470faf9af4b (diff)
Merge #8873
8873: Implement import-granularity guessing r=matklad a=Veykril This renames our `MergeBehavior` to `ImportGranularity` as rustfmt has it as the purpose of them are basically the same. `ImportGranularity::Preserve` currently has no specific purpose for us as we don't have an organize imports assist yet, so it currently acts the same as `ImportGranularity::Item`. We now try to guess the import style on a per file basis and fall back to the user granularity setting if the file has no specific style yet or where it is ambiguous. This can be turned off by setting `import.enforceGranularity` to `true`. Closes https://github.com/rust-analyzer/rust-analyzer/issues/8870 Co-authored-by: Lukas Tobias Wirth <[email protected]>
Diffstat (limited to 'editors/code/package.json')
-rw-r--r--editors/code/package.json21
1 files changed, 14 insertions, 7 deletions
diff --git a/editors/code/package.json b/editors/code/package.json
index 99223c4e8..1743b374c 100644
--- a/editors/code/package.json
+++ b/editors/code/package.json
@@ -385,21 +385,28 @@
385 "markdownDescription": "Optional settings passed to the debug engine. Example: `{ \"lldb\": { \"terminal\":\"external\"} }`" 385 "markdownDescription": "Optional settings passed to the debug engine. Example: `{ \"lldb\": { \"terminal\":\"external\"} }`"
386 }, 386 },
387 "$generated-start": false, 387 "$generated-start": false,
388 "rust-analyzer.assist.importMergeBehavior": { 388 "rust-analyzer.assist.importGranularity": {
389 "markdownDescription": "The strategy to use when inserting new imports or merging imports.", 389 "markdownDescription": "How imports should be grouped into use statements.",
390 "default": "crate", 390 "default": "crate",
391 "type": "string", 391 "type": "string",
392 "enum": [ 392 "enum": [
393 "none", 393 "preserve",
394 "crate", 394 "crate",
395 "module" 395 "module",
396 "item"
396 ], 397 ],
397 "enumDescriptions": [ 398 "enumDescriptions": [
398 "Do not merge imports at all.", 399 "Do not change the granularity of any imports and preserve the original structure written by the developer.",
399 "Merge imports from the same crate into a single `use` statement.", 400 "Merge imports from the same crate into a single use statement. Conversely, imports from different crates are split into separate statements.",
400 "Merge imports from the same module into a single `use` statement." 401 "Merge imports from the same module into a single use statement. Conversely, imports from different modules are split into separate statements.",
402 "Flatten imports so that each has its own use statement."
401 ] 403 ]
402 }, 404 },
405 "rust-analyzer.assist.importEnforceGranularity": {
406 "markdownDescription": "Whether to enforce the import granularity setting for all files. If set to false rust-analyzer will try to keep import styles consistent per file.",
407 "default": false,
408 "type": "boolean"
409 },
403 "rust-analyzer.assist.importPrefix": { 410 "rust-analyzer.assist.importPrefix": {
404 "markdownDescription": "The path structure for newly inserted paths to use.", 411 "markdownDescription": "The path structure for newly inserted paths to use.",
405 "default": "plain", 412 "default": "plain",