Skip to content

Commit 2c1656c

Browse files
authored
Merge pull request #56146 from dotnet/merges/release/dev17.0-to-main
Merge release/dev17.0 to main
2 parents c80e7e6 + 504755d commit 2c1656c

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

src/VisualStudio/Core/Def/EditorConfigSettings/SettingsEditorFactory.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public void Dispose()
6363
}
6464

6565
public int CreateEditorInstance(uint grfCreateDoc,
66-
string pszMkDocument,
66+
string filePath,
6767
string pszPhysicalView,
6868
IVsHierarchy pvHier,
6969
uint itemid,
@@ -88,6 +88,12 @@ public int CreateEditorInstance(uint grfCreateDoc,
8888
return VSConstants.VS_E_UNSUPPORTEDFORMAT;
8989
}
9090

91+
if (!_workspace.CurrentSolution.Projects.Any(p => p.AnalyzerConfigDocuments.Any(editorconfig => StringComparer.OrdinalIgnoreCase.Equals(editorconfig.FilePath, filePath))))
92+
{
93+
// If the user is simply opening an editorconfig file that does not apply to the current solution we just want to show the text view
94+
return VSConstants.VS_E_UNSUPPORTEDFORMAT;
95+
}
96+
9197
// Validate inputs
9298
if ((grfCreateDoc & (VSConstants.CEF_OPENFILE | VSConstants.CEF_SILENT)) == 0)
9399
{
@@ -138,7 +144,7 @@ public int CreateEditorInstance(uint grfCreateDoc,
138144
_settingsDataProviderFactory,
139145
_controlProvider,
140146
_tableMangerProvider,
141-
pszMkDocument,
147+
filePath,
142148
textBuffer,
143149
_workspace);
144150
ppunkDocView = Marshal.GetIUnknownForObject(newEditor);

src/VisualStudio/Core/Def/EditorConfigSettings/SettingsEditorPane.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@
55
using System;
66
using System.ComponentModel.Design;
77
using System.Runtime.InteropServices;
8+
using System.Threading;
89
using Microsoft.CodeAnalysis;
910
using Microsoft.CodeAnalysis.Editor.EditorConfigSettings;
1011
using Microsoft.CodeAnalysis.Editor.EditorConfigSettings.Data;
1112
using Microsoft.CodeAnalysis.Editor.Shared.Extensions;
1213
using Microsoft.CodeAnalysis.Editor.Shared.Utilities;
14+
using Microsoft.CodeAnalysis.Host;
1315
using Microsoft.Internal.VisualStudio.PlatformUI;
1416
using Microsoft.Internal.VisualStudio.Shell.TableControl;
1517
using Microsoft.VisualStudio.Editor;
@@ -94,6 +96,19 @@ protected override void Initialize()
9496
}
9597
}
9698

99+
var statusService = _workspace.Services.GetService<IWorkspaceStatusService>();
100+
if (statusService is not null)
101+
{
102+
// This will show the 'Waiting for Intellisense to initalize' message until the workspace is loaded.
103+
_threadingContext.JoinableTaskFactory.Run(async () =>
104+
{
105+
if (!await statusService.IsFullyLoadedAsync(CancellationToken.None).ConfigureAwait(false))
106+
{
107+
await statusService.WaitUntilFullyLoadedAsync(CancellationToken.None).ConfigureAwait(false);
108+
}
109+
});
110+
}
111+
97112
// hook up our panel
98113
_control = new SettingsEditorControl(
99114
GetWhitespaceView(),

0 commit comments

Comments
 (0)