Getting a reference to default export of js/ts/vue files in a directory?

Answered

My end goal is to be able to navigate to the default export of a file when the user calls CTRL+Clicks on the text in a call to `renderJs('Users/Index')`

The final path should be `{project_root}/js/Pages/{provided_path}.{extension}` so give the above relative to the project root it would be `js/Pages/Users/Index.{js,jsx,ts,tsx,vue}`

All I know is:

  • Relative to the project root the files are in js/Pages
  • They could be in subdirectories like js/Pages/Users
  • The files are either .js, .jsx, .ts, .tsx, or .vue files

I'm pretty lost on doing this as I'm still learning Kotlin as I go so would love an example of getting all the default exports under that directory, and then filtering that list to those with the matching filename given a string. I should be able to work out actually adding the reference provider from there!

I want to do basically what the built in Laravel support does when you call `view('my.view')` but unfortunately that's closed source so I can't use it for reference. 

1 comment
Comment actions Permalink

Use PsiReference resolving to matching file(s), collected using FilenameIndex and filtered according to required parent directory structure.

0

Please sign in to leave a comment.