sifive / wake

The SiFive wake build tool
Other
86 stars 28 forks source link

VS Code extension "Go to Definition" for an exported type doesn't work correctly #1252

Open bmitc opened 1 year ago

bmitc commented 1 year ago

When exporting a type via:

from <package> export type <type>

VS Code navigates to a usage of the type instead of the actual definition of the data type when right-clicking <type> and selecting Go to Definition. Additionally, it peeks the usage instead of actually navigating to it.

bmitc commented 1 year ago

I tried creating a minimally reproducing example, since the original issue was noticed in a large codebase.

package extension_test

from extension_test export type TestType

tuple TestType =
    export TestField: Boolean

export def helper: TestType =
    TestType True

export def testFunction (testType: TestType): Boolean =
    testType.getTestTypeTestField

However, here, the Go to Definition is currently not working at all for the export type TestType (it just does nothing), but in the case of clicking Go to Definition for tuple TestType, it peeks a usage of the type (whereas I'm already at the definition). For example, in the below screenshot, I right-clicked TestType in line 5 and selected Go to Definition.

image

So it looks like that it sometimes returns the references of a type instead of going to the definition.