-
-
Notifications
You must be signed in to change notification settings - Fork 3
Adapt project to zls 0.11.0 #1
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,7 +31,7 @@ pub fn main() !void { | |
| // Create a server, then set its encoding | ||
| // to utf-8 so we can use the same indices | ||
| // as a normal zig []const u8 | ||
| var server = try zls.Server.create(allocator, &config, null, false, false); | ||
| var server = try zls.Server.create(allocator, &config, null); | ||
| server.offset_encoding = .@"utf-8"; | ||
| defer server.destroy(); | ||
|
|
||
|
|
@@ -48,7 +48,7 @@ pub fn main() !void { | |
| while (true) { | ||
| // Free the server arena if it's past | ||
| // a certain threshold | ||
| defer server.maybeFreeArena(); | ||
| //defer server.maybeFreeArena(); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. there is no equivalent function for |
||
|
|
||
| var stdio = std.io.getStdIn().reader(); | ||
| const input = stdio.readUntilDelimiterOrEof(&input_buf, '\n') catch |err| switch (err) { | ||
|
|
@@ -71,15 +71,17 @@ pub fn main() !void { | |
| , .{input})); | ||
|
|
||
| // We request completions from zls | ||
| const completions: []const zls.types.CompletionItem = (try server.completionHandler(.{ | ||
|
|
||
| const emptyList: zls.Server.ResultType("textDocument/completion") = .{ .CompletionList = zls.types.CompletionList{ .isIncomplete = true, .items = &.{} } }; | ||
| const completions: []const zls.types.CompletionItem = (try server.completionHandler(allocator, .{ | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I didn't intend for the You are also leaking memory here because |
||
| .textDocument = .{ | ||
| .uri = "file:///C:/Programming/Zig/zls-as-lib-demo/src/bs.zig", | ||
| }, | ||
| .position = .{ | ||
| .line = 4, | ||
| .character = @intCast(u32, 4 + input.len), | ||
| .character = @intCast(4 + input.len), | ||
| }, | ||
| }) orelse zls.types.CompletionList{ .isIncomplete = true, .items = &.{} }).items; | ||
| }) orelse emptyList).?.CompletionList.items; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the unwrap is needed here because ?union(enum) {
array_of_CompletionItem: []const CompletionItem,
CompletionList: CompletionList,
pub usingnamespace UnionParser(@This());
}This means that |
||
|
|
||
| // We print out the completions | ||
| for (completions) |comp| { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be replaced with
b.installArtifact(exe);