Esempio n. 1
0
        public static bool DocumentContainsSections(TextDocument document)
        {
            foreach (DocumentLine processedLine in document.Lines)
            {
                string processedLineText = document.GetText(processedLine.Offset, processedLine.Length);

                if (LineHelper.IsSectionHeaderLine(processedLineText))
                {
                    return(true);
                }
            }

            return(false);
        }
Esempio n. 2
0
        public static DocumentLine GetCommandStartLine(TextDocument document, int offset)
        {
            DocumentLine offsetLine     = document.GetLineByOffset(offset);
            string       offsetLineText = LineHelper.EscapeComments(document.GetText(offsetLine.Offset, offsetLine.Length));

            if (offsetLineText.Contains("=") || offsetLineText.Trim().StartsWith("#"))
            {
                return(offsetLine);
            }
            else if (LineHelper.IsSectionHeaderLine(offsetLineText))
            {
                return(null);
            }
            else
            {
                return(FindCommandStartLine(document, offsetLine));
            }
        }