-
-
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
feat: add initial intellisense #226
Conversation
This is a proof of concept for MDX intellisense support 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 provides a JavaScript API implementing interfaces from `vscode-languageserver-types`. - `@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/monaco` integrates `@mdx-js/language-service` into Monaco editor. - `vscode-mdx` provides `@mdx-js/language-server` as a VSCode plugin. Currently the VSCode extension is the monorepo root and the client code lives in `@mdx-js/language-client`, but I think it makes sense to merge both into a (private) package `vscode-mdx`. The current implementation is still very raw. It just provides definitions for link references. The next big step is to integrate TypeScript.
🦋 Changeset detectedLatest commit: ad45694 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
📊 Package size report No changes
Unchanged files
🤖 This report was automatically generated by pkg-size-action |
Vite has some issues with resolving web workers.
It can be extended with plugins
I think this is now usable enough to be released as an experimental feature. I.e. it could be opt-in using a boolean setting |
As far as I’m concerned, this PR is ready. |
This comment was marked as off-topic.
This comment was marked as off-topic.
@@ -0,0 +1,340 @@ | |||
#!/usr/bin/env node |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very few comments here, would be useful to explain what does what
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO all code in this file is fairly self-explanatory. Is something specific unclear?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It’s the core file that integrates all user events with certain actions in utilities.
I think this is the place where you can explain what user actions will result in what “computer responses”.
For example, in the connection.onHover
handler, you can explain what a user has
to do to trigger this event, and what we’re going to do in response.
This might seem really clear (well, user has to hover, something will be shown in response), but, reading that code, I can see that you call some utility, but I don’t know what you do with that, why does it always return TypeScript that can be wrapped in a fenced code block ```ts
?
Or, reading connection.onPrepareRename
, what will it do? What is the difference between prepare and request?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some of these are just copy-pasted from other implementations. I.e. I looked at some TypeScript language servers I found, the official TypeScript integration in VSCode, the Monaco editor TypeScript integration. I don’t know why it’s formatted like that, but it works and it’s consistently used like that in the ecosystem.
I don’t really feel the need to document each request type, because it’s already explained in the LSP specification.
To dos after:
Q: What are other things that should be checked / improved / added later? |
More todos:
I intend to create more detailed issues for these once this PR gets merged. |
IntelliSense is now released behind a flag. More info on how to try it out here: https://github.com/mdx-js/vscode-mdx/releases/tag/v1.1.0. And see also the announcement on Twitter: https://twitter.com/remcohaszing/status/1613910319805382657 |
Amazing, thanks @remcohaszing 🙌 Long journey to get this to the state where it is now, kudos on that! |
I wanted to ask where the correct place to report issues is, because I ran into a first issue trying to parse MDX which uses JavaScript inside Front Matter, as below: ---
courseModules: [{ courseId: 3, slug: 'changes' }]
---
# Changes
...more content... The error from
Screenshot: I guess it's possible that I'm also using MDX in an unexpected / incorrect way here, maybe there's something I need to change... |
@karlhorky Thanks for trying this out! The issue tracker of this project is the right place to report. However, the issue you’re running into has already been reported: #266. The public interface for that feature requires some discussion though. I welcome any input in the discussion there. |
This is a proof of concept for MDX intellisense support 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 provides a JavaScript API implementing interfaces fromIt wraps the TypeScript language service interface and handles MDX syntax.vscode-languageserver-types
.@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 Emacslsp-mode
.@mdx-js/monaco
integrates@mdx-js/language-service
into Monaco editor.vscode-mdx
provides@mdx-js/language-server
as a VSCode plugin.Currently the VSCode extension is the monorepo root and the client code lives in@mdx-js/language-client
, but I think it makes sense to merge both into a (private) packagevscode-mdx
.vsce
doesn’t seem to support npm workspaces.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