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

Allow Language Server to be used as standalone process independent of VS Code Extension #17

Merged
merged 3 commits into from
Apr 2, 2024

Conversation

ferntheplant
Copy link
Contributor

I was trying to setup the Markdoc Language Server for use with Helix (terminal based editor like nvim) but ran into issues. Installing the package with npm install -g @markdoc/language-server lead to no language server binary or script being accessible via the npm bin directory.

After investigating the source code I found it was because there was no build target for a standalone process running the language server. However, even after adding such a build target and installing the target to my npm global bin the server was not working. After digging around through the code I made 2 core discoveries:

  1. The expected config the LSP client provides to the server requires redundant nesting (see README changes)
    • This is hidden from VS Code users as the extension generates the nesting from the VS Code config
  2. The server code contained a bug while reading the config (see server/server.ts:32 changes)
    • I'm unsure how the VS Code extension is even functional as without my patch the server threw an error at line 48 while reading options.config as options was undefined due to a bug in the connect function

I don't think my PR follows best practices for building/bundling an npm package intended to be installed globally for it's binaries but I think it generally gets the idea across and can be used as a jumping off point.

@CLAassistant
Copy link

CLAassistant commented Mar 27, 2024

CLA assistant check
All committers have signed the CLA.

server/package.json Outdated Show resolved Hide resolved
@rpaul-stripe
Copy link
Collaborator

This looks good to me. I think you accidentally left your package name in the package.json, but I'm happy to merge once that's resolved.

@rpaul-stripe rpaul-stripe merged commit 3f53a17 into markdoc:main Apr 2, 2024
2 checks passed
@rpaul-stripe
Copy link
Collaborator

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants