Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,37 @@ This extension plugs in the following projects:
- [tree-sitter-rescript](https://github.com/rescript-lang/tree-sitter-rescript) parser
- [@rescript/language-server](https://github.com/rescript-lang/rescript-vscode) LSP

## How test the experimental server

> TODO

## Settings

```json
"lsp": {
"rescript-language-server": {
// Settings for stable server
"initialization_options": {
"extensionConfiguration": {
"askToStartBuild": false
}
},
"settings": {
"version": "1.71.0-next-441959d.0"
"version": "1.71.0-next-441959d.0",
// Server settings for experimental server go inside `rescript` key
"rescript": {
"hover": {
"supportMarkdownLinks": true,
},
},
}
}
},
```

`initialization_options` are passed to the language server when it is started. They can be used to configure the language server. See [extensionConfiguration](https://github.com/rescript-lang/rescript-vscode/blob/441959d1feeaaffc1a589687758b1fbe1f649e72/server/src/config.ts#L5-L29)

`settings` are specific to the Zed extension.
The `settings.version` are specific to the Zed extension.

@aspeddro aspeddro Jun 20, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

In fact, the extension can access and use it, but that's a setting for the server

With `version` you can point to a specific npm version of the [@rescript/language-server](https://www.npmjs.com/package/@rescript/language-server?activeTab=versions).

## Developing
Expand Down
15 changes: 13 additions & 2 deletions src/rescript.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ impl zed::Extension for ReScriptExtension {
) -> Result<zed::Command> {
let server_path = self.server_script_path(server_id, worktree)?;

let current_dir = env::current_dir()
.map_err(|e| format!("failed to get current directory: {e}"))?;
let current_dir =
env::current_dir().map_err(|e| format!("failed to get current directory: {e}"))?;

Ok(zed::Command {
command: zed::node_binary_path()?,
Expand Down Expand Up @@ -151,6 +151,17 @@ impl zed::Extension for ReScriptExtension {
}
})))
}

fn language_server_workspace_configuration(
&mut self,
language_server_id: &zed::LanguageServerId,
worktree: &zed::Worktree,
) -> Result<Option<zed::serde_json::Value>> {
match zed::settings::LspSettings::for_worktree(language_server_id.as_ref(), worktree) {
Ok(LspSettings { settings, .. }) => Ok(settings),
Err(_) => Ok(None),
}
}
}

zed::register_extension!(ReScriptExtension);
Loading