Skip to content

Commit

Permalink
Pass a semicolon-delimited list of files excluded from VS Code. (#2171)
Browse files Browse the repository at this point in the history
Pass Files.Exclude to omnisharp
  • Loading branch information
Ravi Chande committed May 29, 2019
1 parent 8b02101 commit 3a94a00
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
24 changes: 22 additions & 2 deletions src/omnisharp/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ export class Options {
public razorPluginPath?: string,
public defaultLaunchSolution?: string,
public monoPath?: string,
public maxProjectFileCountForDiagnosticAnalysis?: number | null) { }
public excludePaths?: string[],
public maxProjectFileCountForDiagnosticAnalysis?: number | null)
{
}

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

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

let workspaceConfig = vscode.workspace.getConfiguration();
let excludePaths = [];
if (workspaceConfig)
{
let excludeFilesOption = workspaceConfig.get<{ [i: string]: boolean }>('files.exclude');
if (excludeFilesOption)
{
for (let field in excludeFilesOption) {
if (excludeFilesOption[field]) {
excludePaths.push(field);
}
}
}
}


return new Options(
path,
useGlobalMono,
Expand All @@ -107,7 +126,8 @@ export class Options {
razorPluginPath,
defaultLaunchSolution,
monoPath,
maxProjectFileCountForDiagnosticAnalysis,
excludePaths,
maxProjectFileCountForDiagnosticAnalysis
);
}

Expand Down
7 changes: 6 additions & 1 deletion src/omnisharp/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,11 @@ export class OmniSharpServer {
args.push('--debug');
}

for (let i = 0; i < options.excludePaths.length; i++)
{
args.push(`FileOptions:SystemExcludeSearchPatterns:${i}=${options.excludePaths[i]}`);
}

if (options.enableMsBuildLoadProjectsOnDemand === true) {
args.push('MsBuild:LoadProjectsOnDemand=true');
}
Expand Down Expand Up @@ -356,7 +361,7 @@ export class OmniSharpServer {
}

this._serverProcess = launchResult.process;
this._delayTrackers = {};
this._delayTrackers = {};

await this._doConnect(options);
this._setState(ServerState.Started);
Expand Down

0 comments on commit 3a94a00

Please sign in to comment.