diff options
Diffstat (limited to 'main/src')
-rw-r--r-- | main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopWorkspace.ProjectSystemHandler.cs | 6 | ||||
-rw-r--r-- | main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ProjectOperations.cs | 9 |
2 files changed, 14 insertions, 1 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopWorkspace.ProjectSystemHandler.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopWorkspace.ProjectSystemHandler.cs index 2e129b53b2..99d5dc5b17 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopWorkspace.ProjectSystemHandler.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopWorkspace.ProjectSystemHandler.cs @@ -488,10 +488,14 @@ namespace MonoDevelop.Ide.TypeSystem if (node == null || !node.Parser.CanGenerateProjection (mimeType, f.BuildAction, p.SupportedLanguages)) return new List<DocumentInfo> (); + var content = TextFileProvider.Instance.GetReadOnlyTextEditorData (f.FilePath, throwOnFileNotFound: false); + if (content == null) + return new List<DocumentInfo> (); + var options = new ParseOptions { FileName = f.FilePath, Project = p, - Content = TextFileProvider.Instance.GetReadOnlyTextEditorData (f.FilePath), + Content = content, }; var generatedProjections = await node.Parser.GenerateProjections (options, token); var list = new List<Projection> (); diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ProjectOperations.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ProjectOperations.cs index 2d37d3ba00..18571ae0c7 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ProjectOperations.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ProjectOperations.cs @@ -2667,6 +2667,11 @@ namespace MonoDevelop.Ide public IReadonlyTextDocument GetReadOnlyTextEditorData (FilePath filePath) { + return GetReadOnlyTextEditorData (filePath, true); + } + + internal IReadonlyTextDocument GetReadOnlyTextEditorData (FilePath filePath, bool throwOnFileNotFound) + { if (filePath.IsNullOrEmpty) throw new ArgumentNullException ("filePath"); foreach (var doc in IdeServices.DocumentManager.Documents) { @@ -2674,6 +2679,10 @@ namespace MonoDevelop.Ide return doc.Editor; } } + + if (!throwOnFileNotFound && !File.Exists (filePath)) + return null; + var data = TextEditorFactory.CreateNewReadonlyDocument (StringTextSource.ReadFrom (filePath), filePath); return data; } |