@@ -644,12 +644,10 @@ export async function activateRoslynLanguageServer(
644
644
}
645
645
646
646
function getServerPath ( options : Options , platformInfo : PlatformInformation ) {
647
- const clientRoot = __dirname ;
648
-
649
647
let serverPath = options . commonOptions . serverPath ;
650
648
if ( ! serverPath ) {
651
649
// Option not set, use the path from the extension.
652
- serverPath = path . join ( clientRoot , '..' , '.roslyn' , getServerFileName ( platformInfo ) ) ;
650
+ serverPath = getInstalledServerPath ( platformInfo ) ;
653
651
}
654
652
655
653
if ( ! fs . existsSync ( serverPath ) ) {
@@ -659,8 +657,10 @@ function getServerPath(options: Options, platformInfo: PlatformInformation) {
659
657
return serverPath ;
660
658
}
661
659
662
- function getServerFileName ( platformInfo : PlatformInformation ) {
663
- const serverFileName = 'Microsoft.CodeAnalysis.LanguageServer' ;
660
+ function getInstalledServerPath ( platformInfo : PlatformInformation ) {
661
+ const clientRoot = __dirname ;
662
+ const serverFilePath = path . join ( clientRoot , '..' , '.roslyn' , 'Microsoft.CodeAnalysis.LanguageServer' ) ;
663
+
664
664
let extension = '' ;
665
665
if ( platformInfo . isWindows ( ) ) {
666
666
extension = '.exe' ;
@@ -673,7 +673,13 @@ function getServerFileName(platformInfo: PlatformInformation) {
673
673
extension = '.dll' ;
674
674
}
675
675
676
- return `${ serverFileName } ${ extension } ` ;
676
+ let pathWithExtension = `${ serverFilePath } ${ extension } ` ;
677
+ if ( ! fs . existsSync ( pathWithExtension ) ) {
678
+ // We might be running a platform neutral vsix which has no executable, instead we run the dll directly.
679
+ pathWithExtension = `${ serverFilePath } .dll` ;
680
+ }
681
+
682
+ return pathWithExtension ;
677
683
}
678
684
679
685
function registerRazorCommands ( context : vscode . ExtensionContext , languageServer : RoslynLanguageServer ) {
0 commit comments