diff --git a/src/extension.ts b/src/extension.ts index b59b1f3..87f5d72 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -6,12 +6,8 @@ import { LanguageClientOptions, ServerOptions, TransportKind, - WorkspaceFolder, } from "vscode-languageclient/node"; import { getHelmLsExecutable } from "./util/executable"; -import path from "path"; -import fs from "fs"; -import url from "url"; let client: LanguageClient; @@ -25,27 +21,10 @@ export async function activate(_: vscode.ExtensionContext) { console.log("Launching " + helmLsExecutable); - const workSpacePath = vscode.workspace.workspaceFolders?.[0].uri.path; - const filePath = vscode.window.activeTextEditor?.document.fileName; - var cwd: string = workSpacePath ?? ""; - - console.log("Workspace path: " + workSpacePath, "File path: " + filePath); - if (workSpacePath && fs.existsSync(path.join(workSpacePath, "Chart.yaml"))) { - console.log("Setting cwd to " + workSpacePath); - cwd = workSpacePath - } - else if (filePath) { - console.log("Setting cwd to " + traversePathUpToChartYaml(filePath)); - cwd = traversePathUpToChartYaml(filePath) - } - const executable: Executable = { command: helmLsExecutable, args: ["serve"], transport: TransportKind.stdio, - options: { - cwd: cwd - } }; const serverOptions: ServerOptions = { @@ -55,12 +34,7 @@ export async function activate(_: vscode.ExtensionContext) { const clientOptions: LanguageClientOptions = { documentSelector: [{ scheme: "file", language: "helm" }], - synchronize: {}, - workspaceFolder: { - uri: vscode.Uri.file(cwd), - name: vscode.workspace.workspaceFolders?.[0].name ?? "", - index: 0 - } + synchronize: {} }; client = new LanguageClient( @@ -80,14 +54,3 @@ export function deactivate(): Thenable | undefined { } return client.stop(); } - -function traversePathUpToChartYaml(directory: string): string { - if (fs.existsSync(path.join(directory, "Chart.yaml"))) { - return directory - } - const parent = path.dirname(directory) - if (parent === "/") { - return "" - } - return traversePathUpToChartYaml(parent) -}