Hi.
I'm seeing references to "XYZ.swiftmodule" in sourcekit-lsp responses that have negative line/col information.
With vscode running on Linux (5.2 or master branch of sourcekit-lsp) that seems to break some of the behaviour around 'Go to Definition/Implementation'.
I've tried two workarounds:
(1) Filter out ".swiftmodule" completely. This is the best solution for vscode, it works as I would expect. It finds a primary location and jumps to it.
(2) Limit the line/col to >= 0 values. vscode now presents 2 definitions, one location in a .swift source file but another in a .swiftmodule thing that it doesn't know how to handle. It's somewhat random as to the order of these and it just doesn't work as I would expect.
Some questions: are we supposed to be seeing ".swiftmodule" in the responses? Shouldn't SourceKit filter those out if it finds a real definition? Can returning swiftmodule not be put on a capabilities flag so that vscode (and other language servers) don't present weird looking definitions while allowing xcode to do what it needs? I'm jumping ahead and assuming it's based on the same code!
On a related note, since Xcode 11.x, I've noticed that it jumps into some generated "swiftmodule" rather than going directly to the source code implementation in the same project. I'm assuming this is all connected but it's not pleasant behaviour for xcode either.
Thanks!
Example response:
[Trace - 6:37:10 AM] Received response 'textDocument/implementation - (35)' in 8ms.
Result: [
{
"range": {
"end": {
"character": -1,
"line": -1
},
"start": {
"line": -1,
"character": -1
}
},
"uri": "file:///...../SomeModule.swiftmodule"
},
{
"range": {
"end": {
"line": 48,
"character": 34
},
"start": {
"line": 48,
"character": 34
}
},
"uri": "file:///...../SourceFile.swift"
}
]