protected ProjectDom GetParserContext() { CheckInitialized(); IViewContent view = document.Window.ViewContent; string file = view.IsUntitled ? view.UntitledName : view.ContentName; Project project = view.Project; if (project != null) { return(ProjectDomService.GetProjectDom(project)); } else { return(ProjectDomService.GetFileDom(file)); } }
void RunFormatter() { if (PropertyService.Get("OnTheFlyFormatting", false) && textEditorData != null && !(textEditorData.CurrentMode is TextLinkEditMode)) { // textEditorData.Document.TextReplaced -= TextCut; ProjectDom dom = ProjectDomService.GetProjectDom(Document.Project); if (dom == null) { dom = ProjectDomService.GetFileDom(Document.FileName); } DomLocation location = new DomLocation(textEditorData.Caret.Location.Line + (lastCharInserted == '\n' ? -1 : 0), textEditorData.Caret.Location.Column); // CSharpFormatter.Format (textEditorData, dom, Document.CompilationUnit, location); OnTheFlyFormatter.Format(Document, dom, location, lastCharInserted == '\n'); // textEditorData.Document.TextReplaced += TextCut; } }
void RunFormatter() { if (PropertyService.Get("OnTheFlyFormatting", false) && textEditorData != null) { textEditorData.Paste -= TextEditorDataPaste; // textEditorData.Document.TextReplaced -= TextCut; ProjectDom dom = ProjectDomService.GetProjectDom(Document.Project); if (dom == null) { dom = ProjectDomService.GetFileDom(Document.FileName); } DomLocation location = new DomLocation(textEditorData.Caret.Location.Line, textEditorData.Caret.Location.Column); CSharpFormatter.Format(textEditorData, dom, Document.CompilationUnit, location); // OnTheFlyFormatter.Format (textEditorData, dom, location); // textEditorData.Document.TextReplaced += TextCut; textEditorData.Paste += TextEditorDataPaste; } }