@@ -107,7 +107,7 @@ fn loadPackages(context: LoadPackagesContext) !void {
107
107
switch (zig_run_result .term ) {
108
108
.Exited = > | exit_code | {
109
109
if (exit_code == 0 ) {
110
- log .debug ("Finished zig run for build file {}\n " , .{build_file .uri });
110
+ log .debug ("Finished zig run for build file {}" , .{build_file .uri });
111
111
112
112
for (build_file .packages .items ) | old_pkg | {
113
113
allocator .free (old_pkg .name );
@@ -145,7 +145,7 @@ fn loadPackages(context: LoadPackagesContext) !void {
145
145
/// This function asserts the document is not open yet and takes ownership
146
146
/// of the uri and text passed in.
147
147
fn newDocument (self : * DocumentStore , uri : []const u8 , text : []u8 ) anyerror ! * Handle {
148
- log .debug ("Opened document: {}\n " , .{uri });
148
+ log .debug ("Opened document: {}" , .{uri });
149
149
150
150
var handle = try self .allocator .create (Handle );
151
151
errdefer self .allocator .destroy (handle );
@@ -173,7 +173,7 @@ fn newDocument(self: *DocumentStore, uri: []const u8, text: []u8) anyerror!*Hand
173
173
// TODO: Better logic for detecting std or subdirectories?
174
174
const in_std = std .mem .indexOf (u8 , uri , "/std/" ) != null ;
175
175
if (self .zig_exe_path != null and std .mem .endsWith (u8 , uri , "/build.zig" ) and ! in_std ) {
176
- log .debug ("Document is a build file, extracting packages...\n " , .{});
176
+ log .debug ("Document is a build file, extracting packages..." , .{});
177
177
// This is a build file.
178
178
var build_file = try self .allocator .create (BuildFile );
179
179
errdefer self .allocator .destroy (build_file );
@@ -195,15 +195,15 @@ fn newDocument(self: *DocumentStore, uri: []const u8, text: []u8) anyerror!*Hand
195
195
.build_runner_path = self .build_runner_path ,
196
196
.zig_exe_path = self .zig_exe_path .? ,
197
197
}) catch | err | {
198
- log .debug ("Failed to load packages of build file {} (error: {})\n " , .{ build_file .uri , err });
198
+ log .debug ("Failed to load packages of build file {} (error: {})" , .{ build_file .uri , err });
199
199
};
200
200
} else if (self .zig_exe_path != null and ! in_std ) associate_build_file : {
201
201
// Look into build files to see if we already have one that fits
202
202
for (self .build_files .items ) | build_file | {
203
203
const build_file_base_uri = build_file .uri [0 .. std .mem .lastIndexOfScalar (u8 , build_file .uri , '/' ).? + 1 ];
204
204
205
205
if (std .mem .startsWith (u8 , uri , build_file_base_uri )) {
206
- log .debug ("Found an associated build file: {}\n " , .{build_file .uri });
206
+ log .debug ("Found an associated build file: {}" , .{build_file .uri });
207
207
build_file .refs += 1 ;
208
208
handle .associated_build_file = build_file ;
209
209
break :associate_build_file ;
@@ -255,12 +255,12 @@ fn newDocument(self: *DocumentStore, uri: []const u8, text: []u8) anyerror!*Hand
255
255
256
256
pub fn openDocument (self : * DocumentStore , uri : []const u8 , text : []const u8 ) ! * Handle {
257
257
if (self .handles .getEntry (uri )) | entry | {
258
- log .debug ("Document already open: {}, incrementing count\n " , .{uri });
258
+ log .debug ("Document already open: {}, incrementing count" , .{uri });
259
259
entry .value .count += 1 ;
260
260
if (entry .value .is_build_file ) | build_file | {
261
261
build_file .refs += 1 ;
262
262
}
263
- log .debug ("New count: {}\n " , .{entry .value .count });
263
+ log .debug ("New count: {}" , .{entry .value .count });
264
264
return entry .value ;
265
265
}
266
266
@@ -275,7 +275,7 @@ pub fn openDocument(self: *DocumentStore, uri: []const u8, text: []const u8) !*H
275
275
fn decrementBuildFileRefs (self : * DocumentStore , build_file : * BuildFile ) void {
276
276
build_file .refs -= 1 ;
277
277
if (build_file .refs == 0 ) {
278
- log .debug ("Freeing build file {}\n " , .{build_file .uri });
278
+ log .debug ("Freeing build file {}" , .{build_file .uri });
279
279
for (build_file .packages .items ) | pkg | {
280
280
self .allocator .free (pkg .name );
281
281
self .allocator .free (pkg .uri );
@@ -301,7 +301,7 @@ fn decrementCount(self: *DocumentStore, uri: []const u8) void {
301
301
if (entry .value .count > 0 )
302
302
return ;
303
303
304
- log .debug ("Freeing document: {}\n " , .{uri });
304
+ log .debug ("Freeing document: {}" , .{uri });
305
305
306
306
if (entry .value .associated_build_file ) | build_file | {
307
307
self .decrementBuildFileRefs (build_file );
@@ -338,7 +338,7 @@ pub fn getHandle(self: *DocumentStore, uri: []const u8) ?*Handle {
338
338
339
339
// Check if the document text is now sane, move it to sane_text if so.
340
340
fn refreshDocument (self : * DocumentStore , handle : * Handle , zig_lib_path : ? []const u8 ) ! void {
341
- log .debug ("New text for document {}\n " , .{handle .uri ()});
341
+ log .debug ("New text for document {}" , .{handle .uri ()});
342
342
handle .tree .deinit ();
343
343
handle .tree = try std .zig .parse (self .allocator , handle .document .text );
344
344
@@ -384,7 +384,7 @@ fn refreshDocument(self: *DocumentStore, handle: *Handle, zig_lib_path: ?[]const
384
384
while (idx < still_exist .len ) : (idx += 1 ) {
385
385
if (still_exist [idx ]) continue ;
386
386
387
- log .debug ("Import removed: {}\n " , .{handle .import_uris .items [idx - offset ]});
387
+ log .debug ("Import removed: {}" , .{handle .import_uris .items [idx - offset ]});
388
388
const uri = handle .import_uris .orderedRemove (idx - offset );
389
389
offset += 1 ;
390
390
@@ -401,7 +401,7 @@ pub fn applySave(self: *DocumentStore, handle: *Handle) !void {
401
401
.build_runner_path = self .build_runner_path ,
402
402
.zig_exe_path = self .zig_exe_path .? ,
403
403
}) catch | err | {
404
- log .debug ("Failed to load packages of build file {} (error: {})\n " , .{ build_file .uri , err });
404
+ log .debug ("Failed to load packages of build file {} (error: {})" , .{ build_file .uri , err });
405
405
};
406
406
}
407
407
}
@@ -483,7 +483,7 @@ pub fn uriFromImportStr(
483
483
) ! ? []const u8 {
484
484
if (std .mem .eql (u8 , import_str , "std" )) {
485
485
if (self .std_uri ) | uri | return try std .mem .dupe (allocator , u8 , uri ) else {
486
- log .debug ("Cannot resolve std library import, path is null.\n " , .{});
486
+ log .debug ("Cannot resolve std library import, path is null." , .{});
487
487
return null ;
488
488
}
489
489
} else if (std .mem .eql (u8 , import_str , "builtin" )) {
@@ -549,7 +549,7 @@ pub fn resolveImport(self: *DocumentStore, handle: *Handle, import_str: []const
549
549
defer allocator .free (file_path );
550
550
551
551
var file = std .fs .cwd ().openFile (file_path , .{}) catch {
552
- log .debug ("Cannot open import file {}\n " , .{file_path });
552
+ log .debug ("Cannot open import file {}" , .{file_path });
553
553
return null ;
554
554
};
555
555
@@ -561,7 +561,7 @@ pub fn resolveImport(self: *DocumentStore, handle: *Handle, import_str: []const
561
561
errdefer allocator .free (file_contents );
562
562
563
563
file .reader ().readNoEof (file_contents ) catch {
564
- log .debug ("Could not read from file {}\n " , .{file_path });
564
+ log .debug ("Could not read from file {}" , .{file_path });
565
565
return null ;
566
566
};
567
567
@@ -582,7 +582,7 @@ fn stdUriFromLibPath(allocator: *std.mem.Allocator, zig_lib_path: ?[]const u8) !
582
582
const std_path = std .fs .path .resolve (allocator , &[_ ][]const u8 {
583
583
zpath , "./std/std.zig" ,
584
584
}) catch | err | {
585
- log .debug ("Failed to resolve zig std library path, error: {}\n " , .{err });
585
+ log .debug ("Failed to resolve zig std library path, error: {}" , .{err });
586
586
return null ;
587
587
};
588
588
0 commit comments