mdx-analyzer
mdx-analyzer copied to clipboard
Crash in VS Code
Initial checklist
- [X] I read the support docs
- [X] I read the contributing guide
- [X] I agree to follow the code of conduct
- [X] I searched issues and couldn’t find anything (or linked relevant results below)
Affected packages and versions
1.8.11
Link to runnable example
No response
Steps to reproduce
Open a MDX in VS Code
Expected behavior
No Crash
Actual behavior
[Info - 10:27:07] Connection to server got closed. Server will restart.
true
/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:41833
const rootExpression = (_a = sourceFile.statements[0]) == null ? void 0 : _a.expression;
^
TypeError: Cannot read properties of undefined (reading '0')
at convertConfigFileToObject (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:41833:53)
at parseOwnConfigOfJsonSourceFile (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:42667:16)
at parseConfig (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:42566:97)
at parseJsonConfigFileContentWorker (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:42294:24)
at Object.parseJsonSourceFileConfigFileContent (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:42263:18)
at a (/Users/jonathanburger/.vscode/extensions/unifiedjs.vscode-mdx-1.8.11/out/language-server.js:897:19013)
at /Users/jonathanburger/.vscode/extensions/unifiedjs.vscode-mdx-1.8.11/out/language-server.js:897:18633
at $fe (/Users/jonathanburger/.vscode/extensions/unifiedjs.vscode-mdx-1.8.11/out/language-server.js:85:5357)
at d (/Users/jonathanburger/.vscode/extensions/unifiedjs.vscode-mdx-1.8.11/out/language-server.js:85:12248)
at S (/Users/jonathanburger/.vscode/extensions/unifiedjs.vscode-mdx-1.8.11/out/language-server.js:85:12018)
Affected runtime and version
code --version: 1.94.0 d78a74bcdfad14d5d3b1b782f87255d802b57511 arm64
Affected package manager and version
No response
Affected OS and version
No response
Build and bundle tools
Docusaurus
Please provide a repo to reproduce the issue.
Hi! Thanks for taking the time to contribute! This has been marked by a maintainer as needing a reproduction: It’s not yet clear whether this is a problem. Here are a couple tips:
- Thoroughly document how to reproduce the problem, in steps or with code
- Don’t link to your complete project: make the repro as tiny as possible, preferrably with only the problematic project in question
- Make sure you’re on the latest versions of projects (and node/npm/yarn!)
- The best issue report is a failing test proving it
Thanks, — bb
I’m closing this, because there is no reproduction.
Hi! This was closed. Team: If this was fixed, please add phase/solved. Otherwise, please add one of the no/* labels.
@JonnyBurger I've raised #513 to fix this, but if you don't want to wait for that you can patch your local extension code by inserting the following line where I show in the screenshot.
d=n.findConfigFile(d, n.sys.fileExists);
@remcohaszing I sometimes have the same error and then it shows a popup by VSCode:
The MDX server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information
Then the output shows what @JonnyBurger has in his first post.
It happened on opening up the .mdx file.
The contents of my .mdx file is some standard Storybook stuff; A couple of imports from @storybook, an import * as Stories from './file.stories``, some headers (#`) and two TypeScript code blocks.
Nothing crazy.
The formatting of the mdx file still seems to be active. Not sure how the stopped MDX server affects me. I don't seem to miss it?
I can’t confirm or troubleshoot bugs without a reproduction. It looks like the bug is confirmed upstream in https://github.com/volarjs/volar.js/issues/283. That’s also where the fix is.
@TomONeill if you're using TypeScript, and project references (in tsconfig.json files), make sure all the project references are paths to tsconfig.json (rather than directories). This works around the issue.
Thanks @bradleyayers but I am not. I am using NX though which does have paths defined in a base tsconfig, which points to an index.ts file. Tried it regardless, but nope. Guess I will have to wait for the official patch. Hopefully soon. If the bug and fix are in the upstream, it should be doable today, no?
Are you able to share the tsconfig and directory/file structure? In my case this error came from it not being able to find the tsconfig.json for a given file, so both the tsconfig and the file structure is quite important. Or even better if you can link to the repo if it's public.
Here's a reproduction (it's not minimal, but it should be sufficient).
git clone https://github.com/epicweb-dev/mcp-fundamentals.git
Then open up any of the *.mdx files in that repository in an editor with the extension and you'll reproduce this issue.
/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:42623
const rootExpression = (_a = sourceFile.statements[0]) == null ? void 0 : _a.expression;
^
TypeError: Cannot read properties of undefined (reading '0')
I'm guessing either #513 or #512 could resolve this and I would love that :)
It's happening quite often while using Cursor