@@ -37,13 +37,30 @@ export function resolveRazorLanguageServerOptions(
3737}
3838
3939function findLanguageServerExecutable ( withinDir : string ) {
40- // Prefer using executable over fallback to dll.
41- const fileName = isWindows ( ) ? 'rzls.exe' : 'rzls' ;
42- let fullPath = path . join ( withinDir , fileName ) ;
43- if ( ! fs . existsSync ( fullPath ) ) {
44- fullPath = path . join ( withinDir , 'rzls.dll' ) ;
40+ // On Windows we use the executable, which is "rzls.exe".
41+ // On macOS we use the dll, which is "rzls.dll".
42+ // On everything else we use the executable, which is "rzls".
43+
44+ const fileName = 'rzls' ;
45+ let extension = '' ;
46+
47+ if ( isWindows ( ) ) {
48+ extension = '.exe' ;
49+ }
50+
51+ if ( isMacOS ( ) ) {
52+ // Use the DLL on MacOS to work around signing issue tracked by https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1767519/
53+ extension = '.dll' ;
4554 }
4655
56+ let pathWithExtension = `${ fileName } ${ extension } ` ;
57+ if ( ! fs . existsSync ( pathWithExtension ) ) {
58+ // We might be running a platform neutral vsix which has no executable, instead we run the dll directly.
59+ pathWithExtension = `${ fileName } .dll` ;
60+ }
61+
62+ let fullPath = path . join ( withinDir , pathWithExtension ) ;
63+
4764 if ( ! fs . existsSync ( fullPath ) ) {
4865 throw new Error (
4966 vscode . l10n . t ( "Could not find Razor Language Server executable '{0}' within directory" , fullPath )
@@ -56,3 +73,7 @@ function findLanguageServerExecutable(withinDir: string) {
5673function isWindows ( ) {
5774 return ! ! os . platform ( ) . match ( / ^ w i n / ) ;
5875}
76+
77+ function isMacOS ( ) {
78+ return os . platform ( ) === 'darwin' ;
79+ }
0 commit comments