Skip to content

Commit 7d91dec

Browse files
committed
feat(languageFiles): enhance language file loading from workspace folders
Class LanguageFileProcessor#loadLanguageFiles(): +support loading from workspace folders (improves flexibility) Class LanguageFileProcessor#loadLanguageFiles(): +debug logging for directory checks (aids troubleshooting)
1 parent 92d1c98 commit 7d91dec

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

extensions/scripts/src/languageFiles/languageFiles.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,30 @@ export class LanguageFileProcessor {
6262
}
6363
}
6464

65+
if (vscode.workspace.workspaceFolders) {
66+
for (const folder of vscode.workspace.workspaceFolders) {
67+
logger.debug(`Checking workspace folder: ${folder.uri.fsPath}`);
68+
if (folder && (await pathIsDir(folder.uri.fsPath))) {
69+
try {
70+
const tPath = path.join(folder.uri.fsPath, 't');
71+
if (await pathIsDir(tPath)) {
72+
tDirectories.push(tPath);
73+
}
74+
const entries = await fsp.readdir(folder.uri.fsPath, { withFileTypes: true });
75+
for (const dirent of entries) {
76+
if (!dirent.isDirectory()) continue;
77+
const tPath = path.join(folder.uri.fsPath, dirent.name, 't');
78+
if (await pathIsDir(tPath)) {
79+
tDirectories.push(tPath);
80+
}
81+
}
82+
} catch (err) {
83+
logger.info(`Error reading workspace folder '${folder.uri.fsPath}': ${err}`);
84+
}
85+
}
86+
}
87+
}
88+
6589
// Build allowed language set when limiting output
6690
const allowedLanguageIds: Set<string> = new Set<string>(['*']);
6791
if (preferredLanguage) {
@@ -75,6 +99,7 @@ export class LanguageFileProcessor {
7599
const filesToParse: string[] = [];
76100
for (const tDir of tDirectories) {
77101
try {
102+
logger.debug(`Reading directory: ${tDir}`);
78103
const files = await fsp.readdir(tDir);
79104
// Detect wildcard file presence in this directory (0001.xml -> '*')
80105
let hasWildcardInDir = false;

0 commit comments

Comments
 (0)