本文整理汇总了C#中Mono.TextEditor.Document.SetProject方法的典型用法代码示例。如果您正苦于以下问题:C# Document.SetProject方法的具体用法?C# Document.SetProject怎么用?C# Document.SetProject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mono.TextEditor.Document
的用法示例。
在下文中一共展示了Document.SetProject方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateDocument
async Task<Document> CreateDocument (string input)
{
var text = input;
int endPos = text.IndexOf ('$');
if (endPos >= 0)
text = text.Substring (0, endPos) + text.Substring (endPos + 1);
var project = Services.ProjectService.CreateDotNetProject ("C#");
project.Name = "test";
project.References.Add (MonoDevelop.Projects.ProjectReference.CreateAssemblyReference ("mscorlib"));
project.References.Add (MonoDevelop.Projects.ProjectReference.CreateAssemblyReference ("System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"));
project.References.Add (MonoDevelop.Projects.ProjectReference.CreateAssemblyReference ("System.Core"));
project.FileName = "test.csproj";
project.Files.Add (new ProjectFile ("/a.cs", BuildAction.Compile));
solution = new MonoDevelop.Projects.Solution ();
solution.AddConfiguration ("", true);
solution.DefaultSolutionFolder.AddItem (project);
using (var monitor = new ProgressMonitor ())
await TypeSystemService.Load (solution, monitor);
var tww = new TestWorkbenchWindow ();
var content = new TestViewContent ();
tww.ViewContent = content;
content.ContentName = "/a.cs";
content.Data.MimeType = "text/x-csharp";
content.Project = project;
content.Text = text;
content.CursorPosition = Math.Max (0, endPos);
var doc = new Document (tww);
doc.SetProject (project);
var compExt = new CSharpCompletionTextEditorExtension ();
compExt.Initialize (doc.Editor, doc);
content.Contents.Add (compExt);
await doc.UpdateParseDocument ();
return doc;
}