-
Notifications
You must be signed in to change notification settings - Fork 19
Description
Summary
On Windows, the Micro LSP plugin fails to start the Julia LanguageServer (and likely other LSP servers that use strict JSON parsers).
The LSP server loads, but never receives a valid initialize request.
This happens because Micro sends Windows paths using backslashes without escaping them (e.g. C:\temp\project).
These paths appear inside rootUri and/or workspaceFolders, causing the JSON to become invalid.
Example of the error returned by the Julia LanguageServer JSON parser:
Error: Invalid escape sequence
Around: .../C:\temp\microTest2013", "work...
This prevents the LSP from responding and results in:
- no hover
- no autosuggestions
- no go-to-definition
- no diagnostics
The LSP appears to be running, but Micro reports no available LSP server and the log never shows any message received from the server.
Expected Behavior
Micro should escape \ as \\ when constructing JSON messages, or use POSIX-style paths (C:/path/...) which are valid on Windows.
Steps to Reproduce
-
Use Micro on Windows (any version).
-
Open a folder using a normal Windows path:
micro C:\temp\project -
Open a Julia file with the LSP plugin installed.
-
LanguageServer.jl shows a JSON parsing error.
-
Micro shows no LSP activity (Server Options list does not include Julia).
Actual Behavior
Micro sends JSON like:
"rootUri": "file:///C:\temp\project"
which is invalid JSON because \t becomes a tab escape.
The correct JSON should be either:
"rootUri": "file:///C:\\temp\\project"
or:
"rootUri": "file:///C:/temp/project"
If the user starts Micro from a folder using / instead of \, the LSP works correctly:
C:/temp/project
micro file.jl
Environment
- Windows 10/11
- Micro 2.0.15-dev (also reproducible in earlier releases)
- LSP plugin 0.6.2
- Julia LanguageServer.jl (but this affects any strict JSON parser)
Additional Notes
This issue makes Micro + LSP effectively unusable "out of the box" on Windows unless the user manually switches to POSIX-style paths.
A fix would greatly improve the Windows experience, especially for portable setups (Micro + Julia in USB).
Suggested Fix
Normalize all paths in LSP messages to use forward slashes:
strings.Replace(path, "\\", "/", -1)
or ensure valid JSON escaping:
strings.Replace(path, "\\", "\\\\", -1)
I'm willing to test any patch or development build.
Note: With the help of ChatGPT in several tests.