jaredly / jaredly/reason-language-server
No root directory found when opening directory with spaces on macOS
- Dominant language
- OCaml
- Stars
- 649
- Forks
- 85
- PR merge metrics
- No merged PRs in 30d
Description
When in a directory whose path contains spaces (e.g. `~/Library/Application Support/...`), the extension does not work and emits a lot of messages like this:
```
[Error - 1:27:01 AM] Request textDocument/codeAction failed.
Message: No root directory found
Code: -32603
```
When starting up, the following message is emitted:
```
/Users//Library/Application%20Support/peacememories.mess/2020/9/reason-test/node_modules/.lsp/debug.log
```
The `Application%20Support` directory is also created at that time.
That logs also shows more information about the first log message:
```
Read message
{"jsonrpc":"2.0","id":7,"method":"textDocument/codeAction","params":{"textDocument":{"uri":"file:///Users//Library/Application%20Support/peacememories.mess/2020/9/reason-test/src/Main.re"},"range":{"start":{"line":0,"character":76},"end":{"line":0,"character":76}},"context":{"diagnostics":[]}}}
[server] Got a method textDocument/codeAction
[server] processing took 0.0100135803223ms
Sending response {"id": 7, "jsonrpc": "2.0", "error": {"code": -32603, "message": "No root directory found"}}
```
It seems like some part of the extension uses html escaping for escaping the path, causing the error.
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the failure by opening the language server in a macOS directory whose path contains spaces, such as ~/Library/Application Support. Start by tracing path handling around the startup log and the textDocument/codeAction root-directory lookup. Done means the extension finds the root directory and serves code actions without the reported errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- macos, ocaml
- Domain
- devtools, operating-systems
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100