Ejemplo n.º 1
0
		internal MDRefactoringContext (Document document, CSharpAstResolver resolver, TextLocation loc, CancellationToken cancellationToken = default (CancellationToken)) : base (resolver, cancellationToken)
		{
			if (document == null)
				throw new ArgumentNullException ("document");
			this.document = document;
			this.TextEditor = document.Editor;
			this.ParsedDocument = document.ParsedDocument;
			this.Project = document.Project as DotNetProject;
			this.formattingOptions = document.GetFormattingOptions ();
			this.location = loc;
			var policy = document.HasProject ? document.Project.Policies.Get<NameConventionPolicy> () : MonoDevelop.Projects.Policies.PolicyService.GetDefaultPolicy<NameConventionPolicy> ();
			Services.AddService (typeof(NamingConventionService), policy.CreateNRefactoryService ());
			Services.AddService (typeof(ICSharpCode.NRefactory.CSharp.CodeGenerationService), new CSharpCodeGenerationService());
		}
Ejemplo n.º 2
0
		public MDRefactoringContext (Document document, TextLocation loc, CancellationToken cancellationToken = default (CancellationToken)) : base (document.GetSharedResolver ().Result, cancellationToken)
		{
			if (document == null)
				throw new ArgumentNullException ("document");
			this.TextEditor = document.Editor;
			this.ParsedDocument = document.ParsedDocument;
			this.Project = document.Project as DotNetProject;
			this.formattingOptions = document.GetFormattingOptions ();
			this.location = RefactoringService.GetCorrectResolveLocation (document, loc);
			var policy = document.HasProject ? Project.Policies.Get<NameConventionPolicy> () : MonoDevelop.Projects.Policies.PolicyService.GetDefaultPolicy<NameConventionPolicy> ();
			Services.AddService (typeof(NamingConventionService), policy.CreateNRefactoryService ());
		}