Open XiNiHa opened 1 month ago
It’s cool to hear people want this. I’m not sure if this repo is the right place to maintain Zed integration though. Perhaps it’s better if Zed adds their own integration. See https://github.com/zed-industries/extensions/issues/203#issuecomment-2230312486.
This is not a definite no. It could be nice to support this from the MDX side if Zed doesn’t want to maintain it.
Hi! Thanks for taking the time to contribute! This has been marked by a maintainer as needing more info. It’s not clear yet whether this is an issue. Here are a couple tips:
Thanks, — bb
:+1: on what remco says there. I’d also say it’s probably easier to maintain by someone who is familiar with and actively using zed, as that’s where most of the complexity is and that’s where a lot of the activity/instability comes from. The MDX side of things is more stable: similar to how any other language is added indeed. LSP / TextMate grammar.
By the way, Zed uses TreeSitter grammars instead of TM, although that wouldn't matter that much AFAIK since we provide the language server anyways.
tree-sitter
is a bit different. I looked into it once. I’ve thought about making a TS grammar when I made the TM grammar. Though, it might not be possible to properly highlight MDX or markdown with TS. See https://github.com/davidmh/mdx.nvim. And also https://github.com/tree-sitter-grammars/tree-sitter-markdown#goals.
I thought that it's possible to provide syntax highlighting just with a language server. Isn't that true? If not a TreeSitter grammar should be worked on for sure 🥲
LSP supports semantic tokens, which can be used to enhance syntax highlighting based on context, for example:
// Is Thing a class? function? interface? This can be determined using semantic tokens
import { Thing } from 'module'
But basic syntax highlighting happens in a grammar such as TextMate, Monarch, or TreeSitter.
Can only TreeSitter syntaxes expose those semantic tokens? Could they be exposed from TextMate grammars? 🤔
No, the language server exposes them. The point is, yes, the language server enhances syntax highlighting a bit, so you may find some info about that when you search a bit. But it doesn’t provide most highlighting, that’s something for grammars to provide.
right :+1: it just feels a bit out of place to me for LSP to do that
Initial checklist
Problem
Zed is a VSCode-like code editor that has recently gained some popularity. However, it currently doesn't have MDX support, either in first-party integrations or third-party extensions. (see https://github.com/zed-industries/extensions/issues/203)
Solution
Creating an extension for Zed would have a great impact here. Since many Zed extensions work with the LSP protocol, it'd be definitely possible to integrate the MDX language server with Zed, especially considering that other Volar-based language servers like Vue and Astro already support Zed.
Alternatives
Recommend users to stay on VSCode and do nothing