Skip to content
Open
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Sources/SwiftLanguageService/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ add_library(SwiftLanguageService STATIC
CodeActions/ConvertIntegerLiteral.swift
CodeActions/ConvertJSONToCodableStruct.swift
CodeActions/ConvertStringConcatenationToStringInterpolation.swift
CodeActions/ForEachToForInCodeAction.swift
CodeActions/PackageManifestEdits.swift
CodeActions/RemoveUnusedImports.swift
CodeActions/SharedCursorInfo.swift
CodeActions/SyntaxCodeActionProvider.swift
CodeActions/SyntaxCodeActions.swift
CodeActions/SyntaxRefactoringCodeActionProvider.swift
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ package struct AddDocumentation: EditRefactoringProvider {
}

extension AddDocumentation: SyntaxRefactoringCodeActionProvider {
static func nodeToRefactor(in scope: SyntaxCodeActionScope) -> Input? {
static func nodeToRefactor(in scope: CodeActionScope) -> Input? {
return scope.innermostNodeContainingRange?.findParentOfSelf(
ofType: DeclSyntax.self,
stoppingIf: { $0.is(CodeBlockItemSyntax.self) || $0.is(MemberBlockItemSyntax.self) || $0.is(ExprSyntax.self) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ package import SwiftSyntax
///
/// This code action supports both boolean (`!`, `&&`, `||`) and bitwise (`~`, `&`, `|`) operators.
struct ApplyDeMorganLaw: SyntaxCodeActionProvider {
static func codeActions(in scope: SyntaxCodeActionScope) -> [CodeAction] {
static func codeActions(in scope: CodeActionScope) async -> [CodeAction] {
guard let node = scope.innermostNodeContainingRange else {
return []
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ struct ConvertCommentToDocComment: SyntaxRefactoringProvider {
extension ConvertCommentToDocComment: SyntaxRefactoringCodeActionProvider {
static let title = "Convert Comment to Doc Comment"

static func nodeToRefactor(in scope: SyntaxCodeActionScope) -> DeclSyntax? {
static func nodeToRefactor(in scope: CodeActionScope) -> DeclSyntax? {
let cursorPosition = scope.snapshot.absolutePosition(of: scope.request.range.lowerBound)
guard let token = scope.file.token(at: cursorPosition) else {
return nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import SwiftSyntaxBuilder
/// return value
/// ```
@_spi(Testing) public struct ConvertIfLetToGuard: SyntaxCodeActionProvider {
static func codeActions(in scope: SyntaxCodeActionScope) -> [CodeAction] {
static func codeActions(in scope: CodeActionScope) async -> [CodeAction] {
guard let ifExpr = findConvertibleIfExpr(in: scope) else {
return []
}
Expand Down Expand Up @@ -115,7 +115,7 @@ import SwiftSyntaxBuilder
]
}

private static func findConvertibleIfExpr(in scope: SyntaxCodeActionScope) -> IfExprSyntax? {
private static func findConvertibleIfExpr(in scope: CodeActionScope) -> IfExprSyntax? {
var node: Syntax? = scope.innermostNodeContainingRange
while let c = node, !isFunctionBoundary(c) {
if let ifExpr = c.as(IfExprSyntax.self) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ extension IntegerLiteralExprSyntax.Radix {
/// Syntactic code action provider to convert integer literals between
/// different bases.
struct ConvertIntegerLiteral: SyntaxCodeActionProvider {
static func codeActions(in scope: SyntaxCodeActionScope) -> [CodeAction] {
static func codeActions(in scope: CodeActionScope) async -> [CodeAction] {
guard
let token = scope.innermostNodeContainingRange,
let integerExpr = token.parent?.as(IntegerLiteralExprSyntax.self),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ package struct ConvertJSONToCodableStruct: EditRefactoringProvider {
}

extension ConvertJSONToCodableStruct: SyntaxRefactoringCodeActionProvider {
static func nodeToRefactor(in scope: SyntaxCodeActionScope) -> Syntax? {
static func nodeToRefactor(in scope: CodeActionScope) -> Syntax? {
var node: Syntax? = scope.innermostNodeContainingRange
while let unwrappedNode = node, ![.codeBlockItem, .memberBlockItem].contains(unwrappedNode.kind) {
if preflightRefactoring(unwrappedNode) != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ struct ConvertStringConcatenationToStringInterpolation: SyntaxRefactoringProvide
extension ConvertStringConcatenationToStringInterpolation: SyntaxRefactoringCodeActionProvider {
static let title: String = "Convert String Concatenation to String Interpolation"

static func nodeToRefactor(in scope: SyntaxCodeActionScope) -> SequenceExprSyntax? {
static func nodeToRefactor(in scope: CodeActionScope) -> SequenceExprSyntax? {
guard let expr = scope.innermostNodeContainingRange,
let seqExpr = expr.findParentOfSelf(
ofType: SequenceExprSyntax.self,
Expand Down
Loading