public SourceFileData(SourceFileSet sourceFileSet, string file) { this.SourceFileSet = sourceFileSet; this.Path = file; this.TextView = null; this.NeedsCompilation = true; }
private SourceFileSet FindSourceFileSet(string file, bool createIfMissing) { // Find the SourceFileSet that has a given file... SourceFileSet sourceFileSet = this.sourceFileSets.FirstOrDefault(set => set.HasSourceFile(file)); if (sourceFileSet == null && createIfMissing) { // The crazy try/catch/try/finally is to keep StyleCop from thinking we're going to missing // calling Dispose on an exception. sourceFileSet = new SourceFileSet(file); try { sourceFileSet.AddSourceFiles(this.GetContextFiles(file)); this.sourceFileSets.Add(sourceFileSet); sourceFileSet.SetClosed += SourceFileSet_SetClosed; sourceFileSet.CompileComplete += SourceFileSet_CompileComplete; } catch (Exception) { try { sourceFileSet.SetClosed -= SourceFileSet_SetClosed; sourceFileSet.CompileComplete -= SourceFileSet_CompileComplete; this.sourceFileSets.Remove(sourceFileSet); } finally { sourceFileSet.Dispose(); } } } return(sourceFileSet); }
private IEnumerable <PackageItem> GetCompilationContext(string file) { string fullPath = Path.GetFullPath(file); SourceFileSet sourceFileSet = this.FindSourceFileSet(fullPath, true); // Note that we *don't* compile here... we just use the existing items from our background compile. return(sourceFileSet.Items); }
void SourceFileSet_SetClosed(object sender, EventArgs e) { SourceFileSet sourceFileSet = sender as SourceFileSet; sourceFileSet.SetClosed -= SourceFileSet_SetClosed; sourceFileSet.CompileComplete -= SourceFileSet_CompileComplete; this.sourceFileSets.Remove(sourceFileSet); sourceFileSet.Dispose(); this.UpdateErrorList(); }
public SourceFileData FindSourceFileData(string file) { SourceFileSet sourceFileSet = this.FindSourceFileSet(file); if (sourceFileSet != null) { return(sourceFileSet.FindSourceFile(file)); } return(null); }
public void AddTextView(ITextView textView) { ITextDocument textDocument; if (!this.TextDocumentFactoryService.TryGetTextDocument(textView.TextBuffer, out textDocument)) { throw new Exception("Could not find ITextDocument from textView!"); } string fullPath = Path.GetFullPath(textDocument.FilePath); SourceFileSet sourceFileSet = this.FindSourceFileSet(fullPath, true); sourceFileSet.AttachTextView(fullPath, textView); sourceFileSet.CompileAsync(); }