Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,8 @@ pub fn build(b: *Build) !void {
test_options.step.name = "ZLS test options";

test_options.addOptionPath("zig_exe_path", .zig_exe);
// https://codeberg.org/ziglang/zig/issues/35766
// test_options.addOptionPath("zig_lib_path", .zig_lib);
// test_options.addOptionPath("global_cache_path", std.Build.LazyPath.cache_root.join(b.allocator, "zls") catch @panic("OOM"));
test_options.addOptionPathUntracked("zig_lib_path", .zig_lib);
test_options.addOptionPathUntracked("global_cache_path", std.Build.LazyPath.cache_root.join(b.allocator, "zls") catch @panic("OOM"));

break :blk test_options.createModule();
};
Expand Down Expand Up @@ -335,7 +334,7 @@ fn getVersion(b: *Build) std.SemanticVersion {
const io = b.graph.io;
const git_file = b.root.openFile(io, ".git", .{ .allow_directory = false }) catch |err| switch (err) {
error.IsDir => {
b.dependOnFileContents(b.path(".git/logs/HEAD"));
b.dependOnFileMetadata(b.path(".git/logs/HEAD"));
break :git;
},
error.FileNotFound => {
Expand Down
2 changes: 1 addition & 1 deletion build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// nix flake update --commit-lock-file
// ```
// If you do not use Nix, a ZLS maintainer can take care of this.
.minimum_zig_version = "0.17.0-dev.1936+5a625d5f3",
.minimum_zig_version = "0.17.0-dev.2375+d8aab4878",
// Must be kept in sync with the `deps.nix` for the Nix flake.
// If you do not use Nix, a ZLS maintainer can take care of this.
.dependencies = .{
Expand Down
6 changes: 2 additions & 4 deletions src/DiagnosticsCollection.zig
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,7 @@ pub fn pushErrorBundle(
const tracy_zone = tracy.trace(@src());
defer tracy_zone.end();

var new_error_bundle: std.zig.ErrorBundle.Wip = undefined;
try new_error_bundle.init(collection.allocator);
var new_error_bundle: std.zig.ErrorBundle.Wip = try .init(collection.allocator);
defer new_error_bundle.deinit();

collection.mutex.lockUncancelable(collection.io);
Expand Down Expand Up @@ -623,8 +622,7 @@ fn createTestingErrorBundle(
},
compile_log_text: []const u8,
) error{OutOfMemory}!std.zig.ErrorBundle {
var eb: std.zig.ErrorBundle.Wip = undefined;
try eb.init(std.testing.allocator);
var eb: std.zig.ErrorBundle.Wip = try .init(std.testing.allocator);
errdefer eb.deinit();

for (messages) |msg| {
Expand Down
12 changes: 4 additions & 8 deletions src/features/diagnostics.zig
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ pub fn generateDiagnostics(
.{ .error_bundle = error_bundle },
);
} else {
var wip: std.zig.ErrorBundle.Wip = undefined;
try wip.init(server.allocator);
var wip: std.zig.ErrorBundle.Wip = try .init(server.allocator);
defer wip.deinit();

try collectParseDiagnostics(&handle.tree, &wip);
Expand Down Expand Up @@ -310,8 +309,7 @@ pub fn getAstCheckDiagnostics(server: *Server, handle: *DocumentStore.Handle) er

if (!zir.hasCompileErrors()) return .empty;

var eb: std.zig.ErrorBundle.Wip = undefined;
try eb.init(server.allocator);
var eb: std.zig.ErrorBundle.Wip = try .init(server.allocator);
defer eb.deinit();
try eb.addZirErrorMessages(zir, handle.tree, handle.tree.source, "");
return try eb.toOwnedBundle("");
Expand All @@ -322,8 +320,7 @@ pub fn getAstCheckDiagnostics(server: *Server, handle: *DocumentStore.Handle) er

if (!zoir.hasCompileErrors()) return .empty;

var eb: std.zig.ErrorBundle.Wip = undefined;
try eb.init(server.allocator);
var eb: std.zig.ErrorBundle.Wip = try .init(server.allocator);
defer eb.deinit();
try eb.addZoirErrorMessages(zoir, handle.tree, handle.tree.source, "");
return try eb.toOwnedBundle("");
Expand Down Expand Up @@ -396,8 +393,7 @@ pub fn getErrorBundleFromStderr(
var notes: std.ArrayList(std.zig.ErrorBundle.MessageIndex) = .empty;
defer notes.deinit(allocator);

var error_bundle: std.zig.ErrorBundle.Wip = undefined;
try error_bundle.init(allocator);
var error_bundle: std.zig.ErrorBundle.Wip = try .init(allocator);
defer error_bundle.deinit();

const eb_empty_string = try error_bundle.addString("");
Expand Down
3 changes: 1 addition & 2 deletions src/main.zig
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,7 @@ fn loadConfigFromFile(io: std.Io, allocator: std.mem.Allocator, file_path: []con
&scanner,
parse_options,
) catch |err| {
var eb: std.zig.ErrorBundle.Wip = undefined;
try eb.init(allocator);
var eb: std.zig.ErrorBundle.Wip = try .init(allocator);
errdefer eb.deinit();

const src_path = try eb.addString(file_path);
Expand Down
2 changes: 1 addition & 1 deletion tests/add_analysis_cases.zig
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub fn addCases(
}),
});

b.dependOnDirectory(b.path(cases_path));
b.dependOnDirectoryContents(b.path(cases_path));

var dir = b.root.openDir(b.graph.io, cases_path, .{ .iterate = true }) catch |err|
std.debug.panic("failed to open '{f}': {}", .{ b.path(cases_path), err });
Expand Down
10 changes: 4 additions & 6 deletions tests/context.zig
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@ pub const Context = struct {
const cwd = try std.process.currentPathAlloc(io, allocator);
defer allocator.free(cwd);
config.zig_exe_path = try std.Io.Dir.path.resolve(allocator, &.{ cwd, test_options.zig_exe_path });
// https://codeberg.org/ziglang/zig/issues/35766
// config.zig_lib_path = try std.Io.Dir.path.resolve(allocator, &.{ cwd, test_options.zig_lib_path });
// config.global_cache_path = try std.Io.Dir.path.resolve(allocator, &.{ cwd, test_options.global_cache_path });
config.zig_lib_path = try std.Io.Dir.path.resolve(allocator, &.{ cwd, test_options.zig_lib_path });
config.global_cache_path = try std.Io.Dir.path.resolve(allocator, &.{ cwd, test_options.global_cache_path });
}

const environ_map = try cached_config_arena.allocator().create(std.process.Environ.Map);
Expand All @@ -59,9 +58,8 @@ pub const Context = struct {
std.debug.assert(server.config_manager.zig_lib_dir != null);
std.debug.assert(server.document_store.config.zig_lib_dir != null);

// https://codeberg.org/ziglang/zig/issues/35766
// std.debug.assert(server.config_manager.global_cache_dir != null);
// std.debug.assert(server.document_store.config.global_cache_dir != null);
std.debug.assert(server.config_manager.global_cache_dir != null);
std.debug.assert(server.document_store.config.global_cache_dir != null);

var context: Context = .{
.server = server,
Expand Down
5 changes: 2 additions & 3 deletions tests/lifecycle.zig
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ test "LSP lifecycle" {

try config_manager.setConfiguration(.frontend, &.{
.zig_exe_path = try std.Io.Dir.path.resolve(arena, &.{ cwd, test_options.zig_exe_path }),
// https://codeberg.org/ziglang/zig/issues/35766
// .zig_lib_path = try std.Io.Dir.path.resolve(arena, &.{ cwd, test_options.zig_lib_path }),
// .global_cache_path = try std.Io.Dir.path.resolve(arena, &.{ cwd, test_options.global_cache_path }),
.zig_lib_path = try std.Io.Dir.path.resolve(arena, &.{ cwd, test_options.zig_lib_path }),
.global_cache_path = try std.Io.Dir.path.resolve(arena, &.{ cwd, test_options.global_cache_path }),
});
}

Expand Down
6 changes: 0 additions & 6 deletions tests/lsp_features/completion.zig
Original file line number Diff line number Diff line change
Expand Up @@ -3701,9 +3701,6 @@ test "empty doc comment" {
test "filesystem" {
if (@import("builtin").target.cpu.arch.isWasm()) return error.SkipZigTest;

// https://codeberg.org/ziglang/zig/issues/35766
if (true) return error.SkipZigTest;

try testCompletion(
\\const foo = @import("<cursor>");
, &.{
Expand All @@ -3721,9 +3718,6 @@ test "filesystem" {
test "filesystem string literal ends with non ASCII symbol" {
if (@import("builtin").target.cpu.arch.isWasm()) return error.SkipZigTest;

// https://codeberg.org/ziglang/zig/issues/35766
if (true) return error.SkipZigTest;

try testCompletion(
\\const foo = @import("<cursor> 🠁
, &.{
Expand Down
Loading