ICSharpCode.NRefactory.CSharp.Completion.CSharpCompletionEngine.GetLastClosingXmlCommentTag C# (CSharp) Method

GetLastClosingXmlCommentTag() private method

private GetLastClosingXmlCommentTag ( ) : string
return string
		string GetLastClosingXmlCommentTag()
		{
			var line = document.GetLineByNumber(location.Line);
			
			restart:
			string lineText = document.GetText(line);
			if (!lineText.Trim().StartsWith("///"))
				return null;
			int startIndex = Math.Min(location.Column - 1, lineText.Length - 1) - 1;
			while (startIndex > 0 && lineText [startIndex] != '<') {
				--startIndex;
				if (lineText [startIndex] == '/') {
					// already closed.
					startIndex = -1;
					break;
				}
			}
			if (startIndex < 0 && line.PreviousLine != null) {
				line = line.PreviousLine;
				goto restart;
			}
			
			if (startIndex >= 0) {
				int endIndex = startIndex;
				while (endIndex + 1 < lineText.Length && lineText [endIndex] != '>' && !Char.IsWhiteSpace (lineText [endIndex + 1])) {
					endIndex++;
				}
				string tag = endIndex - startIndex - 1 > 0 ? lineText.Substring(
					startIndex + 1,
					endIndex - startIndex - 1
				) : null;
				if (!string.IsNullOrEmpty(tag) && commentTags.IndexOf(tag) >= 0) {
					return tag;
				}
			}
			return null;
		}