Skip to content

Commit

Permalink
fix: Loading configuration only in the workspace directory (not trave…
Browse files Browse the repository at this point in the history
…rsing upwards)
  • Loading branch information
DorijanH committed Feb 9, 2024
1 parent 9f377ae commit 4eb4d7a
Showing 1 changed file with 5 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,13 @@ export function loadConfiguration(workspaceFolderPath: string): { categories: st
return null;
}

let currentDirectory = workspaceFolderPath;
const possibleConfigFilePath = path.join(workspaceFolderPath, configurationName);

// Search for the changelog config upwards
while (path.basename(currentDirectory) !== '') {
const possibleConfigFilePath = path.join(currentDirectory, configurationName);
// If the file exists, parse it
if (fs.existsSync(possibleConfigFilePath)) {
const configFile = fs.readFileSync(possibleConfigFilePath, 'utf-8');

// If the file exists, parse it
if (fs.existsSync(possibleConfigFilePath)) {
const configFile = fs.readFileSync(possibleConfigFilePath, 'utf-8');

return JSON.parse(configFile);
}

currentDirectory = path.dirname(currentDirectory);
return JSON.parse(configFile);
}

return undefined;
Expand Down

0 comments on commit 4eb4d7a

Please sign in to comment.