Skip to content

Commit 504755d

Browse files
authored
Merge pull request #56128 from jmarolf/bugfix/do-not-show-ui-for-external-files
2 parents 2559e9a + a3f82ce commit 504755d

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-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);

0 commit comments

Comments
 (0)