本文整理汇总了C#中ParsedDocument类的典型用法代码示例。如果您正苦于以下问题:C# ParsedDocument类的具体用法?C# ParsedDocument怎么用?C# ParsedDocument使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ParsedDocument类属于命名空间,在下文中一共展示了ParsedDocument类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RefillOutlineStore
//copied from MoonlightEditorExtension
#region Document outline
protected override void RefillOutlineStore (ParsedDocument doc, Gtk.TreeStore store)
{
XDocument xdoc = ((MonoDevelop.Xml.Editor.XmlParsedDocument)doc).XDocument;
if (xdoc == null)
return;
// Gtk.TreeIter iter = outlineTreeStore.AppendValues (System.IO.Path.GetFileName (CU.Document.FilePath), p);
BuildTreeChildren (store, Gtk.TreeIter.Zero, xdoc);
}
示例2: before_each_test_setup
public void before_each_test_setup()
{
TargetContainer = new SummarizationInformationContainer();
TargetParsedDocument = new ParsedDocument();
TargetParsedDocument.Sentences = new List<Sentence>()
{
TargetContainer.sentence
};
TargetContentAnalyzer = Substitute.For<IContentAnalyzer>();
TargetContentAnalyzer.GetImportantTextUnits(Arg.Any<List<Sentence>>()).Returns(TargetContainer.scoredTextUnits);
TargetContentAnalyzer.ScoreSentences(Arg.Any<List<Sentence>>(), Arg.Any<List<TextUnitScore>>()).Returns(TargetContainer.scoredSentences);
}
示例3: Initialize
public override void Initialize ()
{
base.Initialize ();
Parser parser = new Parser (CreateRootState (), false);
tracker = new DocumentStateTracker<Parser> (parser, Editor);
Document.DocumentParsed += delegate {
lastCU = Document.ParsedDocument;
OnParsedDocumentUpdated ();
};
if (Document.ParsedDocument != null) {
lastCU = Document.ParsedDocument;
OnParsedDocumentUpdated ();
}
}
示例4: SearchMember
IEnumerable<DomRegion> SearchMember (IEntity member, ITypeResolveContext dom, FilePath fileName, Mono.TextEditor.TextEditorData editor, Mono.TextEditor.TextDocument buildDocument, List<LocalDocumentInfo.OffsetInfo> offsetInfos, ParsedDocument parsedDocument)
{ // TODO: Type system conversion.
yield break;
// var resolver = new NRefactoryResolver (dom, parsedDocument.CompilationUnit, ICSharpCode.OldNRefactory.SupportedLanguage.CSharp, editor, fileName);
//
// var visitor = new FindMemberAstVisitor (buildDocument, member);
// visitor.IncludeXmlDocumentation = IncludeDocumentation;
// visitor.RunVisitor (resolver);
//
// foreach (var result in visitor.FoundReferences) {
// var offsetInfo = offsetInfos.FirstOrDefault (info => info.ToOffset <= result.Position && result.Position < info.ToOffset + info.Length);
// if (offsetInfo == null)
// continue;
// var offset = offsetInfo.FromOffset + result.Position - offsetInfo.ToOffset;
// var loc = editor.OffsetToLocation (offset);
// yield return new DomRegion (fileName, loc.Line, loc.Column, loc.Line, loc.Column + result.Name.Lenhth);
// }
}
示例5: Initialize
public override void Initialize ()
{
base.Initialize ();
UpdateOwnerProjects ();
Parser parser = new Parser (CreateRootState (), false);
tracker = new DocumentStateTracker<Parser> (parser, Editor);
Document.DocumentParsed += delegate {
lastCU = Document.ParsedDocument;
OnParsedDocumentUpdated ();
};
if (Document.ParsedDocument != null) {
lastCU = Document.ParsedDocument;
OnParsedDocumentUpdated ();
}
if (IdeApp.Workspace != null) {
IdeApp.Workspace.FileAddedToProject += HandleProjectChanged;
IdeApp.Workspace.FileRemovedFromProject += HandleProjectChanged;
}
}
示例6: RefillOutlineStore
protected virtual void RefillOutlineStore (ParsedDocument doc, TreeStore store)
{
XDocument xdoc = ((XmlParsedDocument)doc).XDocument;
if (xdoc == null)
return;
BuildTreeChildren (store, TreeIter.Zero, xdoc);
}
示例7: UpdateParsedDocument
void UpdateParsedDocument (object sender, EventArgs args)
{
lastCU = DocumentContext.ParsedDocument;
OnParsedDocumentUpdated ();
}
示例8: Initialize
protected override void Initialize ()
{
base.Initialize ();
// Delay the execution of UpdateOwnerProjects since it may end calling Document.AttachToProject,
// which shouldn't be called while the extension chain is being initialized.
// TODO: Move handling of owner projects to Document
Application.Invoke (delegate {
UpdateOwnerProjects ();
});
var parser = new XmlParser (CreateRootState (), false);
tracker = new DocumentStateTracker<XmlParser> (parser, Editor);
DocumentContext.DocumentParsed += UpdateParsedDocument;
Editor.CaretPositionChanged += HandleCaretPositionChanged;
if (DocumentContext.ParsedDocument != null) {
lastCU = DocumentContext.ParsedDocument;
OnParsedDocumentUpdated ();
}
if (IdeApp.Workspace != null) {
IdeApp.Workspace.FileAddedToProject += HandleProjectChanged;
IdeApp.Workspace.FileRemovedFromProject += HandleProjectChanged;
}
}
示例9: ImportSymbolCompletionData
public ImportSymbolCompletionData (MonoDevelop.Ide.Gui.Document doc, ImportSymbolCache cache, IType type)
{
this.doc = doc;
this.cache = cache;
// this.data = doc.Editor;
this.ambience = AmbienceService.GetAmbience (doc.Editor.MimeType);
this.type = type;
this.unit = doc.ParsedDocument;
}
示例10: UpdateDocumentOutline
void UpdateDocumentOutline (object sender, EventArgs args)
{
lastCU = Document.ParsedDocument;
//limit update rate to 3s
if (!refreshingOutline) {
refreshingOutline = true;
refillOutlineStoreId = GLib.Timeout.Add (3000, RefillOutlineStore);
}
}
示例11: SetParsedDocument
internal void SetParsedDocument (ParsedDocument newDocument, bool runInThread)
{
this.parsedDocument = newDocument;
if (parsedDocument == null || parseInformationUpdaterWorkerThread == null)
return;
StopParseInfoThread ();
if (runInThread) {
parseInformationUpdaterWorkerThread.RunWorkerAsync (parsedDocument);
} else {
HandleParseInformationUpdaterWorkerThreadDoWork (null, new DoWorkEventArgs (parsedDocument));
}
}
示例12: throws_if_null_arguments_are_passed
public void throws_if_null_arguments_are_passed(ParsedDocument parsedDocument,
IContentAnalyzer contentAnalyzer)
{
Assert.Throws<ArgumentNullException>(
() => { Target.AnalyzeParsedContent(parsedDocument, contentAnalyzer); });
}
示例13: MDRefactoringContext
public MDRefactoringContext (DotNetProject project, TextEditorData data, ParsedDocument parsedDocument, CSharpAstResolver resolver, TextLocation loc, CancellationToken cancellationToken = default (CancellationToken)) : base (resolver, cancellationToken)
{
this.TextEditor = data;
this.ParsedDocument = parsedDocument;
this.Project = project;
var policy = Project.Policies.Get<CSharpFormattingPolicy> ();
this.formattingOptions = policy.CreateOptions ();
this.location = loc;
var namingPolicy = Project.Policies.Get<NameConventionPolicy> ();
Services.AddService (typeof(NamingConventionService), namingPolicy.CreateNRefactoryService ());
}
示例14: HandleParseInformationUpdaterWorkerThreadDoWork
void HandleParseInformationUpdaterWorkerThreadDoWork (bool firstTime, ParsedDocument parsedDocument, CancellationToken token = default(CancellationToken))
{
var doc = Document;
if (doc == null || parsedDocument == null)
return;
UpdateErrorUndelines (parsedDocument);
if (!options.ShowFoldMargin)
return;
// don't update parsed documents that contain errors - the foldings from there may be invalid.
if (parsedDocument.HasErrors)
return;
try {
List<FoldSegment > foldSegments = new List<FoldSegment> ();
bool updateSymbols = parsedDocument.Defines.Count != symbols.Count;
if (!updateSymbols) {
foreach (PreProcessorDefine define in parsedDocument.Defines) {
if (token.IsCancellationRequested)
return;
if (!symbols.Contains (define.Define)) {
updateSymbols = true;
break;
}
}
}
if (updateSymbols) {
symbols.Clear ();
foreach (PreProcessorDefine define in parsedDocument.Defines) {
symbols.Add (define.Define);
}
}
foreach (FoldingRegion region in parsedDocument.Foldings) {
if (token.IsCancellationRequested)
return;
FoldingType type = FoldingType.None;
bool setFolded = false;
bool folded = false;
//decide whether the regions should be folded by default
switch (region.Type) {
case FoldType.Member:
type = FoldingType.TypeMember;
break;
case FoldType.Type:
type = FoldingType.TypeDefinition;
break;
case FoldType.UserRegion:
type = FoldingType.Region;
setFolded = options.DefaultRegionsFolding;
folded = true;
break;
case FoldType.Comment:
type = FoldingType.Comment;
setFolded = options.DefaultCommentFolding;
folded = true;
break;
case FoldType.CommentInsideMember:
type = FoldingType.Comment;
setFolded = options.DefaultCommentFolding;
folded = false;
break;
case FoldType.Undefined:
setFolded = true;
folded = region.IsFoldedByDefault;
break;
}
//add the region
FoldSegment marker = AddMarker (foldSegments, region.Name,
region.Region, type);
//and, if necessary, set its fold state
if (marker != null && setFolded && firstTime) {
// only fold on document open, later added folds are NOT folded by default.
marker.IsFolded = folded;
continue;
}
if (marker != null && region.Region.IsInside (textEditorData.Caret.Line, textEditorData.Caret.Column))
marker.IsFolded = false;
}
doc.UpdateFoldSegments (foldSegments, false, true, token);
if (reloadSettings) {
reloadSettings = false;
Application.Invoke (delegate {
if (isDisposed)
return;
view.LoadSettings ();
mainsw.QueueDraw ();
});
}
} catch (Exception ex) {
LoggingService.LogError ("Unhandled exception in ParseInformationUpdaterWorkerThread", ex);
}
}
示例15: SetParsedDocument
internal void SetParsedDocument (ParsedDocument newDocument, bool runInThread)
{
this.parsedDocument = newDocument;
if (parsedDocument == null)
return;
StopParseInfoThread ();
if (runInThread) {
var token = parserInformationUpdateSrc.Token;
System.Threading.Tasks.Task.Factory.StartNew (delegate {
HandleParseInformationUpdaterWorkerThreadDoWork (false, parsedDocument, token);
});
} else {
HandleParseInformationUpdaterWorkerThreadDoWork (true, parsedDocument);
}
}