-
-
Notifications
You must be signed in to change notification settings - Fork 11
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
Rewrite to use remark-language-server
#65
Conversation
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.
Thanks @remcohaszing!
It looks like CI is getting stuck at
npm run clean && npm run lint && npm run compile
npm ERR! Missing script: "clean"
👍 after build succeeds! |
This migrates the extension to use remark-language-server which is introduced in remarkjs/remark#924. This basically reimplements the extension from scratch andrepurposes it. Old behavior: - Format code using a custom command. New behavior: - Use the same configuration as remark-cli - Register an actual formatter - Support ESM configurations - Support diagnostics
This uses esbuild to bundle and minify the extension.
It has also been renamed to lower case to be consistent with the rest of the unified ecosystem.
test/index.test.js
Outdated
'Marker style should be `*`', | ||
'Marker style should be `*`', | ||
'Marker style should be `*`' | ||
]) |
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.
This is more about testing the language server can be loaded than about testing its functionality, as that’s tested upstream in unified-language-server
.
package.json
Outdated
"scripts": { | ||
"clean": "rimraf out", | ||
"build:language-server": "esbuild node_modules/remark-language-server/index.js --bundle --platform=node --minify --format=cjs --outfile=out/remark-language-server.js", |
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.
ESBuild can’t process require
statements which load NodeJS builtins, so the language server is built as a CJS module. It is able to use dynamic import()
this way, so everything works fine this way (this is also tested).
test/index.test.js
Outdated
/** | ||
* @returns {Promise<void>} | ||
*/ | ||
module.exports.run = () => |
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.
The test file must be loadable by @vscode/test-electron
, meaning it has to use CJS.
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.
Only really prose nits!
VSCode Extensions need to use CJS, but this is built using esbuild anyway.
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.
wip review
Co-authored-by: Titus <tituswormer@gmail.com>
This adds support for quick fixes.
@remcohaszing I see you sometimes pushing updates to dependencies. Are you treating this PR is ready to go? Because I’m waiting for the tests to turn green and I was under the impression that there are still some things being worked on? |
I was hoping that might automagically fix it, but it didn’t, not that I really expected that. Previously the Windows build failed, but now even the Linux build fails. It used to work on Linux. Manual testing shows the following error.
Unfortunately I also couldn’t easily get source maps to work for debugging. Changing line 11 in It would also help if someone can manually confirm it works on macOS or Windows. Especially Windows development setups are pretty alien to me. Can people just invoke I also tried using LSP over I currently have limited time to look into this, but I do really want to finish this! |
so ubuntu seems to work always, macOS is flakey, and windows fails always? |
Kind of but not quite? I see an Ubuntu build failing while typing this comment. I think using the |
This test doesn’t rely on any timeouts.
Can you mention me again when this is in need of a review? |
We probably should also remove the lockfile, and clean other repo things, in further PRs, btw! |
Omg all checks have passed! 🎉 I agree we can do some more cleanups in other PRs. Let’s focus on this one first though. I’ll fix various quirks after this PR has been merged. |
remark-language-server
remark-language-server
Sweet, landed! |
Initial checklist
Description of changes
This migrates the extension to use remark-language-server which is introduced
in remarkjs/remark#924.
This basically reimplements the extension from scratch andrepurposes it.
Old behavior:
New behavior:
Closes #17
Closes #41
Closes #58
Closes #61