Skip to content

Commit

Permalink
Merge pull request #1657 from DustinCampbell/project-json-warning
Browse files Browse the repository at this point in the history
Add nag message when project.json projects are opened
  • Loading branch information
DustinCampbell authored Jul 21, 2017
2 parents 762d020 + d9e1fd4 commit c0eee5f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export function activate(context: vscode.ExtensionContext): any {
ensureRuntimeDependencies(extension, logger, reporter)
.then((success : boolean) => {
// activate language services
OmniSharp.activate(context, reporter);
OmniSharp.activate(context, reporter, _channel);

// register JSON completion & hover providers for project.json
context.subscriptions.push(addJSONProviders());
Expand Down
21 changes: 20 additions & 1 deletion src/omnisharp/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import { addAssetsIfNecessary, AddAssetResult } from '../assets';
import { sum, safeLength } from '../common';
import * as utils from './utils';

export function activate(context: vscode.ExtensionContext, reporter: TelemetryReporter) {
export function activate(context: vscode.ExtensionContext, reporter: TelemetryReporter, channel: vscode.OutputChannel) {
const documentSelector: vscode.DocumentSelector = {
language: 'csharp',
scheme: 'file' // only files from disk
Expand Down Expand Up @@ -88,6 +88,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();
});
}
});
}));

// Send telemetry about the sorts of projects the server was started on.
disposables.push(server.onServerStart(() => {
let measures: { [key: string]: number } = {};
Expand Down

0 comments on commit c0eee5f

Please sign in to comment.