Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed warning when using .mirrord config folder to info. closes #29 #87

Merged
merged 16 commits into from
Jan 3, 2024
Merged
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 24 additions & 23 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,43 +296,44 @@ export class MirrordConfigManager {
if (this.active) {
// User has selected a config (via active config button).
new NotificationBuilder()
.withMessage("using active mirrord configuration")
.withMessage("Using active mirrord configuration.")
.withOpenFileAction(this.active)
.withDisableAction("promptUsingActiveConfig")
.info();

return this.active;
} else if (config.env?.["MIRRORD_CONFIG_FILE"]) {
// Get the config path from the env var.
return vscode.Uri.parse(`file://${config.env?.["MIRRORD_CONFIG_FILE"]}`, true);
const configFromEnv = vscode.Uri.parse(`file://${config.env?.["MIRRORD_CONFIG_FILE"]}`, true);

new NotificationBuilder()
.withMessage(`Using mirrord configuration from env var "MIRRORD_CONFIG_FILE".`)
.withOpenFileAction(configFromEnv)
.withDisableAction("promptUsingActiveConfig")
.info();

return configFromEnv;

} else if (folder) {
let predefinedConfig = await MirrordConfigManager.getDefaultConfig(folder);
if (predefinedConfig) {
const configFromMirrordFolder = await MirrordConfigManager.getDefaultConfig(folder);

if (configFromMirrordFolder) {
new NotificationBuilder()
.withMessage("using a default mirrord config")
.withOpenFileAction(predefinedConfig)
.withMessage(`Using mirrord configuration from ".mirrord" folder.`)
.withOpenFileAction(configFromMirrordFolder)
.withDisableAction("promptUsingDefaultConfig")
.warning();
return predefinedConfig;
.info();

return configFromMirrordFolder;
} else {
return null;
}
} else {
folder = vscode.workspace.workspaceFolders?.[0];
if (!folder) {
throw new Error("mirrord requires an open folder in the workspace");
}
new NotificationBuilder()
.withMessage(`mirrord could not find a configuration file! Try using the "Settings" button or the "Select active config" button to generate/select a mirrord config file.`)
.warning();

let predefinedConfig = await MirrordConfigManager.getDefaultConfig(folder);
if (predefinedConfig) {
new NotificationBuilder()
.withMessage(`using a default mirrord config from folder ${folder.name} `)
.withOpenFileAction(predefinedConfig)
.withDisableAction("promptUsingDefaultConfig")
.warning();
return predefinedConfig;
} else {
return null;
}
return null;
}
}
}