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
Implement the textDocument/typeDefinition request, which given a source location finds the type of the symbol at that position and then returns the location of that type's definition.
To implement this, you can look at how the existing jump to defintiion request works (textDocument/definition), but instead of using the key.usr field to get the declaration's USR, you can use the key.typeusr field.
Edit: it turns out typeusr is not suitable for this (https://forums.swift.org/t/usr-vs-typeusr-in-sourcekit/27759). It looks like to implement this we'll need to add a new field to sourcekitd's cursor_info. We want the USR of the type decl when that is available. For example,
vara =1// a-> Intvarb = [1] // b -> Arrayvarc = (1, 2) // c -> nilfunctest<T>(d: [T]) {} // d-> Array
So for a bound generic type like `Dictionary<Foo, Bar>`, we want to get the Dictionary decl's USR. When the type is non-nominal, such as a tuple or function type, we can just return null.
rdar://95597953
The text was updated successfully, but these errors were encountered:
Additional Detail from JIRA
md5: 48898578051a40902ab5b8e1104d1a38
Issue Description:
Implement the
textDocument/typeDefinition
request, which given a source location finds the type of the symbol at that position and then returns the location of that type's definition.https://microsoft.github.io/language-server-protocol/specification#textDocument_typeDefinition
To implement this, you can look at how the existing jump to defintiion request works (
textDocument/definition
),but instead of using thekey.usr
field to get the declaration's USR, you can use thekey.typeusr
field.Edit: it turns out typeusr is not suitable for this (https://forums.swift.org/t/usr-vs-typeusr-in-sourcekit/27759). It looks like to implement this we'll need to add a new field to sourcekitd's cursor_info. We want the USR of the type decl when that is available. For example,
So for a bound generic type like `Dictionary<Foo, Bar>`, we want to get the Dictionary decl's USR. When the type is non-nominal, such as a tuple or function type, we can just return null.
rdar://95597953
The text was updated successfully, but these errors were encountered: