Feature: Read open modules w/ VSCode extension

One of the nice features of having “import” in JS/TS is knowing every package that is (or is not) imported in my file.

At the moment, Rescript sometimes feels a little “too” magic! Where the fuck are these packages coming from?

OR why can I not access that dependency “I am sure I added in bsconfig”?.

Could the vscode extension provide a list of the accessible modules in the current scope?

I think a lens at the top of the file might work.

Sometimes, my names are wrong, sometimes I don’t import the correct module, etc

2 Likes

Looks like there are 2 aspects:
1 discovery: that seems like the job of autocomplete, and should already work right now
2 documentation: that seems like the job for a lense (to be optionally turned on via configuration)

Dies that look right?
If so, 2 is a good candidate for an issue to be opened on the rescript-vscode repository.

Is this something that could be covered by hover? By ensuring that hovering modules always show their full origin path, or something similar.

2 Likes

It depends on the use case.
If the use case is: where is this coming from? Then hovering should handle it.
If the use case is: tell me everything that this file uses, then it’s more like a lense.
Either way, it would be good to spell out what the use case is and what utility is derived from it.

1 Like

It is definitely the latter. Autocomplete works great if I know the top level module, but falls short when there it nothing “to complete”. It might even be better to have a command that prints a list of open Modules in the terminal as a POC.

Notice autocomplete can be triggered before typing any text, and will show all modules in scope.

E.g.:

2 Likes

Hm. Maybe this is what I wanted :sweat_smile:

3 Likes