Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public void Dispose()
}

public int CreateEditorInstance(uint grfCreateDoc,
string pszMkDocument,
string filePath,
string pszPhysicalView,
IVsHierarchy pvHier,
uint itemid,
Expand All @@ -88,6 +88,12 @@ public int CreateEditorInstance(uint grfCreateDoc,
return VSConstants.VS_E_UNSUPPORTEDFORMAT;
}

if (!_workspace.CurrentSolution.Projects.Any(p => p.AnalyzerConfigDocuments.Any(editorconfig => StringComparer.OrdinalIgnoreCase.Equals(editorconfig.FilePath, filePath))))
{
// 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
return VSConstants.VS_E_UNSUPPORTEDFORMAT;
}

// Validate inputs
if ((grfCreateDoc & (VSConstants.CEF_OPENFILE | VSConstants.CEF_SILENT)) == 0)
{
Expand Down Expand Up @@ -138,7 +144,7 @@ public int CreateEditorInstance(uint grfCreateDoc,
_settingsDataProviderFactory,
_controlProvider,
_tableMangerProvider,
pszMkDocument,
filePath,
textBuffer,
_workspace);
ppunkDocView = Marshal.GetIUnknownForObject(newEditor);
Expand Down