Skip to content

JSX and Salsa: Intellisense for ReactComponents does not work #2886

Closed

Description

Salsa is enabled:
bildschirmfoto 2016-02-09 um 22 13 44

But intellisense fails to offer proper React Elements:

bildschirmfoto 2016-02-10 um 10 57 12

bildschirmfoto 2016-02-10 um 10 59 01

System:
OSX 10.11.2
vscode 0.10.8
db71ac6

jsconfig.json:

{
  "compilerOptions": {
    "target": "ES6",
    "module": "system",
    "experimentalDecorators": true
  },

  "exclude": [
    "node_modules"
  ]
}

User settings:

{
  "javascript.validate.enable": false,
  "editor.tabSize": 2,
  "files.trimTrailingWhitespace": true,
  // Migrated from previous "File | Auto Save" setting:
  "files.autoSave": "onFocusChange"
}

Partial eslintrc:

 "rules": {
    "func-names": 0,
    "no-unused-expressions": 0,
    "id-length": 0,
    "no-multi-spaces": 0,
    "no-mixed-spaces-and-tabs": 2,

    "no-unused-vars": [1, {"vars": "all", "args": "none"}],
    "react/jsx-uses-react": 1,
    "react/prop-types": 0,
    "no-console": 0
  },
  "plugins": [
    "react"
  ]

Activity

  1. egamma commented on Feb 10, 2016

    @egamma
    Member

    Did you install the corresponding .d.ts files?

    To get IntelliSense for React/JSX, install the typings for react-global by running tsd install react-global from the terminal.

  2. egamma commented on Feb 10, 2016

    @egamma
    Member

    Does it work in this simple hello world example:

    var CommentBox = React.createClass({
      render: function() {
        return (
          <div className="commentBox">
            Hello, world! I am a CommentBox.
          </div>
        );
      }
    });
    
    ReactDOM.render(
      <CommentBox />,
      document.getElementById('content')
    );
  3. nwehrle commented on Feb 10, 2016

    @nwehrle
    Author

    You are right, I forgot to install the .d.ts file for the screenshot (but I tried before).
    bildschirmfoto 2016-02-10 um 13 04 57

    It does not offer the React-Component as the best option in your minimal example:
    bildschirmfoto 2016-02-10 um 13 08 08

  4. egamma commented on Feb 10, 2016

    @egamma
    Member

    I see in your screenshot that you are using ES7 bind operator which is not yet supported by TypeScript which powers Salsa. As a consequence you get syntax errors and red squiggles which can make Intellisense fail.

    In the second screenshot you are correct that the React-Component could be proposed first, but the React-Component is proposed so Intellisense is working but the sorting isn't optimal.

    Moving over to TypeScript as an FYI.

  5. egamma commented on Feb 10, 2016

    @egamma
    Member

    This issue was moved to microsoft/TypeScript#7000

  6. locked and limited conversation to collaborators on Nov 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions