未验证 提交 3f6bece0 编写于 作者: M Manish Vasani 提交者: GitHub

Merge pull request #39473 from mavasani/FixEditorConfigGoldBar

Ensure that we show the gold bar for .editorconfig as solution item o…
......@@ -32,6 +32,7 @@ internal partial class AnalyzerConfigDocumentAsSolutionItemHandler : IDisposable
private readonly IThreadingContext _threadingContext;
private DTE? _dte;
private bool _infoBarShownForCurrentSolution;
[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
......@@ -57,9 +58,23 @@ void IDisposable.Dispose()
private void OnWorkspaceChanged(object sender, WorkspaceChangeEventArgs e)
{
// Check if a new analyzer config document was added and we have a non-null DTE instance.
if (e.Kind != WorkspaceChangeKind.AnalyzerConfigDocumentAdded ||
_dte == null)
switch (e.Kind)
{
case WorkspaceChangeKind.SolutionAdded:
_infoBarShownForCurrentSolution = false;
return;
// Check if a new analyzer config document was added
case WorkspaceChangeKind.AnalyzerConfigDocumentAdded:
break;
default:
return;
}
// Bail out if we have a null DTE instance or we have already shown the info bar for current solution.
if (_dte == null ||
_infoBarShownForCurrentSolution)
{
return;
}
......@@ -93,10 +108,14 @@ private void OnWorkspaceChanged(object sender, WorkspaceChangeEventArgs e)
return;
}
var infoBarService = _workspace.Services.GetRequiredService<IInfoBarService>();
infoBarService.ShowInfoBarInGlobalView(
ServicesVSResources.A_new_editorconfig_file_was_detected_at_the_root_of_your_solution_Would_you_like_to_make_it_a_solution_item,
GetInfoBarUIItems().ToArray());
if (!_infoBarShownForCurrentSolution)
{
_infoBarShownForCurrentSolution = true;
var infoBarService = _workspace.Services.GetRequiredService<IInfoBarService>();
infoBarService.ShowInfoBarInGlobalView(
ServicesVSResources.A_new_editorconfig_file_was_detected_at_the_root_of_your_solution_Would_you_like_to_make_it_a_solution_item,
GetInfoBarUIItems().ToArray());
}
});
return;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册