File tree Expand file tree Collapse file tree 2 files changed +23
-2
lines changed
src/VisualStudio/Core/Def/EditorConfigSettings Expand file tree Collapse file tree 2 files changed +23
-2
lines changed Original file line number Diff line number Diff 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 ) ;
Original file line number Diff line number Diff line change 55using System ;
66using System . ComponentModel . Design ;
77using System . Runtime . InteropServices ;
8+ using System . Threading ;
89using Microsoft . CodeAnalysis ;
910using Microsoft . CodeAnalysis . Editor . EditorConfigSettings ;
1011using Microsoft . CodeAnalysis . Editor . EditorConfigSettings . Data ;
1112using Microsoft . CodeAnalysis . Editor . Shared . Extensions ;
1213using Microsoft . CodeAnalysis . Editor . Shared . Utilities ;
14+ using Microsoft . CodeAnalysis . Host ;
1315using Microsoft . Internal . VisualStudio . PlatformUI ;
1416using Microsoft . Internal . VisualStudio . Shell . TableControl ;
1517using 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 ( ) ,
You can’t perform that action at this time.
0 commit comments