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

Added omnisharp.enableMsBuildLoadProjectsOnDemand #2750

Merged
merged 2 commits into from
Dec 18, 2018
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 @@ -675,6 +675,11 @@
"default": false,
"description": "Specifies whether notifications should be shown if OmniSharp encounters warnings or errors loading a project. Note that these warnings/errors are always emitted to the OmniSharp log"
},
"omnisharp.enableMsBuildLoadProjectsOnDemand": {
"type": "boolean",
"default": false,
"description": "If true, MSBuild project system will only load projects for files that were opened in the editor. This setting is useful for big C# codebases and allows for faster initialization of code navigation features only for projects that are relevant to code that is being edited. With this setting enabled OmniSharp may load fewer projects and may thus display incomplete reference lists for symbols."
},
"razor.plugin.path": {
"type": [
"string",
Expand Down
1 change: 1 addition & 0 deletions src/observers/OptionChangeObserver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,6 @@ export function ShowOmniSharpConfigChangePrompt(optionObservable: Observable<Opt
function hasChanged(oldOptions: Options, newOptions: Options): boolean {
return (oldOptions.path != newOptions.path ||
oldOptions.useGlobalMono != newOptions.useGlobalMono ||
oldOptions.enableMsBuildLoadProjectsOnDemand != newOptions.enableMsBuildLoadProjectsOnDemand ||
oldOptions.waitForDebugger != newOptions.waitForDebugger);
}
4 changes: 4 additions & 0 deletions src/omnisharp/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export class Options {
public maxFindSymbolsItems: number,
public razorDisabled: boolean,
public razorDevMode: boolean,
public enableMsBuildLoadProjectsOnDemand: boolean,
public razorPluginPath?: string,
public defaultLaunchSolution?: string,
public monoPath?: string,
Expand Down Expand Up @@ -73,6 +74,8 @@ export class Options {
const minFindSymbolsFilterLength = omnisharpConfig.get<number>('minFindSymbolsFilterLength', 0);
const maxFindSymbolsItems = omnisharpConfig.get<number>('maxFindSymbolsItems', 1000); // The limit is applied only when this setting is set to a number greater than zero

const enableMsBuildLoadProjectsOnDemand = omnisharpConfig.get<boolean>('enableMsBuildLoadProjectsOnDemand', false);

const razorDisabled = !!razorConfig && razorConfig.get<boolean>('disabled', false);
const razorDevMode = !!razorConfig && razorConfig.get<boolean>('devmode', false);
const razorPluginPath = razorConfig ? razorConfig.get<string>('plugin.path', undefined) : undefined;
Expand All @@ -97,6 +100,7 @@ export class Options {
maxFindSymbolsItems,
razorDisabled,
razorDevMode,
enableMsBuildLoadProjectsOnDemand,
razorPluginPath,
defaultLaunchSolution,
monoPath,
Expand Down
4 changes: 4 additions & 0 deletions src/omnisharp/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,10 @@ export class OmniSharpServer {
args.push('--debug');
}

if (options.enableMsBuildLoadProjectsOnDemand === true) {
args.push('MsBuild:LoadProjectsOnDemand=true');
}

let launchInfo: LaunchInfo;
try {
launchInfo = await this._omnisharpManager.GetOmniSharpLaunchInfo(this.packageJSON.defaults.omniSharp, options.path, serverUrl, latestVersionFileServerPath, installPath, this.extensionPath);
Expand Down
2 changes: 1 addition & 1 deletion test/unitTests/Fakes/FakeOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
import { Options } from "../../../src/omnisharp/options";

export function getEmptyOptions(): Options {
return new Options("", "", false, "", false, 0, 0, false, false, false, false, false, false, 0, 0, false, false, undefined, "", "");
return new Options("", "", false, "", false, 0, 0, false, false, false, false, false, false, 0, 0, false, false, false, undefined, "", "");
}
1 change: 1 addition & 0 deletions test/unitTests/OptionObserver/OptionChangeObserver.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ suite("OmniSharpConfigChangeObserver", () => {
[
{ config: "omnisharp", section: "path", value: "somePath" },
{ config: "omnisharp", section: "waitForDebugger", value: true },
{ config: "omnisharp", section: "enableMsBuildLoadProjectsOnDemand", value: true },
{ config: "omnisharp", section: "useGlobalMono", value: "always" }

].forEach(elem => {
Expand Down
3 changes: 2 additions & 1 deletion test/unitTests/optionStream.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ suite('OptionStream', () => {
options.disableCodeActions.should.equal(false);
options.minFindSymbolsFilterLength.should.equal(0);
options.maxFindSymbolsItems.should.equal(1000);
expect(options.defaultLaunchSolution).to.be.undefined;
options.enableMsBuildLoadProjectsOnDemand.should.equal(false);
expect(options.defaultLaunchSolution).to.be.undefined;
});

test('Gives the changed option when the omnisharp config changes', () => {
Expand Down
1 change: 1 addition & 0 deletions test/unitTests/options.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ suite("Options tests", () => {
options.disableCodeActions.should.equal(false);
options.minFindSymbolsFilterLength.should.equal(0);
options.maxFindSymbolsItems.should.equal(1000);
options.enableMsBuildLoadProjectsOnDemand.should.equal(false);
expect(options.defaultLaunchSolution).to.be.undefined;
});

Expand Down