Add no_snippets
This commit is contained in:
parent
14a2796857
commit
01ff89eea3
@ -23,6 +23,12 @@ pub fn build(b: *std.build.Builder) !void {
|
||||
data_version,
|
||||
);
|
||||
|
||||
exe.addBuildOption(
|
||||
bool,
|
||||
"no_snippets",
|
||||
b.option(bool, "no_snippets", "Use regular completion without snippets. Useful for compatibility.") orelse false,
|
||||
);
|
||||
|
||||
exe.addBuildOption(
|
||||
bool,
|
||||
"leak_detection",
|
||||
|
15
src/main.zig
15
src/main.zig
@ -261,6 +261,20 @@ const builtin_completions = block: {
|
||||
|
||||
for (data.builtins) |builtin, i| {
|
||||
var cutoff = std.mem.indexOf(u8, builtin, "(") orelse builtin.len;
|
||||
if (build_options.no_snippets) {
|
||||
temp[i] = .{
|
||||
.label = builtin[0..cutoff],
|
||||
.kind = .Function,
|
||||
|
||||
.filterText = builtin[1..cutoff],
|
||||
.insertText = builtin[1..cutoff],
|
||||
.detail = data.builtin_details[i],
|
||||
.documentation = .{
|
||||
.kind = .Markdown,
|
||||
.value = data.builtin_docs[i],
|
||||
},
|
||||
};
|
||||
} else {
|
||||
temp[i] = .{
|
||||
.label = builtin[0..cutoff],
|
||||
.kind = .Function,
|
||||
@ -275,6 +289,7 @@ const builtin_completions = block: {
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
break :block temp;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user