Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add projectFilesIncludePattern & projectFilesExcludePattern options. #5382

Merged
merged 2 commits into from
Sep 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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