Skip to content

Bhanditz/flow-for-vscode

 
 

Repository files navigation

Flow for Visual Studio Code

This extension adds Flow support for VS Code. Flow is a static type checker, designed to find type errors in JavaScript programs.

Want to help make Flow in VS Code really shine? We're looking for someone to help move this project to use the new flow-language-server support in flow. This means the flow core team would add features, and this extension will get them for almost free. If this is you, you can get set up for development easily and then contrinute to this WIP PR.

Installation

Search for "flow" in the VS Code extensions panel.

Setup

  • Flow is supported on Mac, 64-bit Windows, and Linux, follow flowtype.org to get started
  • You need a .flowconfig in your workspace to enable the flow features
  • Make sure you are able to run the flow command from the command line ( or you have flow.useNPMPackagedFlow option as true )
  • You will want to disable the TypeScript built-in extension for your project

Configuration

You can specify a configuration by amending the VS Code settings.json file. Access this through Preferences -> Settings. You must reload VS Code after installing this extension for these settings to take affect.

  • flow.pathToFlow (default: 'flow') path to Flow that will be used for VSCode (eg; "${workspaceRoot}/node_modules/.bin/flow").
  • flow.stopFlowOnExit (default: true) stop flow server on exit from Project.
  • flow.enabled (default: true) you can disable flow for some Project for example.
  • flow.useNPMPackagedFlow (default: false) you can also run Flow by defining it in your package.json.
  • flow.showStatus (default: true) If true will display a spinner in the status-bar while flow is type checking.
  • flow.runOnEdit (default: true) If true will run flow on every edit, otherwise will run only when changes are saved.
  • flow.runOnAllFiles (default: false) Run Flow on all files, No need to put //@flow comment on top of files.

Features

  • IntelliSense
  • Go to Definition / Peek Definition
  • Diagnostics (Errors, Warnings)
  • Hover type information
  • Toggle-able Code Coverage reports

Known Issues

  • There are some aspects of Flow syntax which are not supported by the default VS Code JavaScript grammar, if you're having problems with syntax try JavaScript Atom Grammar.

Debugger configuration

First, follow the instructions to setup your launch configuration file, launch.json.

To use flow-remove-types:

  • Follow the flow-remove-type Quick Start.
  • In launch.json, add "runtimeArgs": ["-r", "flow-remove-types/register"] to the "launch" configuration.

To use Babel:

  • Follow the Babel Quick Start.
  • Install babel-register.
  • In .babelrc, add "retainLines": true.
  • In launch.json, add "runtimeArgs": ["-r", "babel-register"] to the "launch" configuration.

About

This plugin is built on top of Nuclide's Flow support.

Contributing

License

See here

About

Flow for Visual Studio Code

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%