Fix rogue resize, bump minimum version (#805)

This commit is contained in:
Auguste Rame 2022-12-03 21:35:51 -05:00 committed by GitHub
parent cfb0b023ad
commit 580469cd32
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 14 deletions

View File

@ -6,7 +6,7 @@ const zls_version = std.builtin.Version{ .major = 0, .minor = 11, .patch = 0 };
pub fn build(b: *std.build.Builder) !void { pub fn build(b: *std.build.Builder) !void {
const current_zig = builtin.zig_version; const current_zig = builtin.zig_version;
const min_zig = std.SemanticVersion.parse("0.11.0-dev.323+30eb2a175") catch return; // added tuple declaration support const min_zig = std.SemanticVersion.parse("0.11.0-dev.399+44ee1c885") catch return; // whereabouts allocgate 2.0
if (current_zig.order(min_zig).compare(.lt)) @panic(b.fmt("Your Zig version v{} does not meet the minimum build requirement of v{}", .{ current_zig, min_zig })); if (current_zig.order(min_zig).compare(.lt)) @panic(b.fmt("Your Zig version v{} does not meet the minimum build requirement of v{}", .{ current_zig, min_zig }));
const target = b.standardTargetOptions(.{}); const target = b.standardTargetOptions(.{});

View File

@ -101,7 +101,7 @@ pub fn parse(allocator: std.mem.Allocator, str: []const u8) ![]u8 {
if (str.len < 7 or !std.mem.eql(u8, "file://", str[0..7])) return error.UriBadScheme; if (str.len < 7 or !std.mem.eql(u8, "file://", str[0..7])) return error.UriBadScheme;
var uri = try allocator.alloc(u8, str.len - (if (std.fs.path.sep == '\\') 8 else 7)); var uri = try allocator.alloc(u8, str.len - (if (std.fs.path.sep == '\\') 8 else 7));
errdefer allocator.free(uri); defer allocator.free(uri);
const path = if (std.fs.path.sep == '\\') str[8..] else str[7..]; const path = if (std.fs.path.sep == '\\') str[8..] else str[7..];
@ -125,7 +125,5 @@ pub fn parse(allocator: std.mem.Allocator, str: []const u8) ![]u8 {
i -= 1; i -= 1;
} }
_ = allocator.resize(uri, i); return try allocator.dupe(u8, uri[0..i]);
return uri;
} }

View File

@ -269,7 +269,7 @@ test "completion - union" {
} }
test "completion - enum" { test "completion - enum" {
// TODO: Fix this test // TODO: Fix
return error.SkipZigTest; return error.SkipZigTest;
// try testCompletion( // try testCompletion(
// \\const E = enum { // \\const E = enum {

View File

@ -13,14 +13,11 @@ test "semantic tokens - empty" {
} }
test "semantic tokens" { test "semantic tokens" {
// TODO: Fix this test try testSemanticTokens(
return error.SkipZigTest; \\const std = @import("std");
,
// try testSemanticTokens( &.{ 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 },
// \\const std = @import("std"); );
// ,
// &.{ 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 },
// );
// TODO more tests // TODO more tests
} }