From 64f7072c255bd97a58b8344d0beeae281b8f7e13 Mon Sep 17 00:00:00 2001 From: Lukas Tobias Wirth Date: Tue, 18 May 2021 19:49:15 +0200 Subject: MergeBehavior -> ImportGranularity --- editors/code/package.json | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'editors/code') diff --git a/editors/code/package.json b/editors/code/package.json index 2e67b6775..81179ff9b 100644 --- a/editors/code/package.json +++ b/editors/code/package.json @@ -385,19 +385,21 @@ "markdownDescription": "Optional settings passed to the debug engine. Example: `{ \"lldb\": { \"terminal\":\"external\"} }`" }, "$generated-start": false, - "rust-analyzer.assist.importMergeBehavior": { - "markdownDescription": "The strategy to use when inserting new imports or merging imports.", - "default": "crate", + "rust-analyzer.assist.importGranularity": { + "markdownDescription": "How imports should be grouped into use statements.", + "default": "preserve", "type": "string", "enum": [ - "none", + "preserve", "crate", - "module" + "module", + "item" ], "enumDescriptions": [ - "Do not merge imports at all.", - "Merge imports from the same crate into a single `use` statement.", - "Merge imports from the same module into a single `use` statement." + "Do not change the granularity of any imports and preserve the original structure written by the developer.", + "Merge imports from the same crate into a single use statement. Conversely, imports from different crates are split into separate statements.", + "Merge imports from the same module into a single use statement. Conversely, imports from different modules are split into separate statements.", + "Flatten imports so that each has its own use statement." ] }, "rust-analyzer.assist.importPrefix": { -- cgit v1.2.3 From 5fd9f6c7b9944638e4781e3d9384638942f84456 Mon Sep 17 00:00:00 2001 From: Lukas Tobias Wirth Date: Tue, 18 May 2021 20:21:47 +0200 Subject: Add ImportGranularity::Guess --- editors/code/package.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'editors/code') diff --git a/editors/code/package.json b/editors/code/package.json index 81179ff9b..06ce86987 100644 --- a/editors/code/package.json +++ b/editors/code/package.json @@ -387,15 +387,17 @@ "$generated-start": false, "rust-analyzer.assist.importGranularity": { "markdownDescription": "How imports should be grouped into use statements.", - "default": "preserve", + "default": "guess", "type": "string", "enum": [ + "guess", "preserve", "crate", "module", "item" ], "enumDescriptions": [ + "Try to guess the granularity of imports on a per module basis by observing the existing imports.", "Do not change the granularity of any imports and preserve the original structure written by the developer.", "Merge imports from the same crate into a single use statement. Conversely, imports from different crates are split into separate statements.", "Merge imports from the same module into a single use statement. Conversely, imports from different modules are split into separate statements.", -- cgit v1.2.3 From b4fe479236f592fcbfa1422dda54253b77d8b0e1 Mon Sep 17 00:00:00 2001 From: Lukas Tobias Wirth Date: Tue, 18 May 2021 20:21:47 +0200 Subject: Replace ImportGranularity::Guess with guessing boolean flag --- editors/code/package.json | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'editors/code') diff --git a/editors/code/package.json b/editors/code/package.json index 06ce86987..48d12b35a 100644 --- a/editors/code/package.json +++ b/editors/code/package.json @@ -387,23 +387,26 @@ "$generated-start": false, "rust-analyzer.assist.importGranularity": { "markdownDescription": "How imports should be grouped into use statements.", - "default": "guess", + "default": "crate", "type": "string", "enum": [ - "guess", "preserve", "crate", "module", "item" ], "enumDescriptions": [ - "Try to guess the granularity of imports on a per module basis by observing the existing imports.", "Do not change the granularity of any imports and preserve the original structure written by the developer.", "Merge imports from the same crate into a single use statement. Conversely, imports from different crates are split into separate statements.", "Merge imports from the same module into a single use statement. Conversely, imports from different modules are split into separate statements.", "Flatten imports so that each has its own use statement." ] }, + "rust-analyzer.assist.importEnforceGranularity": { + "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.", + "default": false, + "type": "boolean" + }, "rust-analyzer.assist.importPrefix": { "markdownDescription": "The path structure for newly inserted paths to use.", "default": "plain", -- cgit v1.2.3