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

Add server path configuration option to the VSCode extension #897

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
5 changes: 5 additions & 0 deletions editors/code/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,11 @@
"scope": "window",
"default": "off"
},
"luau-lsp.server.path": {
"markdownDescription": "Path to the Luau LSP server binary. If not provided, uses the binary included in the extension.",
"type": "string",
"default": ""
},
"luau-lsp.ignoreGlobs": {
"markdownDescription": "Diagnostics will not be reported for any file matching these globs unless the file is currently open",
"type": "array",
Expand Down
26 changes: 21 additions & 5 deletions editors/code/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,27 @@ const startLanguageServer = async (context: vscode.ExtensionContext) => {
}
}

const serverBinPath = vscode.Uri.joinPath(
context.extensionUri,
"bin",
os.platform() === "win32" ? "server.exe" : "server",
).fsPath;
const serverBinConfig = vscode.workspace
.getConfiguration("luau-lsp.server")
.get("path", "");

const uri = vscode.Uri.file(serverBinConfig);
let serverBinPath;

if (await utils.exists(uri)) {
serverBinPath = uri.fsPath;
} else {
if (serverBinConfig !== "") {
vscode.window.showWarningMessage(
`Server binary at path \`${serverBinConfig}\` does not exist, falling back to bundled binary`,
);
}
serverBinPath = vscode.Uri.joinPath(
context.extensionUri,
"bin",
os.platform() === "win32" ? "server.exe" : "server",
).fsPath;
}

const run: Executable = {
command: serverBinPath,
Expand Down