Skip to content

Commit 3a94a00

Browse files
author
Ravi Chande
authored
Pass a semicolon-delimited list of files excluded from VS Code. (#2171)
Pass Files.Exclude to omnisharp
1 parent 8b02101 commit 3a94a00

File tree

2 files changed

+28
-3
lines changed

2 files changed

+28
-3
lines changed

src/omnisharp/options.ts

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ export class Options {
2929
public razorPluginPath?: string,
3030
public defaultLaunchSolution?: string,
3131
public monoPath?: string,
32-
public maxProjectFileCountForDiagnosticAnalysis?: number | null) { }
32+
public excludePaths?: string[],
33+
public maxProjectFileCountForDiagnosticAnalysis?: number | null)
34+
{
35+
}
3336

3437
public static Read(vscode: vscode): Options {
3538
// Extra effort is taken below to ensure that legacy versions of options
@@ -84,6 +87,22 @@ export class Options {
8487

8588
const maxProjectFileCountForDiagnosticAnalysis = csharpConfig.get<number | null>('maxProjectFileCountForDiagnosticAnalysis', 1000);
8689

90+
let workspaceConfig = vscode.workspace.getConfiguration();
91+
let excludePaths = [];
92+
if (workspaceConfig)
93+
{
94+
let excludeFilesOption = workspaceConfig.get<{ [i: string]: boolean }>('files.exclude');
95+
if (excludeFilesOption)
96+
{
97+
for (let field in excludeFilesOption) {
98+
if (excludeFilesOption[field]) {
99+
excludePaths.push(field);
100+
}
101+
}
102+
}
103+
}
104+
105+
87106
return new Options(
88107
path,
89108
useGlobalMono,
@@ -107,7 +126,8 @@ export class Options {
107126
razorPluginPath,
108127
defaultLaunchSolution,
109128
monoPath,
110-
maxProjectFileCountForDiagnosticAnalysis,
129+
excludePaths,
130+
maxProjectFileCountForDiagnosticAnalysis
111131
);
112132
}
113133

src/omnisharp/server.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,11 @@ export class OmniSharpServer {
323323
args.push('--debug');
324324
}
325325

326+
for (let i = 0; i < options.excludePaths.length; i++)
327+
{
328+
args.push(`FileOptions:SystemExcludeSearchPatterns:${i}=${options.excludePaths[i]}`);
329+
}
330+
326331
if (options.enableMsBuildLoadProjectsOnDemand === true) {
327332
args.push('MsBuild:LoadProjectsOnDemand=true');
328333
}
@@ -356,7 +361,7 @@ export class OmniSharpServer {
356361
}
357362

358363
this._serverProcess = launchResult.process;
359-
this._delayTrackers = {};
364+
this._delayTrackers = {};
360365

361366
await this._doConnect(options);
362367
this._setState(ServerState.Started);

0 commit comments

Comments
 (0)