public BinaryExpressionCodeActionComputer(
                AbstractBinaryExpressionWrapper <TBinaryExpressionSyntax> service,
                Document document,
                SourceText originalSourceText,
                DocumentOptionSet options,
                TBinaryExpressionSyntax binaryExpression,
                ImmutableArray <SyntaxNodeOrToken> exprsAndOperators,
                CancellationToken cancellationToken
                ) : base(service, document, originalSourceText, options, cancellationToken)
            {
                _exprsAndOperators = exprsAndOperators;
                _preference        = options.GetOption(CodeStyleOptions2.OperatorPlacementWhenWrapping);

                var generator = SyntaxGenerator.GetGenerator(document);

                _newlineBeforeOperatorTrivia = service.GetNewLineBeforeOperatorTrivia(
                    NewLineTrivia
                    );

                _indentAndAlignTrivia = new SyntaxTriviaList(
                    generator.Whitespace(
                        OriginalSourceText
                        .GetOffset(binaryExpression.Span.Start)
                        .CreateIndentationString(UseTabs, TabSize)
                        )
                    );

                _smartIndentTrivia = new SyntaxTriviaList(
                    generator.Whitespace(GetSmartIndentationAfter(_exprsAndOperators[1]))
                    );
            }
Exemplo n.º 2
0
 public CSharpSyntaxWrappingOptions(
     CSharpSyntaxFormattingOptions formattingOptions,
     int wrappingColumn,
     OperatorPlacementWhenWrappingPreference operatorPlacement,
     bool newLinesForBracesInObjectCollectionArrayInitializers)
     : base(formattingOptions, wrappingColumn, operatorPlacement)
 {
     NewLinesForBracesInObjectCollectionArrayInitializers = newLinesForBracesInObjectCollectionArrayInitializers;
 }
 protected SyntaxWrappingOptions(
     SyntaxFormattingOptions formattingOptions,
     int wrappingColumn,
     OperatorPlacementWhenWrappingPreference operatorPlacement)
 {
     FormattingOptions = formattingOptions;
     WrappingColumn    = wrappingColumn;
     OperatorPlacement = operatorPlacement;
 }
Exemplo n.º 4
0
 public CSharpSyntaxWrappingOptions(
     bool useTabs,
     int tabSize,
     string newLine,
     int wrappingColumn,
     OperatorPlacementWhenWrappingPreference operatorPlacement,
     bool newLinesForBracesInObjectCollectionArrayInitializers)
     : base(useTabs, tabSize, newLine, wrappingColumn, operatorPlacement)
 {
     NewLinesForBracesInObjectCollectionArrayInitializers = newLinesForBracesInObjectCollectionArrayInitializers;
 }
Exemplo n.º 5
0
 protected SyntaxWrappingOptions(
     bool useTabs,
     int tabSize,
     string newLine,
     int wrappingColumn,
     OperatorPlacementWhenWrappingPreference operatorPlacement)
 {
     UseTabs           = useTabs;
     TabSize           = tabSize;
     NewLine           = newLine;
     WrappingColumn    = wrappingColumn;
     OperatorPlacement = operatorPlacement;
 }
Exemplo n.º 6
0
 // Default to beginning_of_line if we don't know the value.
 public static string GetEditorConfigString(OperatorPlacementWhenWrappingPreference value)
 => value == OperatorPlacementWhenWrappingPreference.EndOfLine ? end_of_line : beginning_of_line;