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",
|
||||||
|
39
src/main.zig
39
src/main.zig
@ -261,19 +261,34 @@ 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;
|
||||||
temp[i] = .{
|
if (build_options.no_snippets) {
|
||||||
.label = builtin[0..cutoff],
|
temp[i] = .{
|
||||||
.kind = .Function,
|
.label = builtin[0..cutoff],
|
||||||
|
.kind = .Function,
|
||||||
|
|
||||||
.filterText = builtin[1..cutoff],
|
.filterText = builtin[1..cutoff],
|
||||||
.insertText = builtin[1..],
|
.insertText = builtin[1..cutoff],
|
||||||
.insertTextFormat = .Snippet,
|
.detail = data.builtin_details[i],
|
||||||
.detail = data.builtin_details[i],
|
.documentation = .{
|
||||||
.documentation = .{
|
.kind = .Markdown,
|
||||||
.kind = .Markdown,
|
.value = data.builtin_docs[i],
|
||||||
.value = data.builtin_docs[i],
|
},
|
||||||
},
|
};
|
||||||
};
|
} else {
|
||||||
|
temp[i] = .{
|
||||||
|
.label = builtin[0..cutoff],
|
||||||
|
.kind = .Function,
|
||||||
|
|
||||||
|
.filterText = builtin[1..cutoff],
|
||||||
|
.insertText = builtin[1..],
|
||||||
|
.insertTextFormat = .Snippet,
|
||||||
|
.detail = data.builtin_details[i],
|
||||||
|
.documentation = .{
|
||||||
|
.kind = .Markdown,
|
||||||
|
.value = data.builtin_docs[i],
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break :block temp;
|
break :block temp;
|
||||||
|
Loading…
Reference in New Issue
Block a user