コード例 #1
0
ファイル: FormattingContext.cs プロジェクト: sperling/cskarp
        private void AddSpacingSuppressOperation(SuppressOperation operation, bool twoTokensOnSameLine)
        {
            // don't add stuff if it is empty
            if (operation == null ||
                operation.TextSpan.IsEmpty)
            {
                return;
            }

            // we might need to merge bits with enclosing suppress flag
            var option = operation.Option;

            if (!option.IsMaskOn(SuppressOption.NoSpacing) || this.suppressSpacingMap.Contains(operation.TextSpan))
            {
                return;
            }

            if (!(option.IsOn(SuppressOption.NoSpacingIfOnSingleLine) && twoTokensOnSameLine) &&
                !(option.IsOn(SuppressOption.NoSpacingIfOnMultipleLine) && !twoTokensOnSameLine))
            {
                return;
            }

            var data = new SuppressSpacingData(operation.TextSpan, noSpacing: true);

            this.suppressSpacingMap.Add(operation.TextSpan);
            this.suppressSpacingTree.AddIntervalInPlace(data);
        }
コード例 #2
0
ファイル: FormattingContext.cs プロジェクト: josh-127/roslyn
        private void AddFormattingSuppressOperation(SuppressOperation operation)
        {
            // don't add stuff if it is empty
            if (operation == null ||
                operation.TextSpan.IsEmpty)
            {
                return;
            }

            // we might need to merge bits with enclosing suppress flag
            var option = operation.Option;

            if (!option.IsOn(SuppressOption.DisableFormatting) || _suppressFormattingMap.Contains(operation.TextSpan))
            {
                return;
            }

            var data = new SuppressSpacingData(operation.TextSpan);

            _suppressFormattingMap.Add(operation.TextSpan);
            _suppressFormattingTree.AddIntervalInPlace(data);
        }