Skip to content

Fix deprecation warnings #790

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 3, 2023
Merged
Show file tree
Hide file tree
Changes from all 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: 1 addition & 1 deletion Sources/SourceKitLSP/DocumentTokens.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ extension DocumentSnapshot {
return self.tokens.semantic
}
let range = range.flatMap({ $0.byteSourceRange(in: self) })
?? ByteSourceRange(offset: 0, length: tree.byteSize)
?? ByteSourceRange(offset: 0, length: tree.totalLength.utf8Length)
return tree
.classifications(in: range)
.flatMap({ $0.highlightingTokens(in: self) })
Expand Down
12 changes: 6 additions & 6 deletions Sources/SourceKitLSP/Swift/SwiftLanguageServer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1124,7 +1124,7 @@ extension SwiftLanguageServer {
end: node.rightBrace.positionAfterSkippingLeadingTrivia.utf8Offset)
}

override func visit(_ node: MemberDeclBlockSyntax) -> SyntaxVisitorContinueKind {
override func visit(_ node: MemberBlockSyntax) -> SyntaxVisitorContinueKind {
return self.addFoldingRange(
start: node.members.position.utf8Offset,
end: node.rightBrace.positionAfterSkippingLeadingTrivia.utf8Offset)
Expand All @@ -1150,14 +1150,14 @@ extension SwiftLanguageServer {

override func visit(_ node: FunctionCallExprSyntax) -> SyntaxVisitorContinueKind {
return self.addFoldingRange(
start: node.argumentList.position.utf8Offset,
end: node.argumentList.endPosition.utf8Offset)
start: node.arguments.position.utf8Offset,
end: node.arguments.endPosition.utf8Offset)
}

override func visit(_ node: SubscriptExprSyntax) -> SyntaxVisitorContinueKind {
override func visit(_ node: SubscriptCallExprSyntax) -> SyntaxVisitorContinueKind {
return self.addFoldingRange(
start: node.argumentList.position.utf8Offset,
end: node.argumentList.endPosition.utf8Offset)
start: node.arguments.position.utf8Offset,
end: node.arguments.endPosition.utf8Offset)
}

__consuming func finalize() -> Set<FoldingRange> {
Expand Down
8 changes: 4 additions & 4 deletions Tests/SKSwiftPMWorkspaceTests/SwiftPMWorkspaceTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ final class SwiftPMWorkspaceTests: XCTestCase {
buildSetup: TestSourceKitServer.serverOptions.buildSetup)

let aswift = packageRoot.appending(components: "Sources", "lib", "a.swift")
let hostTriple = ws.buildParameters.triple
let hostTriple = ws.buildParameters.targetTriple
let build = buildPath(root: packageRoot, platform: hostTriple.platformBuildPathComponent())

XCTAssertEqual(ws.buildPath, build)
Expand Down Expand Up @@ -162,7 +162,7 @@ final class SwiftPMWorkspaceTests: XCTestCase {
buildSetup: config)

let aswift = packageRoot.appending(components: "Sources", "lib", "a.swift")
let hostTriple = ws.buildParameters.triple
let hostTriple = ws.buildParameters.targetTriple
let build = buildPath(root: packageRoot, config: config, platform: hostTriple.platformBuildPathComponent())

XCTAssertEqual(ws.buildPath, build)
Expand Down Expand Up @@ -349,7 +349,7 @@ final class SwiftPMWorkspaceTests: XCTestCase {

let acxx = packageRoot.appending(components: "Sources", "lib", "a.cpp")
let bcxx = packageRoot.appending(components: "Sources", "lib", "b.cpp")
let hostTriple = ws.buildParameters.triple
let hostTriple = ws.buildParameters.targetTriple
let build = buildPath(root: packageRoot, platform: hostTriple.platformBuildPathComponent())

XCTAssertEqual(ws.buildPath, build)
Expand Down Expand Up @@ -427,7 +427,7 @@ final class SwiftPMWorkspaceTests: XCTestCase {
let aswift = packageRoot.appending(components: "Sources", "lib", "a.swift")
let arguments = try ws._settings(for: aswift.asURI, .swift)!.compilerArguments
check("-target", arguments: arguments) // Only one!
let hostTriple = ws.buildParameters.triple
let hostTriple = ws.buildParameters.targetTriple

#if os(macOS)
check("-target",
Expand Down