Diagnostics from remote Docker Hack LSP are mapped to the first workspace folder
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 80
- Forks
- 47
- PR merge metrics
- No merged PRs in 30d
Description
When using hack.remote.enabled with Docker in a multi-root workspace, Hack
diagnostics are mapped to workspaceFolders[0] instead of the workspace folder
that corresponds to hack.remote.workspacePath.
In this repro, the real Hack error is in hack/type_error.hack, but VS Code
reports it against not-hack/type_error.hack.
Code reference
Note how it takes workspaceFolders![0]
Expected
The diagnostic points to:
hack/type_error.hack
Actual
The diagnostic points to:
not-hack/type_error.hack
That file does not exist.
Notes
If the hack folder is moved to the first position in the workspace file and
the window is reloaded, the same diagnostic points to the correct file.
Repro script
Run this script in an empty directory to recreate a minimal reproduction case.
#!/usr/bin/env sh
set -eu
root=hack-vscode-wrong-root-repro
rm -rf "$root"
mkdir -p "$root/not-hack" "$root/hack"
cat > "$root/hack-vscode-wrong-root-repro.code-workspace" <<'JSON'
{
"folders": [
{
"name": "not-hack",
"path": "not-hack"
},
{
"name": "hack",
"path": "hack"
}
],
"settings": {
"hack.remote.docker.containerName": "hack-vscode-wrong-root-repro-hack-1",
"hack.remote.enabled": true,
"hack.remote.type": "docker",
"hack.remote.workspacePath": "/mnt/project"
}
}
JSON
cat > "$root/docker-compose.yml" <<'YAML'
name: hack-vscode-wrong-root-repro
services:
hack:
image: hhvm/hhvm:latest
working_dir: /mnt/project
command: sleep infinity
volumes:
- type: bind
source: ./hack
target: /mnt/project
YAML
touch "$root/not-hack/some_other_file.txt"
touch "$root/hack/.hhconfig"
cat > "$root/hack/type_error.hack" <<'HACK'
const string X = 0;
HACK
cd "$root"
docker compose up -d
Then open hack-vscode-wrong-root-repro.code-workspace in VS Code with the
Hack extension enabled.
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.
Research direction
Start at src/Config.ts lines 55-62, where the remote workspace mapping uses the first workspace folder. Run the supplied Docker multi-root reproduction and inspect how hack.remote.workspacePath is matched to a workspace folder. Done when the diagnostic for hack/type_error.hack is reported against that file even when the hack folder is not first.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, typescript, vscode
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100