[typescript-plugin] Doesn't understand component map
aaronadamsCA opened this issue · 2 comments
Initial checklist
- I read the support docs
- I read the contributing guide
- I agree to follow the code of conduct
- I searched issues and couldn’t find anything (or linked relevant results below)
Affected packages and versions
MDX extension v1.8.9
Link to runnable example
https://codesandbox.io/p/github/aaronadamsCA/mdx-issues/main?file=/src/mdx.mdx
Steps to reproduce
You'll have to run the reproduction in an environment that supports Visual Studio Code extensions.
The TypeScript plugin doesn't seem to understand a component map in a .mdx
file:
Expected behavior
No errors or warnings.
Actual behavior
The plugin isn't recognizing the destructured Component
and the JSX <Component />
as the same object, whereas the actual MDX parser has no problem with this syntax.
Runtime
No response
Package manager
No response
OS
No response
Build and bundle tools
No response
I see why this happens and have a rough idea how to fix it. It has to do with the scope analysis of virtual files in https://github.com/mdx-js/mdx-analyzer/blob/main/packages/language-service/lib/virtual-code.js. We will probably need to utilize the more detailed scopes returned by periscopic instead of only relying on the global scope. I will get to it when I get to it, but someone else can give it a try if they want.
The related tests are in https://github.com/mdx-js/mdx-analyzer/blob/vscode-mdx%401.8.9/packages/language-service/test/language-plugin.js.
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 area/*
(to describe the scope of the change), platform/*
(if this is related to a specific one), and semver/*
and type/*
labels to annotate this. If this is first-timers friendly, add good first issue
and if this could use help, add help wanted
.