Beispiel #1
0
		public override void AddImport(FileName fileName, string namespaceName)
		{
			var context = RefactoringExtensions.CreateRefactoringContext(new DomRegion(fileName, 0, 0));
			var astBuilder = context.CreateTypeSystemAstBuilder();
			using (var script = context.StartScript()) {
				AstType ns = astBuilder.ConvertNamespace(namespaceName);
				UsingHelper.InsertUsing(context, script, ns);
			}
		}
 public override void Complete(CompletionContext context)
 {
     context.Editor.Document.Replace(context.StartOffset, context.Length, insertionText);
     context.EndOffset = context.StartOffset + insertionText.Length;
     if (insertUsing != null)
     {
         SD.Log.Debug("Insert using '" + insertUsing + "'");
         var refactoringContext = SDRefactoringContext.Create(context.Editor, CancellationToken.None);
         using (var script = refactoringContext.StartScript()) {
             UsingHelper.InsertUsing(refactoringContext, script, new UsingDeclaration(insertUsing));
         }
     }
 }