-
-
Notifications
You must be signed in to change notification settings - Fork 21
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
Hover/completions do not work when using mdx_analyzer from Neovim #474
Comments
Hey @b0o, thanks for letting us know, and also for linking to the Reddit post. MDX language server can run either with or without TypeScript enabled. This can be configured using the If you enable TypeScript support via the MDX language server, it needs to perform things that the TypeScript language server does as well. It needs to create the same project, process the same files, etc. This option exists for editors that don’t support TypeScript plugins. I don’t know if this is the case for Neovim. The recommended option is to use Since this is documented, but you and other Neovim users didn’t find it, do you have suggestions how to improve this? Are there other places that should document these options? |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
Hi, thanks for getting back to me!
I did see the documentation about this, but I couldn't get it to work, and it's difficult to debug. Personally, I don't care about using more CPU/memory, I would prefer to just add |
AFAIK none of us are Neovim users so it’s an unknown for us, what to do |
Hi, I noticed something weird: I'm using setup.luarequire('lspconfig').vtsls.setup({
settings = {
vtsls = {
autoUseWorkspaceTsdk = true,
tsserver = {
globalPlugins = {
{
name = '@mdx-js/typescript-plugin',
enableForWorkspaceTypeScriptVersions = true,
languages = {
'mdx',
}
},
}
}
},
},
filetypes = {
'javascript',
'javascriptreact',
'javascript.jsx',
'typescript',
'typescriptreact',
'typescript.tsx',
'mdx', -- <- Start TS server when you open a .mdx file
},
...
}) In my minimum sample project, I created a tsconfig.json{
"compilerOptions": {
"target": "es2016",
"module": "commonjs",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true,
"plugins": [
{
"name": "@mdx-js/typescript-plugin"
}
]
},
"mdx": {
"checkMdx": true,
"plugins": [["remark-frontmatter", ["toml", "yaml"]], "remark-gfm"]
}
} And I have a test.mdx---
date: 2024-09-05
---
{/**
* @typedef Props
* @property {string} name
* Who to greet.
*/}
# Hello {props.name} So I tried another way: instead of the original rm node_modules/@mdx-js/typescript-plugin/index.cjs node_modules/@mdx-js/typescript-plugin/package.json
cp <vscode_extensions_dir>/unifiedjs.vscode-mdx-1.8.10/node_modules/@mdx-js/typescript-plugin.js node_modules/@mdx-js/typescript-plugin/index.js Now everything works like a charm. I can see the hover and the errors are gone. I tested this in another project (which uses ESM) and the result was the same. |
No copying was necessary, just changing this line to
|
Although the `exports` field should be sufficient, some TypeScript integrations still rely on the `main` field. See #474 (comment)
Initial checklist
Affected packages and versions
@mdx-js/[email protected]
Link to runnable example
No response
Steps to reproduce
I'm trying to use the MDX language server from Neovim.
The server starts and attaches to MDX files, and it reports diagnostics for structural issues like unclosed tags, but hover and completion do not work, and TypeScript errors are not reported.
I'm using the default config from lspconfig:
I've tested in my own project (which is private), as well as this repo. MDX works as expected in both of them in VSCode, but not Neovim.
Other Neovim users seem to be having trouble as well: https://www.reddit.com/r/neovim/comments/1ewwtok/has_anyone_figured_out_intellisense_in_mdx_files/
Expected behavior
Actual behavior
Runtime
Node v20
Package manager
pnpm
OS
Linux
Build and bundle tools
Next.js
The text was updated successfully, but these errors were encountered: