Language server hangs on initialize when workspace root has no rescript.json (monorepo)
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 58/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- node.js
- Domain
- devtools
Research direction
Run the provided Python stdio reproduction against node_modules/@rescript/language-server/out/cli.js with a rootUri for a directory without rescript.json, then trace initialize handling and project discovery. Done means initialize returns promptly for that workspace, either locating a project or reporting an unsupported or empty workspace; verify the existing project-root case still responds.
Written by the indexing model from the issue text.
Description
Summary
When the editor workspace root is a monorepo root that does not itself contain a rescript.json, the language server never responds to the LSP initialize request — it hangs silently and produces no stderr output. Editors that spawn one server instance per workspace (Zed) are left with a dead server: every request (formatting, hover, completions, code actions) fails until the process is torn down.
Environment
- @rescript/language-server 1.74.0 (also reproduced on 1.72.0)
- macOS 26, Node v24.13.0
- Editor: Zed 1.18 (extension rescript 0.4.4), but this is reproducible standalone over stdio
Repo layout
monorepo/ ← workspace root, no rescript.json here
packages/
my-app/
rescript.json ← the actual ReScript project
src/...
Reproduction
Pipe a framed initialize request to the server over stdio:
python3 - <<'EOF'
import subprocess, json
msg = json.dumps({"jsonrpc":"2.0","id":1,"method":"initialize","params":{
"rootUri":"file:///path/to/monorepo", # no rescript.json at this level
"capabilities":{}}})
payload = f"Content-Length: {len(msg)}\r\n\r\n{msg}"
p = subprocess.Popen(["node","node_modules/@rescript/language-server/out/cli.js","--stdio"],
stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
try:
out, err = p.communicate(payload.encode(), timeout=10)
print("responded:", b'"id":1' in out)
except subprocess.TimeoutExpired:
p.kill(); print("HUNG: no response in 10s")
EOF
Results
| scenario | result |
|---|---|
rootUri = directory containing rescript.json |
responds immediately, documentFormattingProvider: true |
rootUri = monorepo root (no rescript.json at root) |
hangs indefinitely, no stderr |
same, with workspaceFolders including the rescript.json dir |
still hangs |
same, with rootUri at root + cwd at the rescript.json dir |
still hangs |
| both 1.72.0 and 1.74.0 | identical behavior |
Expected behavior
The server should respond to initialize even when the root has no rescript.json — either by locating the nearest project in the workspace, or by reporting an empty/unsupported workspace so the editor can degrade gracefully (or the user can be told to add the project folder).
Actual behavior
Silent hang. In Zed this manifests as: launch → cannot read LSP message headers → teardown → every subsequent request logs rescript-language-server failed: server shut down. Formatting-on-save, hover, and completions are all silently dead. The user sees no error explaining that the workspace root needs to be (or contain) a ReScript project.
Workarounds
- Open the directory containing rescript.json as the workspace root, or
- Bypass the LSP formatter via an external formatter (rescript format --stdin .res) — but semantic features remain dead.
- Dominant language
- ReScript
- Stars
- 354
- Forks
- 63
- Avg merge
- 11h 29m
- Merged PRs (30d)
- 1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from rescript-lang/rescript-vscode
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
rescript-lang/rescript-vscode#1185 ·
-
Binary resolution fails on Windows with ERR_INVALID_URL_SCHEME when compiler-info.json is missing Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
rescript-lang/rescript-vscode#1184 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
rescript-lang/rescript-vscode#1186 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
rescript-lang/rescript-vscode#1182 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
rescript-lang/rescript-vscode#1175 ·
All issues in rescript-lang/rescript-vscode
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
EclipseFdn/open-vsx.org#13385 · 1 comment ·
-
bug ci good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
sponsored
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
microsoft/navcontainerhelper#4217 ·
-
feature
Difficulty 2/5 1-3 hours Newbie friendliness 72/100