/
githubmirror
/
roslyn
Обзор
Документация
Войти
/
githubmirror
/
roslyn
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/Features/VisualBasic/Portable/ChangeSignature/ChangeSignatureFormattingRule.vb
45 строк
2 KB
dotnet-bot
Apply CA1822 (Make member static) FixAll in project for IDE layer projects
21 май 2020, 02:56
21 май 2020, 02:56
b2bbdbd
Код
Авторство
О чём код?
' Licensed to the .NET Foundation under one or more agreements. ' The .NET Foundation licenses this file to you under the MIT license. ' See the LICENSE file in the project root for more information. Imports Microsoft.CodeAnalysis.Formatting.Rules Imports Microsoft.CodeAnalysis.Text Imports Microsoft.CodeAnalysis.VisualBasic.Formatting Namespace Microsoft.CodeAnalysis.VisualBasic.ChangeSignature Friend NotInheritable Class ChangeSignatureFormattingRule Inherits BaseFormattingRule Public Overrides Sub AddIndentBlockOperationsSlow(list As List(Of IndentBlockOperation), node As SyntaxNode, ByRef nextOperation As NextIndentBlockOperationAction) nextOperation.Invoke() If node.IsKind(SyntaxKind.ParameterList) OrElse node.IsKind(SyntaxKind.ArgumentList) Then AddChangeSignatureIndentOperation(list, node) End If End Sub Private Shared Sub AddChangeSignatureIndentOperation(list As List(Of IndentBlockOperation), node As SyntaxNode) If node.Parent IsNot Nothing Then Dim firstToken As SyntaxToken = node.GetFirstToken() Dim lastToken As SyntaxToken = node.GetLastToken() list.Add(FormattingOperations.CreateRelativeIndentBlockOperation( node.Parent.GetFirstToken(), firstToken, lastToken, New TextSpan(firstToken.SpanStart, lastToken.Span.End - firstToken.SpanStart), indentationDelta:=1, option:=IndentBlockOption.RelativeToFirstTokenOnBaseTokenLine)) End If End Sub Public Overrides Function GetAdjustNewLinesOperationSlow(ByRef previousToken As SyntaxToken, ByRef currentToken As SyntaxToken, ByRef nextOperation As NextGetAdjustNewLinesOperation) As AdjustNewLinesOperation If previousToken.IsKind(SyntaxKind.CommaToken) AndAlso (previousToken.Parent.IsKind(SyntaxKind.ParameterList) OrElse previousToken.Parent.IsKind(SyntaxKind.ArgumentList)) Then Return FormattingOperations.CreateAdjustNewLinesOperation(0, AdjustNewLinesOption.PreserveLines) End If Return MyBase.GetAdjustNewLinesOperationSlow(previousToken, currentToken, nextOperation) End Function End Class End Namespace