internal void SetLocation(TextLocation loc) { if (document != null) { location = RefactoringService.GetCorrectResolveLocation(document, loc); } else { location = loc; } }
public MDRefactoringContext(MonoDevelop.Ide.Gui.Document document, TextLocation loc, CancellationToken cancellationToken = default(CancellationToken)) : base(CreateResolver(document), cancellationToken) { if (document == null) { throw new ArgumentNullException("document"); } this.Document = document; this.location = RefactoringService.GetCorrectResolveLocation(document, loc); var policy = Document.HasProject ? Document.Project.Policies.Get <NameConventionPolicy> () : MonoDevelop.Projects.Policies.PolicyService.GetDefaultPolicy <NameConventionPolicy> (); Services.AddService(typeof(NamingConventionService), policy.CreateNRefactoryService()); }
public MDRefactoringContext(Document document, TextLocation loc, CancellationToken cancellationToken = default(CancellationToken)) : base(document.GetPlayScriptSharedResolver().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 <PlayScriptNameConventionPolicy> () : MonoDevelop.Projects.Policies.PolicyService.GetDefaultPolicy <PlayScriptNameConventionPolicy> (); Services.AddService(typeof(NamingConventionService), policy.CreateNRefactoryService()); }
public ResolveResult GetLanguageItem(MonoDevelop.Ide.Gui.Document doc, int offset, out DomRegion expressionRegion) { if (offset < 0) { expressionRegion = DomRegion.Empty; return(null); } var loc = RefactoringService.GetCorrectResolveLocation(doc, doc.Editor.OffsetToLocation(offset)); ResolveResult result; AstNode node; if (!doc.TryResolveAt(loc, out result, out node)) { expressionRegion = DomRegion.Empty; return(null); } expressionRegion = new DomRegion(node.StartLocation, node.EndLocation); return(result); }
public string GetExpression(Mono.TextEditor.TextEditorData data, int offset) { if (offset < 0) { return(""); } var doc = IdeApp.Workbench.ActiveDocument; if (doc == null) { return(""); } var loc = RefactoringService.GetCorrectResolveLocation(doc, data.OffsetToLocation(offset)); var unit = doc.ParsedDocument.GetAst <SyntaxTree> (); var parsedFile = doc.ParsedDocument.ParsedFile as CSharpUnresolvedFile; var node = unit.GetNodeAt <Expression> (loc.Line, loc.Column); if (unit == null || parsedFile == null || node == null) { return(""); } return(data.GetTextBetween(node.StartLocation, node.EndLocation)); }
internal void SetLocation(TextLocation loc) { location = RefactoringService.GetCorrectResolveLocation(document, loc); }