IntelliJ & Webstorm not autocompleting propTypes

Answered

On my new Mac I've installed IntelliJ 2017.1.5 as well as node v6.11 and create-react-app 1.3.3.  Everything works great except for IntelliJ and Webstorm do not autocomplete propTypes for imported node_modules.  On my Ubuntu Box, I'm running IntelliJ 2016.? and I have no issues, but when I installed 2017, I had the same issue.  I've tried invalidating the cache, but it happens on any fresh creation of a react app.  I'm currently running MacOS: Sierra 10.12.5.

 

3 comments

Please can you provide code snippets/files that show up the issue? Are the modules you import propTypes from included in project (make sure that the corresponding folders are not marked as excluded)

0

Well it's all react propTypes that show the issue.  On my other Ubuntu machine (IntelliJ 2016), I can import a component from an imported library like react-md or material-ui and when I used the component the auto-complete feature would give me a list of propTypes for that component.  However on that same machine, using any version of IntelliJ 2017, that functionality is lost, in addition all versions on my MacBook Pro.  When I try and use Ctl-space, I just get a red pop-up saying 'no suggestions'.  A very simple example below, where <Button /> is a component I'd expect to get a list of propTypes.

import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';

import Button from 'material-ui/Button'

class App extends Component {
render() {
return (
<div className="App">
<div className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<h2>Welcome to React</h2>
</div>
<Button />
<p className="App-intro">
To get started, edit <code>src/App.js</code> and save to reload.
</p>
</div>
);
}
}

export default App;

The project here only has react, react-dom & material-ui pulled from npm (with their dependencies of course)

'node_module' is marked as being excluded, however, the folders within, which are identified by the 'package.json', are unmarked and the remaining folders are also marked excluded.  

0

thanks for the sample:) WebStorm doesn't understand the way material-ui components are defined in transpiled code. Please follow https://youtrack.jetbrains.com/issue/WEB-27882 for updates

0

Please sign in to leave a comment.