-
-
Notifications
You must be signed in to change notification settings - Fork 336
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
revive C import support #1136
revive C import support #1136
Conversation
35ba14c
to
82f9199
Compare
Doesn't seem to be working for me - translate-c errors out with Full zls log:
|
I didn't check on Windows, it should work now. |
I'm on Linux, and using the latest commit in this branch :) |
82f9199
to
106a864
Compare
I should have read that log more carefully, my bad. I thought I just fixed that error. |
No error any more, but still no completions. It works when I |
resolving include paths from build.zig may not work correctly anymore. I will check later if something regressed. |
I had to change a few things to make it build with Zig Patchdiff --git a/src/analyser/InternPool.zig b/src/analyser/InternPool.zig
index 42f3afb..5a68ee2 100644
--- a/src/analyser/InternPool.zig
+++ b/src/analyser/InternPool.zig
@@ -3315,15 +3315,15 @@ test "bytes value" {
var str1: [43]u8 = "https://www.youtube.com/watch?v=dQw4w9WgXcQ".*;
const bytes_value1 = try ip.get(gpa, .{ .bytes = &str1 });
- @memset(&str1, 0, str1.len);
+ @memset(&str1, 0);
var str2: [43]u8 = "https://www.youtube.com/watch?v=dQw4w9WgXcQ".*;
const bytes_value2 = try ip.get(gpa, .{ .bytes = &str2 });
- @memset(&str2, 0, str2.len);
+ @memset(&str2, 0);
var str3: [26]u8 = "https://www.duckduckgo.com".*;
const bytes_value3 = try ip.get(gpa, .{ .bytes = &str3 });
- @memset(&str3, 0, str3.len);
+ @memset(&str3, 0);
try expect(bytes_value1 == bytes_value2);
try expect(bytes_value2 != bytes_value3);
diff --git a/src/main.zig b/src/main.zig
index b3e6251..6636e61 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -345,7 +345,7 @@ const stack_frames = switch (zig_builtin.mode) {
pub fn main() !void {
var gpa_state = std.heap.GeneralPurposeAllocator(.{ .stack_trace_frames = stack_frames }){};
- defer std.debug.assert(!gpa_state.deinit());
+ defer std.debug.assert(gpa_state.deinit() == .ok);
var tracy_state = if (tracy.enable_allocation) tracy.tracyAllocator(gpa_state.allocator()) else void{};
const inner_allocator: std.mem.Allocator = if (tracy.enable_allocation) tracy_state.allocator() else gpa_state.allocator(); |
This works well for me when rebased to zls master. |
106a864
to
ea6c626
Compare
ea6c626
to
b8d7a71
Compare
@Techatrix thanks for your work on this feature. Completions currently work but hover for identifier information doesn't work. In
on hover |
Can you provide me with an example and steps you took to get this error? Information on your neovim setup would also be appreciated because I don't have much experience dealing with neovim. |
Steps to reproduce the error
NOTE: may neovim configuration |
b8d7a71
to
beda996
Compare
beda996
to
b623f14
Compare
Works on all my projects that use cimport. Including a non-existant file results in an error in the log but zls keeps going 👍 Error
|
@Ultra-Code #1232 should have fixed your hover issue. (nice nvim config btw) |
@Techatrix thanks for the fix, Indeed the hover works now 😄 . |
Its time to bring back C import support. fixes #1080
Please feel free to try this out and report any issues.
error reporting currently doesn't work because of an issue on the zig side (I suspect)