void FixIndentation(MonoDevelop.Projects.Dom.DomLocation location, int relOffset) { LineSegment lineSegment = data.Document.GetLine(location.Line); string lineIndent = lineSegment.GetIndentation(data.Document); string indentString = this.curIndent.IndentString; if (indentString != lineIndent && location.Column + relOffset == lineIndent.Length) { AddChange(lineSegment.Offset, lineIndent.Length, indentString); } }
void FixStatementIndentation(MonoDevelop.Projects.Dom.DomLocation location) { int offset = data.Document.LocationToOffset(location.Line, location.Column); if (offset == 0) { Console.WriteLine("possible wrong offset"); Console.WriteLine(Environment.StackTrace); return; } int whitespaceStart = SearchWhitespaceStart(offset); string indentString = nextStatementIndent == null ? data.EolMarker + this.curIndent.IndentString : nextStatementIndent; nextStatementIndent = null; AddChange(whitespaceStart, offset - whitespaceStart, indentString); }
public DomType(ICompilationUnit compilationUnit, ClassType classType, Modifiers modifiers, string name, DomLocation location, string namesp, DomRegion region) { this.compilationUnit = compilationUnit; this.classType = classType; this.Modifiers = modifiers; this.Name = name; this.Namespace = namesp; this.BodyRegion = region; this.Location = location; }
public static IEnumerable <FoldingRegion> ToFolds(this IList <Comment> comments) { for (int i = 0; i < comments.Count; i++) { Comment comment = comments[i]; if (comment.CommentType == CommentType.MultiLine) { int startOffset = 0; while (startOffset < comment.Text.Length) { char ch = comment.Text[startOffset]; if (!char.IsWhiteSpace(ch) && ch != '*') { break; } startOffset++; } int endOffset = startOffset; while (endOffset < comment.Text.Length) { char ch = comment.Text[endOffset]; if (ch == '\r' || ch == '\n' || ch == '*') { break; } endOffset++; } string txt; if (endOffset > startOffset) { txt = "/* " + SubstrEllipsize(comment.Text, startOffset, endOffset - startOffset) + " */"; } else { txt = "/* */"; } yield return(new FoldingRegion(txt, comment.Region, FoldType.Comment)); continue; } if (!comment.CommentStartsLine) { continue; } int j = i; int curLine = comment.Region.Start.Line - 1; DomLocation end = comment.Region.End; StringBuilder commentText = new StringBuilder(); for (; j < comments.Count; j++) { Comment curComment = comments[j]; if (curComment == null || !curComment.CommentStartsLine || curComment.CommentType != comment.CommentType || curLine + 1 != curComment.Region.Start.Line) { break; } commentText.Append(curComment.Text); end = curComment.Region.End; curLine = curComment.Region.Start.Line; } if (j - i > 1) { string txt; if (comment.IsDocumentation) { txt = "/// ..."; string cmtText = commentText.ToString(); int idx = cmtText.IndexOf("<summary>"); if (idx >= 0) { int maxOffset = cmtText.IndexOf("</summary>"); while (maxOffset > 0 && cmtText[maxOffset - 1] == ' ') { maxOffset--; } if (maxOffset < 0) { maxOffset = cmtText.Length; } int startOffset = idx + "<summary>".Length; while (startOffset < maxOffset) { char ch = cmtText[startOffset]; if (!char.IsWhiteSpace(ch) && ch != '/') { break; } startOffset++; } int endOffset = startOffset; while (endOffset < maxOffset) { char ch = cmtText[endOffset]; if (ch == '\r' || ch == '\n') { break; } endOffset++; } if (endOffset > startOffset) { txt = "/// " + SubstrEllipsize(cmtText, startOffset, endOffset - startOffset); } } } else { txt = "// " + SubstrEllipsize(comment.Text, 0, comment.Text.Length); } yield return(new FoldingRegion(txt, new DomRegion(comment.Region.Start.Line, comment.Region.Start.Column, end.Line, end.Column), FoldType.Comment)); i = j - 1; } } }
public DomRegion(DomLocation start, DomLocation end) : this(start.Line, start.Column, end.Line, end.Column) { }
public DomRegion(int startLine, int startColumn, int endLine, int endColumn) : this() { this.Start = new DomLocation(startLine, startColumn); this.End = new DomLocation(endLine, endColumn); }
public bool Contains(DomLocation location) { return(Start <= location && location <= End); }
public ConditionBlock(string flag, DomLocation start) { this.Flag = flag; this.Start = start; this.Region = DomRegion.Empty; }
public bool IsNamespaceUsedAt(string name, DomLocation location) { return(usings.Where(u => ((!u.IsFromNamespace && u.Region.Start < location) || u.Region.Contains(location)) && u.Namespaces.Contains(name)).Any()); }
public DomType(ICompilationUnit compilationUnit, ClassType classType, string name, DomLocation location, string namesp, DomRegion region, List <IMember> members) { this.compilationUnit = compilationUnit; this.classType = classType; this.Name = name; this.Namespace = namesp; this.BodyRegion = region; this.Location = location; foreach (IMember member in members) { AddChild(member); ((AbstractMember)member).DeclaringType = this; } }
public void SetMainPart(string fileName, DomLocation location) { SetMainPart(fileName, location.Line, location.Column); }
public DomRegion(DomLocation start, DomLocation end) : this() { this.start = start; this.end = end; }
public DomProperty(string name, Modifiers getterModifier, Modifiers setterModifier, DomLocation location, DomRegion bodyRegion, IReturnType returnType) { base.Name = name; this.GetterModifier = getterModifier; this.SetterModifier = setterModifier; this.Location = location; this.BodyRegion = bodyRegion; base.ReturnType = returnType; }
public DomProperty(string name, Modifiers modifier, DomLocation location, DomRegion bodyRegion, IReturnType returnType) : this(name, modifier, modifier, location, bodyRegion, returnType) { }
void FixIndentation(MonoDevelop.Projects.Dom.DomLocation location) { FixIndentation(location, 0); }
public IType GetTypeAt(DomLocation location) { return(GetTypeAt(location.Line, location.Column)); }
public IMember GetMemberAt(DomLocation location) { return(GetMemberAt(location.Line, location.Column)); }
public static DomType CreateDelegate(ICompilationUnit compilationUnit, string name, DomLocation location, IReturnType type, IEnumerable <IParameter> parameters) { DomType result = new DomType(); result.compilationUnit = compilationUnit; result.Name = name; result.classType = MonoDevelop.Projects.Dom.ClassType.Delegate; DomMethod delegateMethod = new DomMethod("Invoke", Modifiers.None, MethodModifier.None, location, DomRegion.Empty, type); delegateMethod.Add(parameters); result.Add(delegateMethod); return(result); }
public ShortenTypeNameVistior(ICompilationUnit unit, DomLocation location) { this.unit = unit; this.location = location; callingType = this.unit.GetTypeAt(location); }
public Error(ErrorType errorType, DomLocation location, string message) : this(errorType, new DomRegion(location, DomLocation.Empty), message) { }
public DomMethod(string name, Modifiers modifiers, MethodModifier MethodModifier, DomLocation location, DomRegion bodyRegion, IReturnType returnType) { this.Name = name; this.Modifiers = modifiers; this.Location = location; this.BodyRegion = bodyRegion; this.ReturnType = returnType; this.MethodModifier = MethodModifier; }
public PreProcessorDefine(string define, DomLocation location) { this.Define = define; this.Location = location; }