correctly handle path to uri conversion
This commit is contained in:
parent
d57f8e3a64
commit
f543659e31
@ -605,12 +605,15 @@ fn translate(self: *DocumentStore, handle: *Handle, source: []const u8) !?[]cons
|
|||||||
};
|
};
|
||||||
defer self.allocator.free(include_dirs);
|
defer self.allocator.free(include_dirs);
|
||||||
|
|
||||||
return translate_c.translate(
|
const file_path = (try translate_c.translate(
|
||||||
self.allocator,
|
self.allocator,
|
||||||
self.config,
|
self.config,
|
||||||
include_dirs,
|
include_dirs,
|
||||||
source,
|
source,
|
||||||
);
|
)) orelse return null;
|
||||||
|
defer self.allocator.free(file_path);
|
||||||
|
|
||||||
|
return try URI.fromPath(self.allocator, file_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn refreshDocument(self: *DocumentStore, handle: *Handle) !void {
|
fn refreshDocument(self: *DocumentStore, handle: *Handle) !void {
|
||||||
|
@ -161,10 +161,7 @@ pub fn translate(allocator: std.mem.Allocator, config: Config, include_dirs: []c
|
|||||||
|
|
||||||
return switch (result.term) {
|
return switch (result.term) {
|
||||||
.Exited => |code| if (code == 0) {
|
.Exited => |code| if (code == 0) {
|
||||||
return try std.mem.join(allocator, "", &.{
|
return try allocator.dupe(u8, std.mem.sliceTo(result.stdout, '\n'));
|
||||||
"file://",
|
|
||||||
std.mem.sliceTo(result.stdout, '\n'),
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
// TODO convert failure to `textDocument/publishDiagnostics`
|
// TODO convert failure to `textDocument/publishDiagnostics`
|
||||||
std.log.err("zig translate-c process failed, code: {}, stderr: '{s}'", .{ code, result.stderr });
|
std.log.err("zig translate-c process failed, code: {}, stderr: '{s}'", .{ code, result.stderr });
|
||||||
|
Loading…
Reference in New Issue
Block a user