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 toggle option for project.json warning #1926

Merged
merged 11 commits into from
Dec 18, 2017
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,11 @@
"default": false,
"description": "Suppress the notification window to perform a 'dotnet restore' when dependencies can't be resolved."
},
"csharp.suppressProjectDotJsonWarning": {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably don't need the 'Dot' in the option name.

"type": "boolean",
"default": false,
"description": "Suppress the warning that project.json is no longer a supported project format for .NET Core applications"
},
"csharp.suppressHiddenDiagnostics": {
"type": "boolean",
"default": true,
Expand Down
36 changes: 19 additions & 17 deletions src/omnisharp/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,23 +98,25 @@ export function activate(context: vscode.ExtensionContext, reporter: TelemetryRe
}

// After server is started (and projects are loaded), check to see if there are
// any project.json projects. If so, notify the user about migration.
disposables.push(server.onServerStart(() => {
utils.requestWorkspaceInformation(server)
.then(workspaceInfo => {
if (workspaceInfo.DotNet && workspaceInfo.DotNet.Projects.length > 0) {
const shortMessage = 'project.json is no longer a supported project format for .NET Core applications.';
const detailedMessage = "Warning: project.json is no longer a supported project format for .NET Core applications. Update to the latest version of .NET Core (https://aka.ms/netcoredownload) and use 'dotnet migrate' to upgrade your project (see https://aka.ms/netcoremigrate for details).";
const moreDetailItem: vscode.MessageItem = { title: 'More Detail' };

vscode.window.showWarningMessage(shortMessage, moreDetailItem)
.then(item => {
channel.appendLine(detailedMessage);
channel.show();
});
}
});
}));
// any project.json projects if the suppress option is not set. If so, notify the user about migration.
let csharpConfig = vscode.workspace.getConfiguration('csharp');
if (!csharpConfig.get<boolean>('suppressProjectDotJsonWarning')) {
disposables.push(server.onServerStart(() => {
utils.requestWorkspaceInformation(server)
.then(workspaceInfo => {
if (workspaceInfo.DotNet && workspaceInfo.DotNet.Projects.length > 0) {
const shortMessage = 'project.json is no longer a supported project format for .NET Core applications.';
const detailedMessage = "Warning: project.json is no longer a supported project format for .NET Core applications. Update to the latest version of .NET Core (https://aka.ms/netcoredownload) and use 'dotnet migrate' to upgrade your project (see https://aka.ms/netcoremigrate for details).";
const moreDetailItem: vscode.MessageItem = { title: 'More Detail' };
vscode.window.showWarningMessage(shortMessage, moreDetailItem)
.then(item => {
channel.appendLine(detailedMessage);
channel.show();
});
}
});
}));
}

// Send telemetry about the sorts of projects the server was started on.
disposables.push(server.onServerStart(() => {
Expand Down