/// <summary> /// Initializes a new instance of the <see cref="ICSharpCode.NRefactory.TypeSystem.Error"/> class. /// </summary> /// <param name='errorType'> /// The error type. /// </param> /// <param name='message'> /// The description of the error. /// </param> public Error(ErrorType errorType, string id, string message) { this.errorType = errorType; this.Id = id; this.message = message; this.region = DocumentRegion.Empty; }
public override void DisableOnce(MonoDevelop.Ide.Gui.Document document, DocumentRegion loc) { document.Editor.Insert( document.Editor.LocationToOffset(loc.BeginLine, 1), document.Editor.IndentationTracker.GetIndentationString(loc.Begin) + "// ReSharper disable once " + attr.ResharperDisableKeyword + document.Editor.EolMarker ); }
/// <summary> /// Initializes a new instance of the <see cref="ICSharpCode.NRefactory.TypeSystem.Error"/> class. /// </summary> /// <param name='errorType'> /// The error type. /// </param> /// <param name='message'> /// The description of the error. /// </param> /// <param name='region'> /// The region of the error. /// </param> public Error(ErrorType errorType, string id, string message, DocumentRegion region) { this.errorType = errorType; this.Id = id; this.message = message; this.region = region; }
/// <summary> /// Initializes a new instance of the <see cref="ICSharpCode.NRefactory.TypeSystem.Error"/> class. /// </summary> /// <param name='errorType'> /// The error type. /// </param> /// <param name='message'> /// The description of the error. /// </param> /// <param name='location'> /// The location of the error. /// </param> public Error(ErrorType errorType, string id, string message, DocumentLocation location) { this.errorType = errorType; this.Id = id; this.message = message; this.region = new DocumentRegion(location, location); }
public ISymbol GetLanguageItem(MonoDevelop.Ide.Gui.Document document, int offset, out DocumentRegion expressionRegion) { expressionRegion = DocumentRegion.Empty; var parsedDocument = document.DocumentContext.AnalysisDocument; if (parsedDocument == null) { return(null); } var model = parsedDocument.GetSemanticModelAsync().WaitAndGetResult(); if (model == null) { return(null); } foreach (var symbol in model.LookupSymbols(offset)) { var firstDeclaration = symbol.DeclaringSyntaxReferences.FirstOrDefault(); if (firstDeclaration != null) { expressionRegion = new DocumentRegion( document.Editor.OffsetToLocation(firstDeclaration.Span.Start), document.Editor.OffsetToLocation(firstDeclaration.Span.End)); } return(symbol); } return(null); }
void IXmlParserContext.LogWarning(string message, DocumentRegion region) { if (errors != null || ErrorLogged != null) { InternalLogError(new Error(ErrorType.Warning, message, region)); } }
static bool IsInsideMember(this DocumentRegion region, IUnresolvedTypeDefinition cl) { if (region.IsEmpty || cl == null || !cl.BodyRegion.IsInside(region.Begin.Line, region.Begin.Column)) { return(false); } foreach (var member in cl.Members) { if (member.BodyRegion.IsEmpty) { continue; } if (member.BodyRegion.IsInside(region.Begin.Line, region.Begin.Column) && member.BodyRegion.IsInside(region.End.Line, region.End.Column)) { return(true); } } foreach (var inner in cl.NestedTypes) { if (region.IsInsideMember(inner)) { return(true); } } return(false); }
public void Run(XElement element, MSBuildLanguageElement resolvedElement, string filename, ITextSource textDocument, MSBuildDocument document, int offset = 0, int length = 0) { Filename = filename; Document = document; Extension = System.IO.Path.GetExtension(filename); //HACK: we should really use the ITextSource directly, but since the XML parser positions are //currently line/col, we need a TextDocument to convert to offsets TextDocument = textDocument as IReadonlyTextDocument ?? TextEditorFactory.CreateNewReadonlyDocument( textDocument, filename, MSBuildTextEditorExtension.MSBuildMimeType ); range = new DocumentRegion( TextDocument.OffsetToLocation(offset), length > 0 ? TextDocument.OffsetToLocation(length + offset) : new DocumentLocation(int.MaxValue, int.MaxValue)); if (resolvedElement != null) { VisitResolvedElement(element, resolvedElement); } else if (element != null) { ResolveAndVisit(element, null); } }
protected string GetBufferText (DocumentRegion region) { int start = Editor.LocationToOffset (region.BeginLine, region.BeginColumn); int end = Editor.LocationToOffset (region.EndLine, region.EndColumn); if (end > start && start >= 0) return Editor.GetTextBetween (start, end); return null; }
protected void EditorSelect (DocumentRegion region) { int s = Editor.LocationToOffset (region.BeginLine, region.BeginColumn); int e = Editor.LocationToOffset (region.EndLine, region.EndColumn); if (s > -1 && e > s) { Editor.SetSelection (s, e); Editor.ScrollTo (s); } }
public void SelectNode (XNode n) { var region = n.Region; var el = n as XElement; if (el != null && el.IsClosed && el.ClosingTag.Region.End > region.End) { region = new DocumentRegion (region.Begin, el.ClosingTag.Region.End); } EditorSelect (region); }
public RazorOutlineNode (XElement el) { Name = el.Name.FullName; string id = el.GetId (); if (!string.IsNullOrEmpty (id)) Name = "<" + Name + "#" + id + ">"; else Name = "<" + Name + ">"; Location = el.Region; }
public static ISymbol GetLanguageItem (this Document document, int offset, out DocumentRegion expressionRegion) { if (document == null) throw new System.ArgumentNullException ("document"); var textEditorResolver = TextEditorResolverService.GetProvider (document.Editor.MimeType); if (textEditorResolver != null) { return textEditorResolver.GetLanguageItem (document, offset, out expressionRegion); } expressionRegion = DocumentRegion.Empty; return null; }
public static ISymbol GetLanguageItem(this Document document, int offset, out DocumentRegion expressionRegion) { if (document == null) { throw new System.ArgumentNullException("document"); } var textEditorResolver = TextEditorResolverService.GetProvider(document.Editor.MimeType); if (textEditorResolver != null) { return(textEditorResolver.GetLanguageItem(document, offset, out expressionRegion)); } expressionRegion = DocumentRegion.Empty; return(null); }
public RazorOutlineNode(XElement el) { Name = el.Name.FullName; string id = el.GetId(); if (!string.IsNullOrEmpty(id)) { Name = "<" + Name + "#" + id + ">"; } else { Name = "<" + Name + ">"; } Location = el.Region; }
private void AddContentPattern_Click(object sender, RoutedEventArgs e) { var cp = (ContentPattern) contentPaternsLst.SelectedValue; var region = new DocumentRegion { RegionContent = cp.Id }; region.ContentPattern = cp; if (RegionAdded != null) { RegionAdded(this, new RegionAddedEventArgs(region)); } this.Close(); }
new void SelectNode(XNode n) { var region = n.Region; XElement el = n as XElement; if (el != null && el.IsClosed && el.ClosingTag.Region.End > region.End) { region = new DocumentRegion(region.Begin, el.ClosingTag.Region.End); } int s = Editor.LocationToOffset(region.BeginLine, region.BeginColumn); int e = Editor.LocationToOffset(region.EndLine, region.EndColumn); if (e > s && s > -1) { Editor.SetSelection(s, e); } }
public ISymbol GetLanguageItem (MonoDevelop.Ide.Gui.Document document, int offset, out DocumentRegion expressionRegion) { expressionRegion = DocumentRegion.Empty; var parsedDocument = document.ParsedDocument; if (parsedDocument == null) return null; var model = parsedDocument.GetAst<SemanticModel> (); if (model == null) return null; foreach (var symbol in model.LookupSymbols (offset)) { var firstDeclaration = symbol.DeclaringSyntaxReferences.FirstOrDefault (); if (firstDeclaration != null) { expressionRegion = new DocumentRegion ( document.Editor.OffsetToLocation (firstDeclaration.Span.Start), document.Editor.OffsetToLocation (firstDeclaration.Span.End)); } return symbol; } return null; }
private void Ok_Clicked(object sender, RoutedEventArgs e) { try { double d = 0.0; var region = new DocumentRegion { Uid = this.txtBoxId.Text, RegionContent = txtBoxId.Text }; var proxy = new DocumentEditorServiceSoapClient(); var cp = proxy.CreateContentPattern(); cp.Id = txtBoxId.Text; cp.X = double.Parse(txtBoxPosX.Text); cp.Y = double.Parse(txtBoxosY.Text); cp.Width = double.Parse(txtBoxWidth.Text); cp.Height = double.Parse(txtBoxHeight.Text); proxy.SaveContentPattern(cp); region.ContentPattern = cp; if (RegionCreated != null) { RegionCreated(this, new RegionAddedEventArgs(region)); } } catch (Exception ex) { MessageBox.Show(ex.Message); } this.Close(); }
internal string GetSdkPath(IRuntimeInformation runtime, string sdk, DocumentRegion loc) { if (!SdkReference.TryParse(sdk, out SdkReference sdkRef)) { string parseErrorMsg = $"Could not parse SDK '{sdk}'"; LoggingService.LogError(parseErrorMsg); if (IsToplevel) { AddError(parseErrorMsg); } return(null); } //FIXME: filename should be the root project, not this file try { var sdkPath = runtime.GetSdkPath(sdkRef, Filename, null); if (sdk != null) { return(sdkPath); } } catch (Exception ex) { LoggingService.LogError("Error in SDK resolver", ex); return(null); } string notFoundMsg = $"Did not find SDK '{sdk}'"; LoggingService.LogError(notFoundMsg); if (IsToplevel) { AddError(notFoundMsg); } return(null); void AddError(string msg) => Errors.Add(new Error(ErrorType.Error, msg, loc)); }
public virtual void DisableWithPragma (MonoDevelop.Ide.Gui.Document document, DocumentRegion loc) { throw new NotSupportedException (); }
public FoldingRegion (DocumentRegion region, FoldType type) : this (null, region, type) { }
public FoldingRegion (string name, DocumentRegion region, FoldType type, bool isFoldedByDefault) : this (name, region) { this.Type = type; this.IsFoldedByDefault = isFoldedByDefault; }
public virtual void SuppressWithAttribute (MonoDevelop.Ide.Gui.Document document, DocumentRegion loc) { throw new NotSupportedException (); }
public WebFormsHtmlEncodedExpression (DocumentRegion region) : base (region) { }
public RegionAddedEventArgs(DocumentRegion region) { this.Region = region; }
public WebFormsResourceExpression (DocumentRegion region) : base (region) { }
public FoldingRegion(string name, DocumentRegion region, FoldType type, bool isFoldedByDefault) : this(name, region) { this.Type = type; this.IsFoldedByDefault = isFoldedByDefault; }
public FoldingRegion(string name, DocumentRegion region) { this.Name = name ?? defaultName; this.Region = region; }
public override void SuppressWithAttribute(MonoDevelop.Ide.Gui.Document document, DocumentRegion loc) { var member = document.ParsedDocument.GetMember(loc.End); document.Editor.Insert( document.Editor.LocationToOffset(member.Region.BeginLine, 1), document.Editor.IndentationTracker.GetIndentationString(loc.Begin) + string.Format("[SuppressMessage(\"{0}\", \"{1}\")]" + document.Editor.EolMarker, attr.SuppressMessageCategory, attr.SuppressMessageCheckId) ); }
public WebFormsServerComment(DocumentRegion region) : base(region) { }
public override void DisableAndRestore(MonoDevelop.Ide.Gui.Document document, DocumentRegion loc) { using (document.Editor.OpenUndoGroup()) { document.Editor.Insert( document.Editor.LocationToOffset(loc.EndLine + 1, 1), document.Editor.IndentationTracker.GetIndentationString(loc.End) + "// ReSharper restore " + attr.ResharperDisableKeyword + document.Editor.EolMarker ); document.Editor.Insert( document.Editor.LocationToOffset(loc.BeginLine, 1), document.Editor.IndentationTracker.GetIndentationString(loc.Begin) + "// ReSharper disable " + attr.ResharperDisableKeyword + document.Editor.EolMarker ); } }
public static bool ContainsOuter(this DocumentRegion region, DocumentLocation location) { return(region.Begin <= location && location <= region.End); }
public override void DisableWithPragma(MonoDevelop.Ide.Gui.Document document, DocumentRegion loc) { using (document.Editor.OpenUndoGroup()) { document.Editor.Insert( document.Editor.LocationToOffset(loc.EndLine + 1, 1), document.Editor.IndentationTracker.GetIndentationString(loc.End) + "#pragma warning restore " + attr.PragmaWarning + document.Editor.EolMarker ); document.Editor.Insert( document.Editor.LocationToOffset(loc.BeginLine, 1), document.Editor.IndentationTracker.GetIndentationString(loc.Begin) + "#pragma warning disable " + attr.PragmaWarning + document.Editor.EolMarker ); } }
public RazorComment (DocumentRegion region) : base (region) { }
public FoldingRegion(DocumentRegion region) : this(null, region) { }
public void Remove (DocumentRegion region) { Remove (region.GetSegment (document)); }
public FoldingRegion(string name, DocumentRegion region, FoldType type) : this(name, region) { this.Type = type; }
public string GetTextAt (DocumentRegion region) { return GetTextAt (region.GetSegment (this)); }
public FoldingRegion(DocumentRegion region, FoldType type) : this(null, region, type) { }
public override void DisableOnce (MonoDevelop.Ide.Gui.Document document, DocumentRegion loc) { document.Editor.Insert ( document.Editor.LocationToOffset (loc.BeginLine, 1), document.Editor.IndentationTracker.GetIndentationString (loc.Begin) + "// " + analysisDisableTag + "disable once " + attr.AnalysisDisableKeyword + document.Editor.EolMarker ); }
public override void DisableWithPragma (MonoDevelop.Ide.Gui.Document document, DocumentRegion loc) { using (document.Editor.OpenUndoGroup ()) { document.Editor.Insert ( document.Editor.LocationToOffset (loc.EndLine + 1, 1), document.Editor.IndentationTracker.GetIndentationString (loc.End) + "#pragma warning restore " + attr.PragmaWarning + document.Editor.EolMarker ); document.Editor.Insert ( document.Editor.LocationToOffset (loc.BeginLine, 1), document.Editor.IndentationTracker.GetIndentationString (loc.Begin) + "#pragma warning disable " + attr.PragmaWarning + document.Editor.EolMarker ); } }
new void SelectNode (XNode n) { var region = n.Region; XElement el = n as XElement; if (el != null && el.IsClosed && el.ClosingTag.Region.End > region.End) { region = new DocumentRegion (region.Begin, el.ClosingTag.Region.End); } int s = Editor.LocationToOffset (region.BeginLine, region.BeginColumn ); int e = Editor.LocationToOffset (region.EndLine, region.EndColumn); if (e > s && s > -1) Editor.SetSelection (s, e); }
public XProcessingInstruction(DocumentRegion region) : base(region) { }
public WebFormsRenderBlock (DocumentRegion region) : base (region) { }
public string GetTextAt (DocumentRegion region) { return document.GetTextAt (region); }
protected XNode (DocumentRegion region) : base (region) {}
public XProcessingInstruction (DocumentRegion region) : base (region) {}
void AddError(ErrorType errorType, string message, DocumentRegion region) => Document.Errors.Add(new Error(errorType, message, region));
public NavigationAnnotation(string path, DocumentRegion region) { Path = path; Region = region; }
void AddError(string message, DocumentRegion region) => AddError(ErrorType.Error, message, region);
public override void DisableAndRestore (MonoDevelop.Ide.Gui.Document document, DocumentRegion loc) { using (document.Editor.OpenUndoGroup ()) { document.Editor.Insert ( document.Editor.LocationToOffset (loc.EndLine + 1, 1), document.Editor.IndentationTracker.GetIndentationString (loc.End) + "// " + analysisDisableTag + "restore " + attr.AnalysisDisableKeyword + document.Editor.EolMarker ); document.Editor.Insert ( document.Editor.LocationToOffset (loc.BeginLine, 1), document.Editor.IndentationTracker.GetIndentationString (loc.Begin) + "// " + analysisDisableTag + "disable " + attr.AnalysisDisableKeyword + document.Editor.EolMarker ); } }
void AddWarning(string message, DocumentRegion region) => AddError(ErrorType.Warning, message, region);
public override void SuppressWithAttribute (MonoDevelop.Ide.Gui.Document document, DocumentRegion loc) { var member = document.ParsedDocument.GetMember (loc.End); document.Editor.Insert ( document.Editor.LocationToOffset (member.Region.BeginLine, 1), document.Editor.IndentationTracker.GetIndentationString (loc.Begin) + string.Format ("[SuppressMessage(\"{0}\", \"{1}\")]" + document.Editor.EolMarker, attr.SuppressMessageCategory, attr.SuppressMessageCheckId) ); }
public FoldingRegion (DocumentRegion region) : this (null, region) { }
public FoldingRegion (string name, DocumentRegion region) { this.Name = name ?? defaultName; this.Region = region; }
public FoldingRegion (string name, DocumentRegion region, FoldType type) : this (name, region) { this.Type = type; }