Improve Zig version mismatch error (#744)
Improves the server message we send if the system Zig version is older than the Zig version that ZLS was built with: - Correct typo (“build with” → “built with”). - Show versions so users know which one they need to update to. - Suggest step needed to fix the error (“Update Zig…”).
This commit is contained in:
parent
b08480256c
commit
e58bddd769
@ -1634,10 +1634,8 @@ fn initializeHandler(server: *Server, writer: anytype, id: types.RequestId, req:
|
|||||||
const zig_exe_version = std.SemanticVersion.parse(env.version) catch return;
|
const zig_exe_version = std.SemanticVersion.parse(env.version) catch return;
|
||||||
|
|
||||||
if (zig_builtin.zig_version.order(zig_exe_version) == .gt) {
|
if (zig_builtin.zig_version.order(zig_exe_version) == .gt) {
|
||||||
try server.showMessage(writer, .Warning,
|
const version_mismatch_message = try std.fmt.allocPrint(server.arena.allocator(), "ZLS was built with Zig {}, but your Zig version is {s}. Update Zig to avoid unexpected behavior.", .{ zig_builtin.zig_version, env.version });
|
||||||
\\ZLS has been build with a newer version than you are using!
|
try server.showMessage(writer, .Warning, version_mismatch_message);
|
||||||
\\This may cause unexpected issues.
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user