Skip to content

Commit

Permalink
Merge pull request #1926 from akshita31/toggle_json
Browse files Browse the repository at this point in the history
Added toggle option for project.json warning
  • Loading branch information
akshita31 authored Dec 18, 2017
2 parents 8ca8770 + 6821e60 commit 171338b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 17 deletions.
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.suppressProjectJsonWarning": {
"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>('suppressProjectJsonWarning')) {
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

0 comments on commit 171338b

Please sign in to comment.