Skip to content

Commit 7bd5ded

Browse files
authored
Remember the choice when asking project selection (#3428)
- Remember the choice when asking project selection - Update @vscode/test-electron to fix macos ci Signed-off-by: Sheng Chen <[email protected]>
1 parent 7ef38c6 commit 7bd5ded

File tree

4 files changed

+50
-169
lines changed

4 files changed

+50
-169
lines changed

package-lock.json

Lines changed: 40 additions & 167 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1678,7 +1678,7 @@
16781678
"@types/vscode": "^1.77.0",
16791679
"@types/winreg": "^1.2.30",
16801680
"@types/winston": "^2.4.4",
1681-
"@vscode/test-electron": "^2.1.5",
1681+
"@vscode/test-electron": "^2.3.8",
16821682
"@typescript-eslint/eslint-plugin": "^5.18.0",
16831683
"@typescript-eslint/parser": "^5.18.0",
16841684
"css-loader": "^6.7.3",

src/buildFilesSelector.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { IBuildTool, getContributedBuildTools } from "./plugin";
55

66
export const PICKED_BUILD_FILES = "java.pickedBuildFiles";
77
export const BUILD_TOOL_FOR_CONFLICTS = "java.buildToolForConflicts";
8+
export const IMPORT_METHOD = "java.importMethod";
89
export class BuildFileSelector {
910
/**
1011
* The build tools that are contributed/supported by extensions.
@@ -295,4 +296,5 @@ interface IBuildFilePicker extends QuickPickItem {
295296
export function cleanupProjectPickerCache(context: ExtensionContext) {
296297
context.workspaceState.update(PICKED_BUILD_FILES, undefined);
297298
context.workspaceState.update(BUILD_TOOL_FOR_CONFLICTS, undefined);
299+
context.workspaceState.update(IMPORT_METHOD, undefined);
298300
}

src/settings.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { cleanupLombokCache } from './lombokSupport';
88
import { ensureExists, getJavaConfiguration } from './utils';
99
import { apiManager } from './apiManager';
1010
import { isActive, setActive, smartSemicolonDetection } from './smartSemicolonDetection';
11-
import { BuildFileSelector, PICKED_BUILD_FILES } from './buildFilesSelector';
11+
import { BuildFileSelector, IMPORT_METHOD, PICKED_BUILD_FILES } from './buildFilesSelector';
1212

1313
const DEFAULT_HIDDEN_FILES: string[] = ['**/.classpath', '**/.project', '**/.settings', '**/.factorypath'];
1414
const IS_WORKSPACE_JDK_ALLOWED = "java.ls.isJdkAllowed";
@@ -370,6 +370,11 @@ export function handleTextDocumentChanges(document: TextDocument, changes: reado
370370
export async function getImportMode(context: ExtensionContext, selector: BuildFileSelector): Promise<ImportMode> {
371371
const mode = getJavaConfiguration().get<string>("import.projectSelection");
372372
if (mode === "manual") {
373+
// use automatic mode if user has selected "Import All" before.
374+
if (context.workspaceState.get(IMPORT_METHOD) === "Import All") {
375+
return ImportMode.automatic;
376+
}
377+
373378
// if no selectable build files, use automatic mode
374379
const hasBuildFiles = await selector.hasBuildFiles();
375380
if (!hasBuildFiles) {
@@ -386,6 +391,7 @@ export async function getImportMode(context: ExtensionContext, selector: BuildFi
386391
{ modal: true },
387392
"Import All", "Let Me Select...");
388393
if (answer === "Import All") {
394+
context.workspaceState.update(IMPORT_METHOD, "Import All");
389395
return ImportMode.automatic;
390396
} else if (answer === "Let Me Select...") {
391397
return ImportMode.manual;

0 commit comments

Comments
 (0)