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,
|
data_version,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
exe.addBuildOption(
|
||||||
|
bool,
|
||||||
|
"no_snippets",
|
||||||
|
b.option(bool, "no_snippets", "Use regular completion without snippets. Useful for compatibility.") orelse false,
|
||||||
|
);
|
||||||
|
|
||||||
exe.addBuildOption(
|
exe.addBuildOption(
|
||||||
bool,
|
bool,
|
||||||
"leak_detection",
|
"leak_detection",
|
||||||
|
15
src/main.zig
15
src/main.zig
@ -261,6 +261,20 @@ const builtin_completions = block: {
|
|||||||
|
|
||||||
for (data.builtins) |builtin, i| {
|
for (data.builtins) |builtin, i| {
|
||||||
var cutoff = std.mem.indexOf(u8, builtin, "(") orelse builtin.len;
|
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] = .{
|
temp[i] = .{
|
||||||
.label = builtin[0..cutoff],
|
.label = builtin[0..cutoff],
|
||||||
.kind = .Function,
|
.kind = .Function,
|
||||||
@ -275,6 +289,7 @@ const builtin_completions = block: {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
break :block temp;
|
break :block temp;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user