@@ -37,13 +37,30 @@ export function resolveRazorLanguageServerOptions(
37
37
}
38
38
39
39
function 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' ;
45
54
}
46
55
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
+ const fullPath = path . join ( withinDir , pathWithExtension ) ;
63
+
47
64
if ( ! fs . existsSync ( fullPath ) ) {
48
65
throw new Error (
49
66
vscode . l10n . t ( "Could not find Razor Language Server executable '{0}' within directory" , fullPath )
@@ -56,3 +73,7 @@ function findLanguageServerExecutable(withinDir: string) {
56
73
function isWindows ( ) {
57
74
return ! ! os . platform ( ) . match ( / ^ w i n / ) ;
58
75
}
76
+
77
+ function isMacOS ( ) {
78
+ return os . platform ( ) === 'darwin' ;
79
+ }
0 commit comments