@@ -6,7 +6,7 @@ import { Logger, Sdks, SdkSearchResults, WorkspaceConfig, WritableWorkspaceConfi
66import { flatMap , isDartSdkFromFlutter , notUndefined } from "../../shared/utils" ;
77import { extractFlutterSdkPathFromPackagesFile , fsPath , getSdkVersion , hasPubspec , projectReferencesFlutterSdk } from "../../shared/utils/fs" ;
88import { resolvedPromise } from "../../shared/utils/promises" ;
9- import { processBazelWorkspace , processFuchsiaWorkspace , processKnownGitRepositories } from "../../shared/utils/workspace" ;
9+ import { processBazelWorkspace , processDartSdkRepository , processFuchsiaWorkspace } from "../../shared/utils/workspace" ;
1010import { envUtils , getAllProjectFolders , getDartWorkspaceFolders } from "../../shared/vscode/utils" ;
1111import { WorkspaceContext } from "../../shared/workspace" ;
1212import { Analytics } from "../analytics" ;
@@ -230,7 +230,7 @@ export class SdkUtils {
230230 return undefined ;
231231 } ;
232232
233- await processWorkspaceType ( findGitRoot , processKnownGitRepositories ) ;
233+ await processWorkspaceType ( findDartSdkRoot , processDartSdkRepository ) ;
234234 // TODO: Remove this lambda when the preview flag is removed.
235235 await processWorkspaceType ( findBazelWorkspaceRoot , ( l , c , b ) => processBazelWorkspace ( l , c , b , config . previewBazelWorkspaceCustomScripts ) ) ;
236236 const fuchsiaRoot = await processWorkspaceType ( findFuchsiaRoot , processFuchsiaWorkspace ) ;
@@ -467,6 +467,14 @@ async function findGitRoot(logger: Logger, folder: string): Promise<string | und
467467 return findRootContaining ( folder , ".git" ) ;
468468}
469469
470+ async function findDartSdkRoot ( logger : Logger , folder : string ) : Promise < string | undefined > {
471+ const gitRoot = await findGitRoot ( logger , folder ) ;
472+ if ( gitRoot && fs . existsSync ( path . join ( gitRoot , "README.dart-sdk" ) ) && fs . existsSync ( path . join ( gitRoot , "DEPS" ) ) )
473+ return gitRoot ;
474+ else
475+ return undefined ;
476+ }
477+
470478function findRootContaining ( folder : string , childName : string , expectFile = false ) : string | undefined {
471479 if ( folder ) {
472480 // Walk up the directories from the workspace root, and see if there
0 commit comments