mdx-js / mdx-analyzer

MDX extension for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=unifiedjs.vscode-mdx
MIT License
320 stars 18 forks source link

Auto-import IntelliSense of React components missing #452

Open karlhorky opened 2 weeks ago

karlhorky commented 2 weeks ago

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 https://github.com/mdx-js/mdx-analyzer/issues/451#issuecomment-2196432076, the IntelliSense entries for auto-import of React components in .tsx files (auto-import in an .mdx file) are missing.

  1. Clone the reproduction at https://github.com/karlhorky/repro-mdx-analyzer-missing-auto-import-intellisense
  2. Install the 2 recommended extensions unifiedjs.vscode-mdx@1.8.9 and viijay-kr.react-ts-css@3.2.0 (both enabled)
  3. In app/message.mdx, move the cursor to the end ZoomImage and trigger IntelliSense with ctrl-space
  4. Observe one entry in IntelliSense
  5. Select this entry
  6. Observe the import is added at the end of the file
  7. Disable viijay-kr.react-ts-css@3.2.0
  8. Move the cursor to the end ZoomImage and trigger IntelliSense with ctrl-space
  9. Observe zero entries in IntelliSense
Version: 1.91.0-insider
Commit: aea213b7fcc7de5c24ad797ac1af209b159d451f
Date: 2024-06-28T06:02:58.030Z
Electron: 29.4.0
ElectronBuildId: 9728852
Chromium: 122.0.6261.156
Node.js: 20.9.0
V8: 12.2.281.27-electron.0
OS: Darwin arm64 23.5.0

Repo: https://github.com/karlhorky/repro-mdx-analyzer-missing-auto-import-intellisense

https://github.com/mdx-js/mdx-analyzer/assets/1935696/9dc9fded-14a3-490f-a94e-416c16fa2d0a

Expected behavior

  1. One entry in the IntelliSense for ZoomImage when only unifiedjs.vscode-mdx@1.8.9 installed
  2. Selecting the entry should add the new import to the top of the code (also when viijay-kr.react-ts-css@3.2.0 enabled)
    1. Saving the file with an import not in the import block at the top should move the import to the top of the file

Actual behavior

  1. Zero entries in the IntelliSense for ZoomImage when only unifiedjs.vscode-mdx@1.8.9 installed
  2. (when viijay-kr.react-ts-css@3.2.0 enabled) selecting the entry adds the new import to the bottom of the code
    1. Saving the file has no effect

Runtime

Node v20

Package manager

No response

OS

macOS

Build and bundle tools

Next.js

Potentially Related

Yonom commented 1 week ago

I am getting a similar issue with the VSCode Intellicode extension turning off all hints from this extension