Skip to content
This repository has been archived by the owner on Dec 19, 2024. It is now read-only.

Don't load Flow if a .flowconfig cannot be found #95

Closed
wants to merge 2 commits into from

Conversation

orta
Copy link
Contributor

@orta orta commented Mar 22, 2017

Before loading up the extension it will do a check from the workspace root. To my knowledge there is no way to declare a .flowconfig in a subfolder of your project, so this should be fine. ( @gabelevi can you confirm? )

@Gozala wanna give it a review?

fixes #81

checkFlow()
findFlowConfigDir(vscode.workspace.rootPath).then(configPath => {
if (!configPath) {
console.log(`Not starting Flow: Could not find a .flowconfig after a backwards search from ${vscode.workspace.rootPath}.`)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This ends up in the vscode developer tools web inspector, which is better than nothing IMO.

@gabelevi
Copy link
Contributor

I think sometimes people have something a src/ directory and then have src/.flowconfig. So I'm not sure if calling findFlowConfigDir() from the root will be a complete check.

@orta
Copy link
Contributor Author

orta commented Mar 30, 2017

That's a good point, yeah.

I think the feature is important, think it's worth globing all folders ( removing any node_modules ) and look through all of those too?

@Gozala
Copy link
Contributor

Gozala commented Apr 5, 2017

Before loading up the extension it will do a check from the workspace root. To my knowledge there is no way to declare a .flowconfig in a subfolder of your project, so this should be fine. ( @gabelevi can you confirm? )

@Gozala wanna give it a review?

  • This seems to conflict with Add try / playground support #84 as it treats buffers / tabs with @flow pragma in js mode as flowtype.org/try editors. I often times fire up new vscode window and unsaved tab to prototype things up & I don't even have workspace setup.

  • What if .flowconfig is added afterwards ? It seems that you'd need to reload window to get the plugin loaded.

  • Also I often do have .flowconfig under project subdir, sometimes even multiple one of them for example: ./server/.flowconfig and ./client/.flowconfig.

I am not entirely sure what exactly happens during activation, but as far as I can tell flow server isn't actually started until qualified file is loaded, so I'm not exactly sure what's being fixed here.

fixes #81

@orta
Copy link
Contributor Author

orta commented Apr 6, 2017

The issue is that it does an annoying popup in any workspace the first time you click on a JavaScript file when there's no Flow connection, perhaps tying that popup to not loading up the server.

@orta
Copy link
Contributor Author

orta commented May 12, 2017

I think I could replace this with a much simpler "is this a typescript project?" check (which is the only time I don't want to be running Flow basically)

@orta
Copy link
Contributor Author

orta commented Dec 22, 2017

What I ended up doing instead of this PR, for my own setup:

  • In my personal VS Code settings, turn off flow
  • In my flow repos, add a .vscode/settings.json to turn it on

@xzilja
Copy link

xzilja commented May 6, 2018

This issue happens a lot when "flow.useNPMPackagedFlow": true is present, it shows flow error in projects that don't have .flowconfig file.

@karlhorky
Copy link

@orta @gabelevi Is it possible this feature could still be implemented in some form? If it's not bulletproof, maybe behind an option?

@gaastonsr
Copy link

This is so needed.

@orta
Copy link
Contributor Author

orta commented Sep 20, 2018

Maybe it could be an option like how prettier-vscode does - which would only make it run if there was a flowconfig in the root. I'd recommend implementing it yourself, so maybe I should just close this PR rather than have it hanging around stopping other contributors from taking a shot at the problem.

@orta orta closed this Sep 20, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Do not require global Flow
7 participants