MCPcopy Create free account
hub / github.com/Dart-Code/Dart-Code / warnIfBadConfigSdk

Method warnIfBadConfigSdk

src/extension/sdk/utils.ts:599–612  ·  view source on GitHub ↗
(configSdkPath: string | undefined, foundSdk: SdkSearchResults, sdkConfigName: "dart.sdkPath" | "dart.flutterSdkPath", isWorkspaceSetting: boolean)

Source from the content-addressed store, hash-verified

597 }
598
599 private async warnIfBadConfigSdk(configSdkPath: string | undefined, foundSdk: SdkSearchResults, sdkConfigName: "dart.sdkPath" | "dart.flutterSdkPath", isWorkspaceSetting: boolean): Promise<void> {
600 const foundSdkPath = foundSdk?.originalPath;
601 if (!configSdkPath || !foundSdkPath) return;
602
603 const normalizedConfigSdkPath = path.normalize(path.normalize(configSdkPath).toLowerCase() + path.sep);
604 const normalizedFoundSdkPath = path.normalize(path.normalize(foundSdkPath).toLowerCase() + path.sep);
605
606 if (normalizedConfigSdkPath !== normalizedFoundSdkPath) {
607 const action = await window.showWarningMessage(`The SDK configured in ${sdkConfigName} is not a valid SDK folder: ${configSdkPath}`, openSettingsAction);
608 if (openSettingsAction === action) {
609 await this.openSettingsFile(sdkConfigName, isWorkspaceSetting);
610 }
611 }
612 }
613
614 private async warnIfBadSDKCommandOutput(error: any, workDir: string, sdkConfigName: "dart.getDartSdkCommand" | "dart.getFlutterSdkCommand", isWorkspaceSetting: boolean) {
615 const action = await window.showWarningMessage(`Failed to obtain the SDK from the command: ${error}. Working directory: ${workDir}.`, openSettingsAction);

Callers 1

scanWorkspaceMethod · 0.95

Calls 1

openSettingsFileMethod · 0.95

Tested by

no test coverage detected