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 nag message when project.json projects are opened #1657

Merged
merged 2 commits into from
Jul 21, 2017
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
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) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Will this fire for the old PCL projects that use project.json for dependencies but still have a .csproj? Do you want to deprecate those as well?

Copy link
Member Author

Choose a reason for hiding this comment

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

No. Just for project.json files that are handled as projects.

const shortMessage = 'project.json is no longer a supported project format for .NET Core applications.';
Copy link
Contributor

Choose a reason for hiding this comment

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

You have MSWord style quotes in this string. Expected?

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm... I'm not spotting them

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, somehow got this comment on the wrong line. See ‘dotnet migrate’.

Copy link
Member Author

Choose a reason for hiding this comment

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

FWIW, my phone was hiding them and printing normal quotes. Good catch!

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