Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible to do JSX props autocomplete? #38

Open
zerkalica opened this issue Oct 6, 2016 · 6 comments
Open

Possible to do JSX props autocomplete? #38

zerkalica opened this issue Oct 6, 2016 · 6 comments

Comments

@zerkalica
Copy link

It's possible to do jsx props autocomplete ?

// @flow
function A(props: {a: string}) {
    return <div/>
}
function B() {
    return <A/> // Ctrl+Enter does not autocomplete A props
}
@steelbrain
Copy link
Owner

I wish we could do that, but Flow doesn't provide that kind-of information for JSX values. We could get it from flow by a series of requests but it would get too slow and rather unnecessary.

Soon you'll have the ability to ctrl+click or option+click on a variable to goto it's declaration so I suppose you won't even need this :)

@zerkalica
Copy link
Author

zerkalica commented Oct 6, 2016

Do you mean hyperclick plugin from nuclide or something else? Hyperclick unusable with reimports.

// @flow
// My.js
export class My {}
// @flow
// a.js
import {My} from './My'

export {My}
// @flow
// b.js
import {My} from './a'
const my = new My() // jumping to My is not working

@steelbrain
Copy link
Owner

I didn't mean a hyperclick plugin, I meant a declarations plugin :)

and not necessarily a plugin, just support in this package

@stunaz
Copy link

stunaz commented Aug 22, 2017

Any updates on this?

@steelbrain
Copy link
Owner

Yep! We support JSX props autocomplete now, but to have the autocomplete you have to make Flow understand the signature of the components, for example

type Props = {
  name: string,
}

const MyComponent = (props: Props) => (
  <div>{props.name}</div>
)
<MyComponent na/* suggestions will appear here */

@stunaz
Copy link

stunaz commented Aug 22, 2017

nope, it does work for me, used your example above. not that I am using flow 0.53.1 and the language of the file is market Babel es6 Javascript

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants