Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Autocomplete in .MDX files using VScode

When I import something from .js or .ts files in .mdx files I would like to see autocomplete suggestions from VScode.

Also when I define variable inside .mdx file, I'm waiting that VScode will suggest me this variable's name.

// for example
const myVar = 'myVarValue';

<Meta title={myV /* In this moment VScode should show me suggestion */} />

Questions:

  • Is it possible at all?
  • If not then why and when it will be possible?
  • If yes then what should I do with my VScode to it became work as I expect?
like image 851
Andrii Hrushetskyi Avatar asked May 31 '26 11:05

Andrii Hrushetskyi


1 Answers

There is now a VSCode extension, vscode-mdx, that enables this functionality.

Note that the IntelliSense feature is still described as being in experimental stage and is disabled by default. You can change this setting to enable the support and then restart your VSCode.

mdx.experimentalLanguageServer: Enable experimental IntelliSense support for MDX files. (boolean, default: false)

I have only just started using it so can't really vouch for it yet, but so far I'm finding it better than nothing. I'm using it for storybook's, and it correctly suggests the props for components and navigates to definitions correctly.

However I note that it does not do what the example in the description expects - trying to reference defined variables does not offer suggestions.

like image 94
devklick Avatar answered Jun 02 '26 01:06

devklick