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

Unable to use this plugin with locally installed flow #209

Closed
vampolo opened this issue Feb 17, 2018 · 4 comments
Closed

Unable to use this plugin with locally installed flow #209

vampolo opened this issue Feb 17, 2018 · 4 comments

Comments

@vampolo
Copy link

vampolo commented Feb 17, 2018

Hi.

I've flow installed in my node_modules folder and i setup "flow.useNPMPackagedFlow": true, in the configuration as suggested in the readme to use locally installed flow but i still get the error that [Flow] Cannot find flow in PATH. Try to install it by npm install flow-bin -g

Is it possible to do not install flow globally and still use this plugin?

@FezVrasta
Copy link

FezVrasta commented Feb 21, 2018

I have the same problem, actually the project structure is as follows:

- folder1/
  - folder2/
    - node_modules
    - index.js

So I think the problem is that this plugin looks only for node_modules on the top of the workspace folder and not on subfolders.

Maybe you may add a workspace specific setting to define the position of the flow binary?

I tried to use the flow.pathToFlow setting, setting it to ./folder1/folder2/node_modules/.bin/flow but it still says that it can't find the flow binary in PATH 🤷‍♂️

@peterschussheim
Copy link

@orta @gabelevi (sorry for mention, however, this issue is still a problem).

I'd be happy to make a PR for this fix, provided I understand why the existing support for local flow binary fails.

@peterboyer
Copy link

Yep, "flow.useNPMPackagedFlow": true does work as expected only if node_modules is available at the root of the project workspace.

And "flow.pathToFlow" does work as expected with an absolute path, but that means that workspace is unique to my machine, which is alright for now.

However, "flow.useNPMPackagedFlow" doesn't work when the node_modules folder is nested in a workspace subfolder. I think the best approach would be to be allow "flow.pathToFlow" to specify a relative folder to source flow from, as @FezVrasta suggested, something like: "./frontend/node_modules/.bin/flow" or "${project}/frontend/node_modules/.bin/flow"

Definitely would love to see this resolved, currently working in a workspace structure like this, and would love to not need to only inspect one folder as a workspace at a time to get flow support! Cheers!

- myproject/
  - frontend/
    - node_modules/
      - .bin/flow (would be great to point to this one)
    - index.js
  - backend/
    - node_modules/
    - index.js

@orta
Copy link
Contributor

orta commented Apr 16, 2018

That sounds like a pretty reasonable way to do it, yep

Mayank1791989 added a commit to Mayank1791989/flow-for-vscode that referenced this issue Feb 16, 2019
Client (closes flow#302, flow#304, flow#253, flow#228, flow#201, flow#195, flow#189, flow#184, flow#165, flow#81)
- add multi flowconfig support
- add vscode multi-root workspace support
- client is now lazily created if flowconfig found
- fix document selector.

New implementation will handle following cases
- Single workspace with multiple flowconfig
- Multiple workspace with multiple flowconfig

Get Flow-Bin
- improve|fix logic to find flow-bin (fixes flow#282, flow#240, flow#209)
- fix flow bundled with plugin not working
  issue: we are using .bin/flow but vscode never includes .bin in plugin package
- add logs while finding flow-bin to debug issues
- plugin now doesn't check for node (closes flow#290)
- pathToFlow: value is normalized and .cmd is added so same value can
be used for linux, osx & win

Error handling (closes flow#200)
- [feat] improve error handling.
- [feat] Show action in errors so that user can recover from error
  without restarting vscode

Commands
- [feat] Add commands
  - Toggle coverage
  - Show client status
  - Restart Client
  - Log Client Debug Info
  - Show output channel

Status Widget
Include more info in status widget to help user know what this plugin is using
- [feat] include flow version
- [feat] add flow info section in widget tooltip which includes
  - path to .flowconfig
  - flow version
  - path to "flow" binary

Settings
- flow.coverageSeverity to control type coverage diagnostic severity
- flow.useBundledFlow control use of flow bundled with this plugin
- flow.trace.server log communication between vscode and flow lsp
- flow.logLevel control log level of plugin logs
Mayank1791989 added a commit to Mayank1791989/flow-for-vscode that referenced this issue Feb 18, 2019
Client (closes flow#302, flow#308, flow#253, flow#228, flow#201, flow#195, flow#189, flow#184, flow#165, flow#81)
- add multi flowconfig support
- add vscode multi-root workspace support
- client is now lazily created if flowconfig found
- fix document selector.

New implementation will handle following cases
- Single workspace with multiple flowconfig
- Multiple workspace with multiple flowconfig

Get Flow-Bin
- improve|fix logic to find flow-bin (fixes flow#282, flow#240, flow#209)
- fix flow bundled with plugin not working
  issue: we are using .bin/flow but vscode never includes .bin in plugin package
- add logs while finding flow-bin to debug issues
- plugin now doesn't check for node (closes flow#290)
- pathToFlow: value is normalized and .cmd is added so same value can
be used for linux, osx & win

Error handling (closes flow#200)
- [feat] improve error handling.
- [feat] Show action in errors so that user can recover from error
  without restarting vscode

Commands
- [feat] Add commands
  - Toggle coverage
  - Show client status
  - Restart Client
  - Log Client Debug Info
  - Show output channel

Status Widget
Include more info in status widget to help user know what this plugin is using
- [feat] include flow version
- [feat] add flow info section in widget tooltip which includes
  - path to .flowconfig
  - flow version
  - path to "flow" binary

Settings
- flow.coverageSeverity to control type coverage diagnostic severity
- flow.useBundledFlow control use of flow bundled with this plugin
- flow.trace.server log communication between vscode and flow lsp
- flow.logLevel control log level of plugin logs
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants