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

VS Code Intellisense/import Code Actions don't work with React JSX Transform unless React is in scope #50190

Closed
nhuesmann opened this issue Aug 4, 2022 · 3 comments
Labels
Needs More Info The issue still hasn't been fully clarified

Comments

@nhuesmann
Copy link

Bug Report

πŸ”Ž Search Terms

VS Code react JSX transform intellisense code action react in scope

πŸ•— Version & Regression Information

  • I was unable to test this on prior versions because I previously didn't use the JSX Transform.

⏯ Playground Link

I created a reproducible demo using npx create-expo-app -t expo-template-blank-typescript. The only change I made was adding the basic React component and adding it to App.tsx without the import.

Reproducible Example

πŸ’» Steps to reproduce

  1. Clone the reproducible demo I created https://github.com/nhuesmann/vscode-react-jsx-transform-issue
  2. cd <my-repo-you-cloned>
  3. Install dependencies: npm i or yarn
  4. code --disable-extensions .
  5. Open App.tsx
  6. Notice the error on line 8 with the <Test /> component
  7. Click on the component and use cmd + . to bring up Code Actions
  8. Observe VS Code's suggestion: import 'React' from "react"
  9. Accept the suggestion
  10. Once again use cmd + . (while clicked on <Test />) to bring up Code Actions
  11. Observe VS Code's suggestion of Add import from "./Test"

πŸ™ Actual behavior

VS Code's Intellisense does not suggest the JSX component import initially. It only suggests importing React. This is wrong, because with the React JSX Transform, it is no longer necessary to import React in JSX/TSX files.

πŸ™‚ Expected behavior

VS Code should suggest Add import from "./Test" on first use of cmd + .

Extra

Related issue: #41762
Temporary workaround: #41762 (comment)

@RyanCavanaugh
Copy link
Member

Sorry, what's the difference between this and #50192 ?

@RyanCavanaugh RyanCavanaugh added the Needs More Info The issue still hasn't been fully clarified label Aug 4, 2022
@nhuesmann
Copy link
Author

Sorry, what's the difference between this and #50192 ?

I wasn't sure which repo to create the issue in (TypeScript or VS Code) so I reported it in both. I didn't realize the VS Code one would be automatically created over here, I'm sorry for the excess issue creation. It's the same issue, I just followed each repo's instructions for bug reporting.

@RyanCavanaugh
Copy link
Member

Ah, that makes sense. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs More Info The issue still hasn't been fully clarified
Projects
None yet
Development

No branches or pull requests

2 participants