本文整理汇总了C#中System.Windows.Forms.Document.GetCoreTextBuffer方法的典型用法代码示例。如果您正苦于以下问题:C# Document.GetCoreTextBuffer方法的具体用法?C# Document.GetCoreTextBuffer怎么用?C# Document.GetCoreTextBuffer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.Document
的用法示例。
在下文中一共展示了Document.GetCoreTextBuffer方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PerformSemanticParse
/// <summary>
/// Semantically parses the specified <see cref="TextRange"/> of the <see cref="Document"/>.
/// </summary>
/// <param name="document">The <see cref="Document"/> to examine.</param>
/// <param name="parseTextRange">A <see cref="TextRange"/> indicating the offset range to parse.</param>
/// <param name="flags">A <see cref="SemanticParseFlags"/> that indicates semantic parse flags.</param>
public override void PerformSemanticParse(Document document, TextRange parseTextRange, SemanticParseFlags flags)
{
if (null == document.Filename)
{
throw new Exception("Document Filename must be set");
}
string source = document.GetCoreTextBuffer().ToString();
string filename = System.IO.Path.GetFullPath(document.Filename); // Normalise the path;
// Remove any pending SemanticParse tasks for this document
object key = new KeyValuePair<Document, object>(document, m_performSemanticParseKey);
m_plugin.TaskQueue.RemoveTasks(key);
// Queue a SemanticParse task for this document
m_plugin.TaskQueue.AddTask(() =>
{
var textBufferReader = new StringTextBufferReader(source, 0, 0);
var cu = MergableLexicalParserManager.PerformSemanticParse(this, textBufferReader, filename) as CompilationUnit;
if (null != cu)
{
cu.SourceKey = filename;
cu.Source = source;
m_plugin.Database.ProcessSynchronous(cu);
document.SemanticParseData = cu;
}
}, TaskQueue.Thread.Worker, key);
}