VSCode with flow, how to make auto-imports work

Viewed 592

I usually work with typescript, but I've now joined a company that uses flow, I have many problems with it, but one that bothers me the most is how sluggish the tooling feels when compared to vanilla vscode with typescript.

In this particular case, I installed the Flow Language Support plugin and I've set:

"javascript.validate.enable": false,

On the workspace settings.

The problem is, as I'm typing the code I usually let vscode handle importing stuff for me, for flow this does not work, for example I would start typing <Vi.. and then accept the intellisense suggestion to import View from 'react-native', flow does nothing.

Am I doing something wrong in my configuration or is this capability not supported at all?

Edit 1:

this plugin seems to make it kinda work

Another problem that I also have is type information is just useless:

enter image description here

I don't know where the second type is coming from, javascript and typescript are both disabled on the work space, and flow refuses to show more detailed types, is there a workaround for this too?

1 Answers

With sluggishness it may be attributed to the version of flow you are running since you said you're joining an existing project. The team have been making large strides in the past year to improve the speed.

I haven't used TS personally but besides a 10 second bootup, I haven't seen any unresponsive checks with flow (I've been on v0.120 - 0.126).


As for autocomplete you might want to checkout https://github.com/jedwards1211/dude-wheres-my-module which was recommended by other flow users.

Otherwise I don't think there's a proper solution built yet but I recommend joining in the discussion on discord, as they have a dedicated auto-imports channel. Though there hasn't been much activity since September last year so I imagine they're a bit stuck or busy with other priorities.

Related