diff --git a/src/DocumentStore.zig b/src/DocumentStore.zig index 174eb56..b200091 100644 --- a/src/DocumentStore.zig +++ b/src/DocumentStore.zig @@ -54,6 +54,7 @@ allocator: std.mem.Allocator, handles: UriToHandleMap = .{}, build_files: BuildFileList = .{}, +// TODO use pointer back to Server.config config: Config, std_uri: ?[]const u8, // TODO make this configurable diff --git a/src/Server.zig b/src/Server.zig index d71f133..bcedadf 100644 --- a/src/Server.zig +++ b/src/Server.zig @@ -2568,15 +2568,16 @@ pub fn init( // see: https://github.com/zigtools/zls/issues/536 analysis.init(allocator); - var server: Server = .{ - .config = config, + var cfg = config; + + try cfg.configChanged(allocator, config_path); + + return Server{ + .config = cfg, .allocator = allocator, - .document_store = try DocumentStore.init(allocator, config), + .document_store = try DocumentStore.init(allocator, cfg), .log_level = log_level, }; - try server.configChanged(config_path); - - return server; } pub fn deinit(server: *Server) void { diff --git a/tests/sessions.zig b/tests/sessions.zig index b2ee3ac..6baf734 100644 --- a/tests/sessions.zig +++ b/tests/sessions.zig @@ -14,7 +14,7 @@ test "Open file, ask for semantic tokens" { try ctx.request("textDocument/semanticTokens/full", \\{"textDocument":{"uri":"file:///test.zig"}} , - \\{"data":[0,0,5,7,0,0,6,3,2,32,0,4,1,11,0,0,2,7,12,0,0,8,5,9,0]} + \\{"data":[0,0,5,7,0,0,6,3,0,33,0,4,1,11,0,0,2,7,12,0,0,8,5,9,0]} ); }