flow / flow-for-vscode

Flow for Visual Studio Code
Other
994 stars 111 forks source link

Provide more types for completion items #4

Open bpasero opened 9 years ago

bpasero commented 9 years ago

Currently we only use Function, Class and Variable as types for completion items because we are not getting more information from Flow.

orta commented 7 years ago

Link to all available types: https://code.visualstudio.com/docs/extensionAPI/vscode-api#_a-namecompletionitemkindaspan-classcodeitem-id715completionitemkindspan

I feel like Flow probably has Files and Enums also in the current API that could be exposed

orta commented 7 years ago

Enum Examples:

Country here is an Enum

const countries = {
  US: 'United States',
  IT: 'Italy',
  FR: 'France',
}
type Country = $Keys<typeof countries>;

const italy: Country = 'IT'

and Suit here

type Suit =
  | "Diamonds"
  | "Clubs"
  | "Hearts"
  | "Spades";

const thing: Suit = 'Clubs'

For files: from CHANGELOG

Flow now watches for .css, .jpg, .png, .gif, .eot, .svg, .ttf, .woff, .woff2, .mp4 and .webm files (this list is not configurable at the moment). We call them resource files. If you require a resource file, you get a string (except for .css files, for which you get an Object). You should still be able to use module.name_mapper to map a resource file to a mock, if you prefer.

Random example on tiny project:

$ flow ls 

/Users/orta/dev/js/apps/relational-theory/webpack.config.js
/Users/orta/dev/js/apps/relational-theory/package.json
/Users/orta/dev/js/apps/relational-theory/index.js
/Users/orta/dev/js/apps/relational-theory/flow-typed/npm/webpack_vx.x.x.js
/Users/orta/dev/js/apps/relational-theory/flow-typed/npm/webpack-hot-middleware_vx.x.x.js
/Users/orta/dev/js/apps/relational-theory/flow-typed/npm/webpack-dev-middleware_vx.x.x.js
/Users/orta/dev/js/apps/relational-theory/flow-typed/npm/react-relay_vx.x.x.js
/Users/orta/dev/js/apps/relational-theory/flow-typed/npm/react-native-web_vx.x.x.js
/Users/orta/dev/js/apps/relational-theory/flow-typed/npm/react-hot-loader_vx.x.x.js
/Users/orta/dev/js/apps/relational-theory/flow-typed/npm/morgan_vx.x.x.js
/Users/orta/dev/js/apps/relational-theory/flow-typed/npm/jest_v18.x.x.js
/Users/orta/dev/js/apps/relational-theory/flow-typed/npm/isomorphic-relay_vx.x.x.js
/Users/orta/dev/js/apps/relational-theory/flow-typed/npm/gql2flow_vx.x.x.js
/Users/orta/dev/js/apps/relational-theory/flow-typed/npm/flow-bin_v0.x.x.js
/Users/orta/dev/js/apps/relational-theory/flow-typed/npm/express_v4.x.x.js
/Users/orta/dev/js/apps/relational-theory/flow-typed/npm/eslint_vx.x.x.js
/Users/orta/dev/js/apps/relational-theory/flow-typed/npm/eslint-plugin-standard_vx.x.x.js
/Users/orta/dev/js/apps/relational-theory/flow-typed/npm/eslint-plugin-react_vx.x.x.js
/Users/orta/dev/js/apps/relational-theory/flow-typed/npm/eslint-plugin-promise_vx.x.x.js
/Users/orta/dev/js/apps/relational-theory/flow-typed/npm/eslint-plugin-import_vx.x.x.js
/Users/orta/dev/js/apps/relational-theory/flow-typed/npm/eslint-plugin-flowtype_vx.x.x.js
/Users/orta/dev/js/apps/relational-theory/flow-typed/npm/eslint-config-standard_vx.x.x.js
/Users/orta/dev/js/apps/relational-theory/flow-typed/npm/chokidar_vx.x.x.js
/Users/orta/dev/js/apps/relational-theory/flow-typed/npm/babel-relay-plugin_vx.x.x.js
/Users/orta/dev/js/apps/relational-theory/flow-typed/npm/babel-preset-stage-3_vx.x.x.js
/Users/orta/dev/js/apps/relational-theory/flow-typed/npm/babel-preset-react_vx.x.x.js
/Users/orta/dev/js/apps/relational-theory/flow-typed/npm/babel-preset-es2015_vx.x.x.js
/Users/orta/dev/js/apps/relational-theory/flow-typed/npm/babel-polyfill_vx.x.x.js
/Users/orta/dev/js/apps/relational-theory/flow-typed/npm/babel-plugin-transform-regenerator_vx.x.x.js
/Users/orta/dev/js/apps/relational-theory/flow-typed/npm/babel-plugin-transform-react-jsx_vx.x.x.js
/Users/orta/dev/js/apps/relational-theory/flow-typed/npm/babel-plugin-transform-flow-strip-types_vx.x.x.js
/Users/orta/dev/js/apps/relational-theory/flow-typed/npm/babel-plugin-transform-class-properties_vx.x.x.js
/Users/orta/dev/js/apps/relational-theory/flow-typed/npm/babel-plugin-syntax-async-functions_vx.x.x.js
/Users/orta/dev/js/apps/relational-theory/flow-typed/npm/babel-loader_vx.x.x.js
/Users/orta/dev/js/apps/relational-theory/flow-typed/npm/babel-eslint_vx.x.x.js
/Users/orta/dev/js/apps/relational-theory/flow-typed/npm/babel-cli_vx.x.x.js
/Users/orta/dev/js/apps/relational-theory/data/schema.json
/Users/orta/dev/js/apps/relational-theory/data/schema.js
/Users/orta/dev/js/apps/relational-theory/data/graphql-export.flow.js
/Users/orta/dev/js/apps/relational-theory/app/routes.js
/Users/orta/dev/js/apps/relational-theory/app/relay/root_queries.js
/Users/orta/dev/js/apps/relational-theory/app/relay/config.js
/Users/orta/dev/js/apps/relational-theory/app/containers/artist/index.js
/Users/orta/dev/js/apps/relational-theory/app/containers/artist/components/header.js
/Users/orta/dev/js/apps/relational-theory/app/containers/artist/browser.js
/Users/orta/dev/js/apps/relational-theory/app/containers/artist/_stories/_header.story.js
/Users/orta/dev/js/apps/relational-theory/app/_tests/storyshots.test.js
/Users/orta/dev/js/apps/relational-theory/.vscode/settings.json
/Users/orta/dev/js/apps/relational-theory/.vscode/launch.json
/Users/orta/dev/js/apps/relational-theory/.storybook/webpack.config.js
/Users/orta/dev/js/apps/relational-theory/.storybook/config.js