未验证 提交 4d824587 编写于 作者: D David 提交者: GitHub

Merge pull request #39492 from dotnet/merges/release/dev16.4-to-release/dev16.4-vs-deps

Merge release/dev16.4 to release/dev16.4-vs-deps
......@@ -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.
先完成此消息的编辑!
想要评论请 注册