Flow-for-vscode: Don't show 'Cannot find flow in PATH' error if there is no .flowconfig file in the project

Created on 22 Dec 2017  路  5Comments  路  Source: flowtype/flow-for-vscode

Error:

[Flow] Cannot find flow in PATH. Try to install it by npm install flow-bin -g

I know most core users probably have flow installed on all of their devices, but if you are a casual user like me (I only use flow when I'm contributing to open source projects that use it) it's pretty annoying to see this error on a device in which I don't have or want flow installed. Since this error only seems to appear when I open a JavaScript file, I think a good compromise would be to only show this error if the project/workspace has a .flowconfig file.

Most helpful comment

There at least needs to be the option to turn this error off. It's so unhelpful to see this everytime i open vsCode regardless of language or project

All 5 comments

There's discussion about why this won't work in https://github.com/flowtype/flow-for-vscode/pull/95 alas, if you can think of a good answer, I'm happy to get that in.

@orta I would move the conditional you added to checkFlow() so that window.showErrorMessage is only called if both conditions are true:

  1. A .flowconfig is not found in root
  2. Flow is not found

The users who have .flowconfig in a subdirectory are then not going to care about this change since this only affects whether the error message is displayed and they probably have flow installed globally anyway.

There at least needs to be the option to turn this error off. It's so unhelpful to see this everytime i open vsCode regardless of language or project

Happy to take PRs on this 馃憤

Not really a solution but if you really jump between a lot of project in VS Code than you probably should set flow.enabled to false in the global settings and enable it (set to true) in each relevant project's workspace settings.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

FezVrasta picture FezVrasta  路  5Comments

Eugene-Musika-cpamatica picture Eugene-Musika-cpamatica  路  6Comments

ajhyndman picture ajhyndman  路  4Comments

thymikee picture thymikee  路  6Comments

wbinnssmith picture wbinnssmith  路  5Comments