Skip to content

Commit

Permalink
regenerate diagnostics when zig executable has changed
Browse files Browse the repository at this point in the history
The new zig may generate different diagnostics than the previous
  • Loading branch information
Techatrix committed Jan 29, 2024
1 parent 17befd1 commit 88468df
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/DocumentStore.zig
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,10 @@ pub const Handle = struct {
return @bitCast(self.impl.status.load(.Acquire));
}

pub fn isOpen(self: Handle) bool {
return self.getStatus().open;

Check warning on line 363 in src/DocumentStore.zig

View check run for this annotation

Codecov / codecov/patch

src/DocumentStore.zig#L362-L363

Added lines #L362 - L363 were not covered by tests
}

/// returns the previous value
fn setOpen(self: *Handle, open: bool) bool {
if (open) {
Expand Down
7 changes: 7 additions & 0 deletions src/Server.zig
Original file line number Diff line number Diff line change
Expand Up @@ -895,6 +895,13 @@ pub fn updateConfiguration(server: *Server, new_config: configuration.Configurat
}

if (server.status == .initialized) {
if (new_zig_exe_path and server.client_capabilities.supports_publish_diagnostics) {
for (server.document_store.handles.values()) |handle| {
if (!handle.isOpen()) continue;
try server.pushJob(.{ .generate_diagnostics = try server.allocator.dupe(u8, handle.uri) });

Check warning on line 901 in src/Server.zig

View check run for this annotation

Codecov / codecov/patch

src/Server.zig#L898-L901

Added lines #L898 - L901 were not covered by tests
}
}

const json_message = try server.sendToClientRequest(
.{ .string = "semantic_tokens_refresh" },
"workspace/semanticTokens/refresh",
Expand Down

0 comments on commit 88468df

Please sign in to comment.