Skip to content

Support experimental language server#1183

Draft
aspeddro wants to merge 6 commits into
rescript-lang:masterfrom
aspeddro:experimental-lsp
Draft

Support experimental language server#1183
aspeddro wants to merge 6 commits into
rescript-lang:masterfrom
aspeddro:experimental-lsp

Conversation

@aspeddro

@aspeddro aspeddro commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add opt-in support for the experimental ReScript language server (OCaml implementation) while keeping the existing stable Node.js server.
  • New setting:
    • rescript.experimentalServerPath (string | null) - optional path to a custom-built experimental server binary.
    • rescript.settings.hover.supportMarkdownLinks (bool) - enable markdown link in hover responses. Default is true

Related rescript-lang/rescript#8425

Comment thread client/src/extension.ts
Comment on lines +612 to +614
.sendNotification(DidChangeConfigurationNotification.type, {
settings: null,
})

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The notification workspace/didChangeConfiguration params must have settings field. https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#didChangeConfigurationParams

This was breaking the experimental server.

Comment thread client/src/extension.ts
Comment on lines +126 to +134
middleware: {
workspace: {
configuration: async (_params, _token, _next) => {
// For the experimental server, we don't want to send the full configuration
// We send only setting inside rescript.settings, i.e, server settings
return [workspace.getConfiguration("rescript.settings")];
},
},
},

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we don't use middleware, the server will retrieve all fields within rescript, but we only want rescript.settings. Otherwise, the server fails to parse the received JSON.

Comment thread client/src/extension.ts

function createExperimentalLanguageClient(serverPath: string) {
if (!fs.existsSync(serverPath)) {
const message = `The experimental server is enabled with \`experimentalServerPath\`, but no language server was found at ${serverPath}. See the instructions for using the experimental server in [ADD_LINK_TO_DOCS_HERE].`;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove See the instructions...

@aspeddro

Copy link
Copy Markdown
Contributor Author

Oh my god Windows 😮‍💨

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.

1 participant