Skip to content

Commit a1230e9

Browse files
committed
Added sample recursion depth of 3
1 parent 279d52d commit a1230e9

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ Major update with enhanced workspace setup and user experience improvements:
1010
- **Enhanced workspace setup methods** - Improved workspace configuration and initialization for git repos and folders
1111
- **New West SDK integration** - Updated SDK installation process to use `west sdk` command
1212
- **Improved user guidance** - Better error messages and setup instructions throughout the extension
13+
- Improved finding samples
14+
- Fixed bug in build and update command
1315

1416
## 1.10.1, 1.10.0, 1.9.0
1517
- Incorrect publish version published

src/setup_utilities/modules.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,13 @@ function getSampleRecursive(
163163
moduleName: string,
164164
sampleList: [string, string, string, string][],
165165
visited: Set<string>,
166-
logErrors: boolean = true
166+
logErrors: boolean = true,
167+
depth: number = 0,
168+
maxDepth: number = 8
167169
) {
170+
if (depth > maxDepth) {
171+
return;
172+
}
168173
let realDir: string;
169174
try {
170175
realDir = fs.realpathSync(dir);
@@ -229,7 +234,7 @@ function getSampleRecursive(
229234
if (stat.isSymbolicLink()) {
230235
continue;
231236
}
232-
getSampleRecursive(childPath, moduleName, sampleList, visited, logErrors);
237+
getSampleRecursive(childPath, moduleName, sampleList, visited, logErrors, depth + 1, maxDepth);
233238
}
234239
}
235240
}
@@ -238,8 +243,9 @@ export async function getSamples(setupState: SetupState) {
238243
let samplefolders = await getModuleSampleFolders(setupState);
239244
let sampleList: [string, string, string, string][] = [];
240245
const visited = new Set<string>();
246+
const maxDepth = 3;
241247
for (const folder of samplefolders) {
242-
getSampleRecursive(folder[1], folder[0], sampleList, visited);
248+
getSampleRecursive(folder[1], folder[0], sampleList, visited, true, 0, maxDepth);
243249
}
244250
return sampleList;
245251
}

0 commit comments

Comments
 (0)