-
Notifications
You must be signed in to change notification settings - Fork 326
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Swift version
swift-driver version: 1.90.11.1 Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)
Platform
macOS 14.5
Editor
VS Code
Does the issue reproduce with Swift 6?
Yes
Description
The related information attached to diagnostics reference the wrong file. It references the file the diagnostic occurred and not the file the related information is in.
Steps to Reproduce
- In a VS Code project add file Test.swift with the following lines
@available(*, unavailable)
struct Test {}
- In a second file Test2.swift reference type
Test
func test() {
let t = Test()
}
- Notice diagnostic
'Test' is unavailable
and then notice that the related information'Test' has been explicitly marked unavailable here
references a location in Test2.swift and not Test.swift
Logging
Here is the related response from the SourceKit-LSP output log
[Trace - 15:28:16] Received response 'textDocument/diagnostic - (423)' in 5ms.
Result: {
"kind": "full",
"items": [
{
"tags": [
1
],
"range": {
"start": {
"line": 1,
"character": 8
},
"end": {
"line": 1,
"character": 8
}
},
"codeActions": [
{
"title": "Replace 'let t' with '_'",
"kind": "quickfix",
"edit": {
"changes": {
"file:///Users/adamfowler/Temp/RelatedInformation/Sources/RelatedInformation/Test2.swift": [
{
"newText": "_",
"range": {
"end": {
"character": 9,
"line": 1
},
"start": {
"line": 1,
"character": 4
}
}
}
]
}
}
}
],
"source": "sourcekitd",
"message": "initialization of immutable value 't' was never used; consider replacing with assignment to '_' or removing it",
"severity": 2
},
{
"relatedInformation": [
{
"location": {
"uri": "file:///Users/adamfowler/Temp/RelatedInformation/Sources/RelatedInformation/Test2.swift",
"range": {
"start": {
"line": 1,
"character": 7
},
"end": {
"character": 7,
"line": 1
}
}
},
"message": "'Test' has been explicitly marked unavailable here"
}
],
"source": "sourcekitd",
"severity": 1,
"range": {
"start": {
"character": 12,
"line": 1
},
"end": {
"character": 16,
"line": 1
}
},
"message": "'Test' is unavailable",
"tags": []
}
]
}
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working