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

[feat] IntelliSense support #165

Closed
JounQin opened this issue Mar 17, 2021 · 14 comments · Fixed by #226
Closed

[feat] IntelliSense support #165

JounQin opened this issue Mar 17, 2021 · 14 comments · Fixed by #226
Labels
🧑 semver/major This is a change 🦋 type/enhancement This is great to have

Comments

@JounQin
Copy link
Member

JounQin commented Mar 17, 2021

references:

  1. IntelliSense for React Markdown (*.mdx) microsoft/vscode#92805 (comment)
  2. https://github.com/microsoft/vscode/blob/main/extensions/html-language-features/server/src/modes/javascriptMode.ts#L57
  3. https://code.visualstudio.com/api/language-extensions/language-server-extension-guide
@JounQin JounQin added 🦋 type/enhancement This is great to have 🙉 open/needs-info This needs some more info 🧑 semver/major This is a change labels Mar 17, 2021
@karlhorky
Copy link

Would be so great to have this - even just partial IntelliSense like auto-imports would be a huge time saver when authoring MDX documents!

@karlhorky
Copy link

karlhorky commented Jun 16, 2021

As an additional data point, the MDX plugin from JetBrains: https://plugins.jetbrains.com/plugin/14944-mdx

And the original discussion about it: https://youtrack.jetbrains.com/issue/WEB-32599

@kishanio
Copy link

kishanio commented Aug 28, 2021

Just wondering?! if this goes through would it also enable typescript powered autocompletion?

@axe312ger
Copy link

Got MDX Code Completion working in Gatsby & Monaco. Maybe this helps implementing it into the vscode plugin:

https://github.com/hashbite/gatsby-mdx-suite/blob/main/themes/docs/src/components/live-editor/autocompletion.ts

https://gatsby-mdx-suite-full.netlify.app/docs/playground/

@alanshortis
Copy link

This would be an excellent addition. We love writing really rich documentation in Storybook with MDX, but the lack of code completion for components and imports is a bit of a pain.

@karlhorky
Copy link

Ohh, VS Code 1.64 has IntelliSense for paths in Markdown files!

I asked in the PR as to whether it could be enabled also for MDX.

@Kingwl
Copy link

Kingwl commented Mar 2, 2022

Hey folks!

I guess we can do something like volar(vue language service) and svelte language service. To integrate mdx with ts server.

Luckly the syntax of mdx is simple.
I'll start some work in this few days.

@bencmbrook
Copy link

This would be incredible for the MDX developer experience!

@theenoahmason
Copy link

Typescript/intellisense support would make MDX one of the most powerful authoring tools on the planet. Prove me wrong!

Without it, it makes MDX very difficult to adopt. This is not a thin line, but rather a giant chasm in the modern development workflow. Let's do it!

@ghost
Copy link

ghost commented Jul 4, 2022

Please add intellisense feature to the extension! 😭 😭

@JounQin JounQin added PR welcome and removed 🙉 open/needs-info This needs some more info labels Jul 6, 2022
@karlhorky
Copy link

karlhorky commented Aug 6, 2022

Wonder if the new Markdown Language Service and Markdown Language Server that the VS Code team just open sourced as part of 1.70 would be helpful with the implementation:

This iteration, we extracted much of VS Code's tooling for writing Markdown into a library and language server. This includes our tooling for path completions, document outlines, and diagnostics.

Maybe this code is also partly behind the Markdown path IntelliSense feature in 1.64:

The built-in Markdown extension now includes path IntelliSense for links and images.

@remcohaszing
Copy link
Member

Starting October I’m going to have significantly more time to spend on OSS. Intellisense for MDX is one of the first things I’m interested to work on. Of course this requires some research at first to figure out what intellisense for MDX means (Hover effects, autocomplete, document outline, etc), and how to get a basic implementation up and running.

Ideally this is built as a language server, so the same language features can be provided in VSCode / Vim / NeoVim / Emacs / Your favourite editor. Also in my experience language servers are simpler to work with when consuming ESM and relatively straight-forward to test.

@braianj
Copy link

braianj commented Oct 25, 2022

@remcohaszing any news about this? It could be really useful.

@remcohaszing
Copy link
Member

Yes, I avoided cross referencing this issue to keep it a bit under the radar, but IMO #226 is ready to be reviewed and released as an experimental feature.

remcohaszing added a commit that referenced this issue Jan 12, 2023
This is a first implementation of MDX IntelliSense for multiple editors. The idea is to turn this repository into a monorepo.

The following packages have been added:

- `@mdx-js/language-service` handles the actual logic needed for intellisense features. It wraps the TypeScript language service interface and handles MDX syntax.
- `@mdx-js/language-server` provides `@mdx-js/language-service` as an actual language server. This package is supposed to be consumed by projects such as NeoVim, `vim-lsp`, `sublimelsp`, and Emacs `lsp-mode`.
- `@mdx-js/language-client` is an internal package to integrates `@mdx-js/language-server` into VSCode.
- `@mdx-js/monaco` integrates `@mdx-js/language-service` into Monaco editor.
- `vscode-mdx` is the mono-repo root and provides `@mdx-js/language-server` as a VSCode plugin.

Todos after these changes:

- Go through “marketing” material, as in, examples, but also docs
- Perhaps add tools like stylint for CSS in demos?
- Lowercase `readme.md`, `license`?
- Support the `components` prop
- Host the demo (https://monaco.mdxjs.com styled consistently with MDX website? Or https://monaco-mdx.js.org analogous to https://monaco-tailwindcss.js.org / https://monaco-unified.js.org / https://monaco-yaml.js.org?)
- Publish packages
- Identify, test, and fix various corner cases
- Support definitions referencing unopened files
- #168
- Fix Windows tests
- Move extension from project root into subpackage (blocked upstream)
- Identify and implement missing TypeScript features
- Support unified micromark syntax plugins (`frontmatter`, `gfm`, etc) in the language server
- Support unified micromark syntax plugins in Monaco editor
- Consider support for remark transformer plugins (`remark-mdx-frontmatter` introduces variables)
- Consider support for rehype transformer plugins (`rehype-mdx-title` introduces a variable)
- Support loose (invalid) JavaScript syntax

Closes #165 (Intellisense is a broad concept. Please open new issues for specific missing features.)  
Closes #196 (I did use parts of this for inspiration. Thanks @Kingwl!)  
Closes #223
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🧑 semver/major This is a change 🦋 type/enhancement This is great to have
Development

Successfully merging a pull request may close this issue.

10 participants