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

Can't get suggestion from an imported class (only from inside the same js file) #62

Open
gino8080 opened this issue Aug 27, 2018 · 9 comments
Assignees

Comments

@gino8080
Copy link

🐛 bug report

To Reproduce

Steps to reproduce the behavior:

  1. create an app with create-react-app
  2. inside the default App.js component add some prop-types
  3. in the index.js file press CTRL-SPACE to get prop suggestion

🤔 Expected Behavior

Vscode should suggest custom props

😯 Current Behavior

no suggestion from custom props added,
Only got suggestions INSIDE same .js file

Screenshots

no suggestion from custom props added
no suggestion from custom props added

Only got suggestions INSIDE same .js file
Only got suggestions INSIDE same .js file

Environment

  • OS: macOS 10.13.4 (17E202)
  • VS Code Version 1.26.1 (1.26.1)

Additional context

@kv4sha
Copy link
Contributor

kv4sha commented Aug 27, 2018

This issue related with #61
I think the problem is:
"export default" wrote on the end of the file instead of the same line with component name
Now we've been thinking how to fix this

@gino8080
Copy link
Author

gino8080 commented Sep 3, 2018

moving export default on the same line of the class component don't seems to solve :(

@kv4sha
Copy link
Contributor

kv4sha commented Sep 3, 2018

@gino8080
Could you go to implementation to the component?
Press command+left click to the component name

@gino8080
Copy link
Author

gino8080 commented Sep 3, 2018

ok so now I got it working i had to:
-put the export default on the same definition line
-changing the "any" type of the propTypes with object

the any PropTypes type was breaking all suggestions,
so this was NOT working:

  static propTypes = {
    fields: PropTypes.any.isRequired, //this breaked all
    schema: PropTypes.node,
    onFormChanged: PropTypes.func,
    onSubmit: PropTypes.func,
    debug: PropTypes.bool
  };

setting type to object and now it's working

  static propTypes = {
    fields: PropTypes.object.isRequired, //now it works
    schema: PropTypes.node,
    onFormChanged: PropTypes.func,
    onSubmit: PropTypes.func,
    debug: PropTypes.bool
  };

hope this helps

@emroot
Copy link

emroot commented Nov 9, 2018

any update on this?

thanks

@kv4sha kv4sha self-assigned this Nov 11, 2018
@drpiou
Copy link

drpiou commented Jan 6, 2019

I can go to the component name with Press command+left click, but without any "any" it simply doesn't work for me, export on same line or not.

@TimCluyts
Copy link

I have the same issue as already described. Only working in the same file.

@pietervanneste
Copy link

Same issue here, any update on this?

@Saibamen
Copy link

Saibamen commented May 2, 2019

Same issue here: facebook/create-react-app#6969
It's also didn't work outside of component - I only have ref, children and key suggestions from React

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

7 participants