Skip to content

Commit

Permalink
Merge pull request #5382 from xieyubo/release
Browse files Browse the repository at this point in the history
Add projectFilesIncludePattern & projectFilesExcludePattern options.
  • Loading branch information
JoeRobich authored Sep 23, 2022
2 parents 55bc054 + dc861dc commit 9336244
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1013,6 +1013,11 @@
"default": true,
"description": "Specifies whether the OmniSharp server will be automatically started or not. If false, OmniSharp can be started with the 'Restart OmniSharp' command"
},
"omnisharp.projectFilesExcludePattern" :{
"type": "string",
"default": "**/node_modules/**,**/.git/**,**/bower_components/**",
"description": "The exclude pattern used by OmniSharp to find all project files."
},
"omnisharp.projectLoadTimeout": {
"type": "number",
"default": 60,
Expand Down
2 changes: 1 addition & 1 deletion src/omnisharp/launcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export async function findLaunchTargets(options: Options): Promise<LaunchTarget[

const projectFiles = await vscode.workspace.findFiles(
/*include*/ '{**/*.sln,**/*.slnf,**/*.csproj,**/project.json,**/*.csx,**/*.cake}',
/*exclude*/ '{**/node_modules/**,**/.git/**,**/bower_components/**}');
/*exclude*/ `{${options.projectFilesExcludePattern}}`);

const csFiles = await vscode.workspace.findFiles(
/*include*/ '{**/*.cs}',
Expand Down
3 changes: 3 additions & 0 deletions src/omnisharp/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export class Options {
public waitForDebugger: boolean,
public loggingLevel: string,
public autoStart: boolean,
public projectFilesExcludePattern: string,
public projectLoadTimeout: number,
public maxProjectResults: number,
public useEditorFormattingSettings: boolean,
Expand Down Expand Up @@ -94,6 +95,7 @@ export class Options {

const autoStart = omnisharpConfig.get<boolean>('autoStart', true);

const projectFilesExcludePattern = omnisharpConfig.get<string>('projectFilesExcludePattern', '**/node_modules/**,**/.git/**,**/bower_components/**');
const projectLoadTimeout = omnisharpConfig.get<number>('projectLoadTimeout', 60);
const maxProjectResults = omnisharpConfig.get<number>('maxProjectResults', 250);
const defaultLaunchSolution = omnisharpConfig.get<string>('defaultLaunchSolution', '');
Expand Down Expand Up @@ -157,6 +159,7 @@ export class Options {
waitForDebugger,
loggingLevel,
autoStart,
projectFilesExcludePattern,
projectLoadTimeout,
maxProjectResults,
useEditorFormattingSettings,
Expand Down
1 change: 1 addition & 0 deletions test/unitTests/Fakes/FakeOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export function getEmptyOptions(): Options {
/* waitForDebugger */false,
/* loggingLevel */"",
/* autoStart */false,
/* projectFilesExcludePattern */"",
/* projectLoadTimeout */0,
/* maxProjectResults */0,
/* useEditorFormattingSettings */false,
Expand Down

0 comments on commit 9336244

Please sign in to comment.