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

[typescript-plugin] Doesn't understand component map #467

Open
4 tasks done
aaronadamsCA opened this issue Aug 18, 2024 · 2 comments
Open
4 tasks done

[typescript-plugin] Doesn't understand component map #467

aaronadamsCA opened this issue Aug 18, 2024 · 2 comments
Labels
🗄 area/interface This affects the public interface 👍 phase/yes Post is accepted and can be worked on 🐛 type/bug This is a problem 🙆 yes/confirmed This is confirmed and ready to be worked on

Comments

@aaronadamsCA
Copy link

Initial checklist

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:

image

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

@github-actions github-actions bot added 👋 phase/new Post is being triaged automatically 🤞 phase/open Post is being triaged manually and removed 👋 phase/new Post is being triaged automatically labels Aug 18, 2024
@remcohaszing
Copy link
Member

remcohaszing commented Aug 19, 2024

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.

@remcohaszing remcohaszing added 🐛 type/bug This is a problem 🗄 area/interface This affects the public interface 🙆 yes/confirmed This is confirmed and ready to be worked on 👍 phase/yes Post is accepted and can be worked on labels Aug 19, 2024
@github-actions github-actions bot removed the 🤞 phase/open Post is being triaged manually label Aug 19, 2024
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🗄 area/interface This affects the public interface 👍 phase/yes Post is accepted and can be worked on 🐛 type/bug This is a problem 🙆 yes/confirmed This is confirmed and ready to be worked on
Development

No branches or pull requests

2 participants