You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is it reproducible with SwiftPM command-line tools: swift build, swift test, swift package etc?
Confirmed reproduction steps with SwiftPM CLI.
Description
SwiftPM diagnostics for the Package.swift show up at a different line/column than SourceKit-LSP. In this picture the first diagnostics is from SourceKit and shows up at right place, but SwiftPM indicates the diagnostic is on the next line
Expected behavior
No response
Actual behavior
No response
Steps to reproduce
Set macOS platform to v13 in Package.swift
Set swift tool version to 5.6: // swift-tools-version: 5.6
Save file and swift package resolve
Notice output:
As you can see in the picture above the line was line 9, so line is off by one, but the column seems right
Swift Package Manager version/commit hash
No response
Swift & OS version (output of swift --version ; uname -a)
swift-driver version: 1.110 Apple Swift version 6.0 (swiftlang-6.0.0.4.52 clang-1600.0.21.1.3)
Target: arm64-apple-macosx15.0
The text was updated successfully, but these errors were encountered:
…#7795)
Fixes issue #7688
SwiftPM was implicitly prepending the manifest with 'import Foundation'
for toolchains using Swift toolchain versions 5.7 and under. The
original file itself was never overwritten, thus the diagnostics being
reported would always present on the next line.
This is a quick fix that appends the same line to the end of the
manifest; doing so assures that the intended behaviour doesn't change,
but allows for correct diagnostics to be reported.
### Motivation:
Diagnostics would present on the incorrect line for Package.swift files
using tools version 5.7 and under.
### Modifications:
When evaluating the manifest, a temporary directory copies the contents
of the manifest to a temporary file; rather than prepending the import
to Foundation at the top of the file (causing all lines in the
diagnostic reports to be off by one), append the import to the bottom of
the temporary manifest when dealing with tools versions 5.7 and under.
### Result:
The intended behaviour that requires users to explicitly import
Foundation doesn't change for Swift versions 5.8 and up; diagnostics
reported for Package.swift files for those using swift <= 5.7 will now
show on the correct line.
Is it reproducible with SwiftPM command-line tools:
swift build
,swift test
,swift package
etc?Description
SwiftPM diagnostics for the Package.swift show up at a different line/column than SourceKit-LSP. In this picture the first diagnostics is from SourceKit and shows up at right place, but SwiftPM indicates the diagnostic is on the next line

Expected behavior
No response
Actual behavior
No response
Steps to reproduce
// swift-tools-version: 5.6
swift package resolve
Notice output:

As you can see in the picture above the line was line 9, so line is off by one, but the column seems right
Swift Package Manager version/commit hash
No response
Swift & OS version (output of
swift --version ; uname -a
)swift-driver version: 1.110 Apple Swift version 6.0 (swiftlang-6.0.0.4.52 clang-1600.0.21.1.3)
Target: arm64-apple-macosx15.0
The text was updated successfully, but these errors were encountered: