Skip to content

Commit 5dc0e22

Browse files
authored
Read LSP path from environment (#6316)
Allows the user to set `DOTNET_ROSLYN_SERVER_PATH` to an LSP server build, which will override any setting from the vscode instance.
1 parent 23a530a commit 5dc0e22

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/lsptoolshost/roslynLanguageServer.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -782,10 +782,16 @@ export async function activateRoslynLanguageServer(
782782
}
783783

784784
function getServerPath(options: Options, platformInfo: PlatformInformation) {
785-
let serverPath = options.commonOptions.serverPath;
786-
if (!serverPath) {
787-
// Option not set, use the path from the extension.
788-
serverPath = getInstalledServerPath(platformInfo);
785+
let serverPath = process.env.DOTNET_ROSLYN_SERVER_PATH;
786+
787+
if (serverPath) {
788+
_channel.appendLine(`Using server path override from DOTNET_ROSLYN_SERVER_PATH: ${serverPath}`);
789+
} else {
790+
serverPath = options.commonOptions.serverPath;
791+
if (!serverPath) {
792+
// Option not set, use the path from the extension.
793+
serverPath = getInstalledServerPath(platformInfo);
794+
}
789795
}
790796

791797
if (!fs.existsSync(serverPath)) {

0 commit comments

Comments
 (0)