-
-
Notifications
You must be signed in to change notification settings - Fork 21
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
Auto-import IntelliSense of React components missing #452
Comments
I am getting a similar issue with the VSCode Intellicode extension turning off all hints from this extension |
Hi! This was marked as ready to be worked on! Note that while this is ready to be worked on, nothing is said about priority: it may take a while for this to be solved. Is this something you can and want to work on? Team: please use the |
I have confirmed (and fixed) it, but the fact that it works with |
This change adds support for auto-imports. The virtual code now contains an empty import of the JSX runtime. This import was chosen, because it must exist anyway. This is immediately followed by an empty code mapping, meaning TypeScript always has a place to insert auto-imports. Since JSX components can be injected, they are sometimes prefixed with `_components.` in the virtual code. To support auto-import completions, an additional mapping is now made to an expression containing merely the identifier. As a result, the editor now shows auto-import completions, unless `MDXProvidedComponents` is defined. I don’t know why the existence of `MDXProvidedComponents` matters, but this probably matches the expectation of users anyway. The auto-imports will not be followed by a blank line. This can lead to a syntax error in case no other imports exist yet. This is not ideal, but easy and straight-forward to resolve manually. Closes #452
@remcohaszing thanks, amazing! Do you think this is a bug in |
Initial checklist
Affected packages and versions
MDX VS Code Extension v1.8.9
Link to runnable example
No response
Steps to reproduce
As noted in #451 (comment), the IntelliSense entries for auto-import of React components in
.tsx
files (auto-import in an.mdx
file) are missing.[email protected]
and[email protected]
(both enabled)app/message.mdx
, move the cursor to the endZoomImage
and trigger IntelliSense with ctrl-space[email protected]
ZoomImage
and trigger IntelliSense with ctrl-spaceRepo: https://github.com/karlhorky/repro-mdx-analyzer-missing-auto-import-intellisense
Kapture.2024-06-28.at.17.33.21.mp4
Expected behavior
ZoomImage
when only[email protected]
installed[email protected]
enabled)Actual behavior
ZoomImage
when only[email protected]
installed[email protected]
enabled) selecting the entry adds the new import to the bottom of the codeRuntime
Node v20
Package manager
No response
OS
macOS
Build and bundle tools
Next.js
Potentially Related
The text was updated successfully, but these errors were encountered: