예제 #1
0
        private bool StartsWithRegionTag(ITextSnapshotLine line)
        {
            var start = line.GetFirstNonWhitespacePosition();

            if (start != null)
            {
                var index = start.Value;
                return(line.StartsWith(index, "#region", ignoreCase: true));
            }

            return(false);
        }
예제 #2
0
            static bool IsImport(ITextSnapshotLine line, string language)
            {
                var start = line.GetFirstNonWhitespacePosition();

                if (start is null)
                {
                    return(false);
                }

                // For VB we only need to find "Imports" at the start of a line
                if (language == LanguageNames.VisualBasic)
                {
                    return(line.StartsWith(start.Value, ImportsStatement, ignoreCase: true));
                }

                // For the purposes of collapsing, extern aliases are grouped with usings
                if (line.StartsWith(start.Value, ExternDeclaration, ignoreCase: false))
                {
                    return(true);
                }

                return(line.StartsWith(start.Value, UsingDirective, ignoreCase: false));
            }
예제 #3
0
        public static bool Contains(this ITextSnapshotLine line, int index, string value, bool ignoreCase)
        {
            var snapshot = line.Snapshot;

            for (var i = index; i < line.End; i++)
            {
                if (i + value.Length > snapshot.Length)
                {
                    return(false);
                }

                if (line.StartsWith(i, value, ignoreCase))
                {
                    return(true);
                }
            }

            return(false);
        }
                static bool StartsWithRegionTag(ITextSnapshotLine line)
                {
                    var start = line.GetFirstNonWhitespacePosition();

                    return(start != null && line.StartsWith(start.Value, "#region", ignoreCase: true));
                }