Skip to content

Commit 0b79a73

Browse files
Conditionally load OmniSharp server plugin
1 parent 1bc7abd commit 0b79a73

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/omnisharp/server.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6+
import * as fs from 'fs';
67
import * as path from 'path';
78
import * as protocol from './protocol';
89
import * as utils from '../common';
@@ -305,12 +306,15 @@ export class OmniSharpServer {
305306
];
306307

307308
if (!options.razorDisabled) {
309+
// Razor support only exists for certain platforms, so only load the plugin if present
308310
const razorPluginPath = path.join(
309311
this.extensionPath,
310312
'.razor',
311313
'OmniSharpPlugin',
312314
'Microsoft.AspNetCore.Razor.OmniSharpPlugin.dll');
313-
args.push('--plugin', razorPluginPath);
315+
if (fs.existsSync(razorPluginPath)) {
316+
args.push('--plugin', razorPluginPath);
317+
}
314318
}
315319

316320
if (options.waitForDebugger === true) {

0 commit comments

Comments
 (0)