Skip to content

Commit

Permalink
Look up relative paths to the language server in PATH first.
Browse files Browse the repository at this point in the history
  • Loading branch information
paveloom authored and tristan957 committed Nov 22, 2023
1 parent 40d5952 commit d7594cc
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/lsp/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,15 @@ export abstract class LanguageServerClient {

static resolveLanguageServerPath(server: LanguageServer, context: vscode.ExtensionContext): vscode.Uri | null {
const config = vscode.workspace.getConfiguration("mesonbuild");
if (config["languageServerPath"] !== null && config["languageServerPath"] != "")
return vscode.Uri.from({ scheme: "file", path: config["languageServerPath"] });

const configLanguageServerPath = config["languageServerPath"];
if (configLanguageServerPath !== null && configLanguageServerPath != "") {
if (!path.isAbsolute(configLanguageServerPath)) {
const binary = which.sync(configLanguageServerPath, { nothrow: true });
if (binary !== null) return vscode.Uri.from({ scheme: "file", path: binary });
}
return vscode.Uri.from({ scheme: "file", path: configLanguageServerPath });
}

const cached = LanguageServerClient.cachedLanguageServer(server, context);
if (cached !== null) return cached;
Expand Down

0 comments on commit d7594cc

Please sign in to comment.