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 'Learn more' to miscellaneous files warning. #7654

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
1 change: 1 addition & 0 deletions l10n/bundle.l10n.json
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@
"C# configuration has changed. Would you like to reload the window to apply your changes?": "C# configuration has changed. Would you like to reload the window to apply your changes?",
"Nested Code Action": "Nested Code Action",
"Fix All: ": "Fix All: ",
"Learn more": "Learn more",
"The active document is not part of the open workspace. Not all language features will be available.": "The active document is not part of the open workspace. Not all language features will be available.",
"Dismiss": "Dismiss",
"Do not show for this workspace": "Do not show for this workspace",
Expand Down
2 changes: 2 additions & 0 deletions src/lsptoolshost/languageStatusBar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { languageServerOptions } from '../shared/options';
import { ServerState } from './serverStateChange';
import { getCSharpDevKit } from '../utils/getCSharpDevKit';
import { RazorLanguage } from '../razor/src/razorLanguage';
import { LearnMoreAboutMiscellaneousFilesCommand } from './miscellaneousFileNotifier';

export function registerLanguageStatusItems(
context: vscode.ExtensionContext,
Expand Down Expand Up @@ -91,6 +92,7 @@ class ProjectContextStatus {
'The active document is not part of the open workspace. Not all language features will be available.'
)
: vscode.l10n.t('Active File Context');
item.command = e.context._vs_is_miscellaneous ? LearnMoreAboutMiscellaneousFilesCommand : undefined;
});

// Trigger a refresh, but don't block creation on the refresh completing.
Expand Down
12 changes: 11 additions & 1 deletion src/lsptoolshost/miscellaneousFileNotifier.ts
Copy link
Member

Choose a reason for hiding this comment

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

@webreidi would you vet the learn link below? It currently takes you to the VS page. If we want a custom page that has potential ways to fix like "go restore your project", we should introduce a new page. For that, we may also need an understanding of common reasons why a file might go into miscellaneous.

Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ import { languageServerOptions } from '../shared/options';
const SuppressMiscellaneousFilesToastsOption = 'dotnet.server.suppressMiscellaneousFilesToasts';
const NotifiedDocuments = new Set<string>();

export const LearnMoreAboutMiscellaneousFilesCommand = {
command: 'vscode.open',
title: vscode.l10n.t('Learn more'),
arguments: [
vscode.Uri.parse(
'https://learn.microsoft.com/en-us/visualstudio/ide/reference/miscellaneous-files?view=vs-2022'
),
],
};

export function registerMiscellaneousFileNotifier(
context: vscode.ExtensionContext,
languageServer: RoslynLanguageServer
Expand Down Expand Up @@ -50,7 +60,7 @@ export function registerMiscellaneousFileNotifier(
context.workspaceState.update(SuppressMiscellaneousFilesToastsOption, true);
},
};
showWarningMessage(vscode, message, dismissItem, disableWorkspace);
showWarningMessage(vscode, message, dismissItem, disableWorkspace, LearnMoreAboutMiscellaneousFilesCommand);
});
}

Expand Down
Loading