summaryrefslogtreecommitdiff
path: root/editors
diff options
context:
space:
mode:
authorCarlyle <hack366@pm.me>2025-01-03 18:26:50 -0800
committerCarlyle <hack366@pm.me>2025-01-03 18:26:50 -0800
commit9c43bf48981c5079db80d0372176ecf49b3b87a4 (patch)
treeb2ab1f18c85b984279456302101ffd0cf76335b0 /editors
parentc45b8c9382611a2fad6ef4f90c94e07798883aeb (diff)
improved the starting configuration dialog
Diffstat (limited to 'editors')
-rw-r--r--editors/vscode/src/extension.ts33
1 files changed, 21 insertions, 12 deletions
diff --git a/editors/vscode/src/extension.ts b/editors/vscode/src/extension.ts
index 8e675b2..ae776f8 100644
--- a/editors/vscode/src/extension.ts
+++ b/editors/vscode/src/extension.ts
@@ -113,31 +113,40 @@ export async function activate(context: vscode.ExtensionContext) {
ctx.registerCommand("runDebugTest", runDebugTest);
ctx.registerCommand("runTest", runTest);
- const olsFile = path.join(workspaceFolder.uri.fsPath, "ols.json");
-
- fs.access(olsFile, constants.F_OK).catch(async err => {
- if (err) {
+ const projectConfigPath = path.join(workspaceFolder.uri.fsPath, "ols.json");
+ const userConfigPath = path.join(path.dirname(serverPath), "ols.json");
+ fs.access(projectConfigPath, constants.F_OK).catch(async (_e1) => {
+ fs.access(userConfigPath, constants.F_OK).catch( async (_e2) => {
if (!config.askCreateOLS) {
return;
}
const userResponse = await vscode.window.showInformationMessage(
- "No ols config file in the workspace root folder. Do you wish to create one?",
+ "No ols config file found. Do you wish to create one?",
"Yes",
"No",
- "Don't ask again"
+ "Don't ask again",
);
if (userResponse === "Yes") {
- createOrEditProjectConfig();
+ const clarification = await vscode.window.showInformationMessage(
+ "should it be specific to this project or to all your odin projects?",
+ "This project",
+ "All projects",
+ );
+ if (clarification == "This project") {
+ createOrEditProjectConfig();
+ parseOlsFile(config, projectConfigPath);
+ } else {
+ createOrEditUserConfig(serverPath);
+ parseOlsFile(config, userConfigPath);
+ }
} else if (userResponse === "Don't ask again") {
config.updateAskCreateOLS(false);
return;
}
-
- }
- parseOlsFile(config, olsFile);
+ })
});
if(!isOdinInstalled()) {
@@ -167,8 +176,8 @@ export async function activate(context: vscode.ExtensionContext) {
client.start();
- parseOlsFile(config, olsFile);
- watchOlsConfigFile(ctx, olsFile);
+ parseOlsFile(config, projectConfigPath);
+ watchOlsConfigFile(ctx, projectConfigPath);
}
async function bootstrap(config: Config, state: PersistentState): Promise<string> {