Skip to content

Commit

Permalink
Update config files search (#105)
Browse files Browse the repository at this point in the history
* Using two patterns to match files

* Changelog entry
  • Loading branch information
Razz4780 authored Feb 21, 2024
1 parent 2f8f537 commit f0a0233
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions changelog.d/+available-config-search.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed available configs list (displayed when setting active config) to include files located in `*.mirrord` directories.
10 changes: 8 additions & 2 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,14 @@ export class MirrordConfigManager {
*/
public async selectActiveConfig() {
const options: Map<string, vscode.Uri> = new Map();
const files = await vscode.workspace.findFiles("**/*mirrord.{json,toml,yml,yaml}");
files.forEach(f => options.set(vscode.workspace.asRelativePath(f), f));

const filePatterns = [
"**/*mirrord.{json,toml,yml,yaml}", // known extensions, names ending with `mirrord`
"**/*.mirrord/*.{json,toml,yml,yaml}", // known extensions, located in directories with names ending with `.mirrord`
];

const files = await Promise.all(filePatterns.map(pattern => vscode.workspace.findFiles(pattern)));
files.flat().forEach(file => options.set(vscode.workspace.asRelativePath(file), file));

const displayed = this.active ? ["<unset active config>", ...options.keys()] : [...options.keys()];
const placeHolder = this.active
Expand Down

0 comments on commit f0a0233

Please sign in to comment.