예제 #1
0
        public static async Task <Position> getEndOfTag(string tagName, BlazorMonaco.Range tagRange, TextModel model)
        {
            string        endTag = $"</{tagName}>";
            int           l      = tagRange.EndLineNumber;
            List <string> lines  = await model.GetLinesContent();

            int endTagCol = -1;

            while (l < lines.Count)
            {//problem if previous tag closes on the same line before the start of current tag
                if (l == tagRange.EndLineNumber)
                {
                    endTagCol = lines[l - 1].IndexOf(endTag, tagRange.EndColumn - 1);                             //searching on first line
                }
                else
                {
                    endTagCol = lines[l - 1].IndexOf(endTag);
                }

                if (endTagCol > -1)
                {
                    break;
                }
                l++;
            }
            return(new Position()
            {
                Column = endTagCol + endTag.Length + 1, LineNumber = l
            });
        }