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
In the example below, the type of a is main.Int and the type of b is Swift.Int. LSP seems to ignore that the using the unqualified Int is ambiguous in this context.
class Int {}
let a = Int()
let b = 1 + 1
Steps to Reproduce
In VSCode, type hints provided by SK-LSP show the same type for both variables. When double clicking the type hint, the inserted type is ambiguous. A similar issue appears when invoking the extract expression refactoring. When we try to extract 1 + 1, the generated code looks like let extractedExpr: Int = 1 + 1.
Logging
No response
The text was updated successfully, but these errors were encountered:
It looks like the underlying SK requests never return qualified types. I added the fully_qualified option some time ago so we could process qualified types from SK. However, this makes all types qualified which might not be very user friendly when showing type hints.
There is the FullyQualifiedTypesIfAmbiguous option in PrintOptions.h, but after some quick testing the behaviour seems a bit unexpected. In the example I posted it only disambiguates the user introduced type, and not Swift.Int
Swift version
swiftlang-6.0.0.6.8
Platform
macOS 14.6.1
Editor
VSCode
Does the issue reproduce with Swift 6?
Yes
Description
In the example below, the type of
a
ismain.Int
and the type ofb
isSwift.Int
. LSP seems to ignore that the using the unqualifiedInt
is ambiguous in this context.Steps to Reproduce
In VSCode, type hints provided by SK-LSP show the same type for both variables. When double clicking the type hint, the inserted type is ambiguous. A similar issue appears when invoking the extract expression refactoring. When we try to extract
1 + 1
, the generated code looks likelet extractedExpr: Int = 1 + 1
.Logging
No response
The text was updated successfully, but these errors were encountered: