Skip to content

Commit

Permalink
Perform request on a position range
Browse files Browse the repository at this point in the history
  • Loading branch information
fwcd committed Oct 13, 2023
1 parent 02b9f81 commit 95b4166
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
///
/// - Parameters:
/// - textDocument: The document in which the macro is used.
/// - position: The position at which the macro is used.
/// - range: The range at which the macro is used.
///
/// - Returns: The macro expansion.
public struct MacroExpansionRequest: TextDocumentRequest, Hashable {
Expand All @@ -26,13 +26,14 @@ public struct MacroExpansionRequest: TextDocumentRequest, Hashable {
public var textDocument: TextDocumentIdentifier

/// The position at which the macro is used.
public var position: Position
@CustomCodable<PositionRange>
public var range: Range<Position>

public init(
textDocument: TextDocumentIdentifier,
position: Position
range: Range<Position>
) {
self.textDocument = textDocument
self.position = position
self._range = CustomCodable(wrappedValue: range)
}
}
2 changes: 1 addition & 1 deletion Sources/SourceKitLSP/Swift/SwiftLanguageServer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1303,7 +1303,7 @@ extension SwiftLanguageServer {
let command = SemanticRefactorCommand(
title: "Expand Macro",
actionString: "source.refactoring.kind.expand.macro",
positionRange: req.position..<req.position,
positionRange: req.range,
textDocument: req.textDocument
)

Expand Down

0 comments on commit 95b4166

Please sign in to comment.