Exemple #1
0
        private void AddTagIfNecessary(int startIndex, int endIndex, int headerIndex = -1, DecoratorStatement decorator = null, int minLinesToCollapse = 3)
        {
            var startLine = _ast.IndexToLocation(startIndex).Line;
            var endLine   = _ast.IndexToLocation(endIndex).Line;
            var lines     = endLine - startLine + 1;

            // Collapse if more than 3 lines.
            if (lines >= minLinesToCollapse)
            {
                if (decorator != null)
                {
                    // we don't want to collapse the decorators, we like them visible, so
                    // we base our starting position on where the decorators end.
                    startIndex = decorator.EndIndex + 1;
                }

                var tagSpan = new AP.OutliningTag()
                {
                    startIndex  = startIndex,
                    endIndex    = endIndex,
                    headerIndex = headerIndex
                };
                TagSpans.Add(tagSpan);
            }
        }
Exemple #2
0
        private void AddTagIfNecessary(int startIndex, int endIndex, int headerIndex = -1, DecoratorStatement decorator = null, int minLinesToCollapse = 3) {
            var startLine = _ast.IndexToLocation(startIndex).Line;
            var endLine = _ast.IndexToLocation(endIndex).Line;
            var lines = endLine - startLine + 1;

            // Collapse if more than 3 lines.
            if (lines >= minLinesToCollapse) {
                if (decorator != null) {
                    // we don't want to collapse the decorators, we like them visible, so
                    // we base our starting position on where the decorators end.
                    startIndex = decorator.EndIndex + 1;
                }

                var tagSpan = new AP.OutliningTag() {
                    startIndex = startIndex,
                    endIndex = endIndex,
                    headerIndex = headerIndex
                };
                TagSpans.Add(tagSpan);
            }
        }