From 91645612e61118af89b23d6766d47532b473827d Mon Sep 17 00:00:00 2001 From: Ai Hoshino Date: Sat, 13 May 2023 13:53:44 +0800 Subject: [PATCH] Fix panic caused by custom zls.json path (#1177) * fix(config): fix panic caused by custom configuration file path. * fix(config): revert `openDir` related code --- src/Server.zig | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Server.zig b/src/Server.zig index 4d32d53..f1c7dab 100644 --- a/src/Server.zig +++ b/src/Server.zig @@ -1569,7 +1569,12 @@ pub fn create( }; server.analyser = Analyser.init(allocator, &server.document_store); - try configuration.configChanged(config, &server.runtime_zig_version, allocator, config_path); + var builtin_creation_dir = config_path; + if (config_path) |path| { + builtin_creation_dir = std.fs.path.dirname(path); + } + + try configuration.configChanged(config, &server.runtime_zig_version, allocator, builtin_creation_dir); if (config.dangerous_comptime_experiments_do_not_enable) { server.analyser.ip = try analyser.InternPool.init(allocator);