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

Function getWorkspaceFolderPaths

src/shared/vscode/pub.ts:84–102  ·  view source on GitHub ↗
(
	logger: Logger,
	folder: string,
	pubspecContent: string,
)

Source from the content-addressed store, hash-verified

82}
83
84function getWorkspaceFolderPaths(
85 logger: Logger,
86 folder: string,
87 pubspecContent: string,
88): string[] {
89 try {
90 const yaml = YAML.parse(pubspecContent);
91 const workspaceList = yaml.workspace;
92 if (Array.isArray(workspaceList) && workspaceList.every((s: unknown) => typeof s === "string")) {
93 return workspaceList.map((s) => path.join(folder, s));
94 } else {
95 logger.error(`Failed to parse pubspec workspaces, items are not all strings`);
96 return [];
97 }
98 } catch {
99 logger.error(`Failed to parse pubspec workspaces`);
100 return [];
101 }
102}
103
104export function isValidPubGetTarget(folderUri: Uri): { valid: true } | { valid: false, reason: string } {
105 const folderPath = fsPath(folderUri);

Callers 1

getPubPackageStatusFunction · 0.85

Calls 1

errorMethod · 0.65

Tested by

no test coverage detected