From c4da7035979a70763484157cd869526932525381 Mon Sep 17 00:00:00 2001 From: Jon Janzen Date: Sun, 28 Mar 2021 19:40:39 -0700 Subject: [PATCH] Switch to hhconfigPath config option --- package.json | 6 +++--- src/Config.ts | 2 +- src/Utils.ts | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index c20a1a1..9fb8d25 100755 --- a/package.json +++ b/package.json @@ -196,10 +196,10 @@ "default": "hh_client", "description": "Absolute path to the hh_client executable. This can be left empty if hh_client is already in your environment $PATH." }, - "hack.rootPath": { + "hack.hhconfigPath": { "type": "string", - "default": "", - "description": "Relative path to the directory containing .hhconfig" + "default": ".hhconfig", + "description": "Workspace-relative path to .hhconfig file, the containing directory becomes the Hack Langauge Server root" }, "hack.workspaceRootPath": { "type": "string", diff --git a/src/Config.ts b/src/Config.ts index 8f206db..4f1e8a5 100644 --- a/src/Config.ts +++ b/src/Config.ts @@ -10,7 +10,7 @@ const hackConfig = vscode.workspace.getConfiguration("hack"); // tslint:disable-next-line:no-non-null-assertion export const localWorkspacePath = vscode.workspace.workspaceFolders![0].uri .fsPath; -export const workspaceRelativeRootPath = hackConfig.get("rootPath") || ""; +export const hhconfigPath = hackConfig.get("hhconfigPath") || ".hhconfig"; export let clientPath = hackConfig.get("clientPath") || "hh_client"; clientPath = clientPath.replace("${workspaceFolder}", localWorkspacePath); diff --git a/src/Utils.ts b/src/Utils.ts index 54a6cfe..014015e 100644 --- a/src/Utils.ts +++ b/src/Utils.ts @@ -16,7 +16,8 @@ export const mapFromWorkspaceUri = (file: vscode.Uri): string => { if (config.remoteEnabled && config.remoteWorkspacePath) { workspaceRoot = workspaceRoot.replace(config.localWorkspacePath, config.remoteWorkspacePath); } - return workspaceRoot + "/" + config.workspaceRelativeRootPath; + const workspaceRelativeRoot = config.hhconfigPath.replace(/\.hhconfig$/, "") + return workspaceRoot + "/" + workspaceRelativeRoot.replace(".hhconfig", ""); }; /**