std.debug.print("Found zig executable '{s}' in PATH.\n",.{path});
}else{
std.debug.print("Could not find 'zig' in PATH\n",.{});
zig_exe_path=tryzinput.askString(allocator,"What is the path to the 'zig' executable you would like to use?",std.fs.MAX_PATH_BYTES);
}
consteditor=tryzinput.askSelectOne("Which code editor do you use?",enum{VSCode,Sublime,Kate,Neovim,Vim8,Emacs,Doom,Other});
constsnippets=tryzinput.askBool("Do you want to enable snippets?");
conststyle=tryzinput.askBool("Do you want to enable style warnings?");
constsemantic_tokens=tryzinput.askBool("Do you want to enable semantic highlighting?");
constoperator_completions=tryzinput.askBool("Do you want to enable .* and .? completions?");
constinclude_at_in_builtins=switch(editor){
.Sublime=>
true,
.VSCode,
.Kate,
.Neovim,
.Vim8,
.Emacs,
.Doom=>
false,
else=>
tryzinput.askBool("Should the @ sign be included in completions of builtin functions?\nChange this later if `@inc` completes to `include` or `@@include`")
};
constmax_detail_length:usize=switch(editor){
.Sublime=>
256,
else=>
1024*1024
};
vardir=trystd.fs.cwd().openDir(exe_dir,.{});
deferdir.close();
varfile=trydir.createFile("zls.json",.{});
deferfile.close();
constout=file.writer();
std.debug.warn("Writing config to {s}/zls.json ... ",.{exe_dir});
constcontent=std.json.stringify(.{
.zig_exe_path=zig_exe_path,
.enable_snippets=snippets,
.warn_style=style,
.enable_semantic_tokens=semantic_tokens,
.operator_completions=operator_completions,
.include_at_in_builtins=include_at_in_builtins,
.max_detail_length=max_detail_length,
},std.json.StringifyOptions{},out);
std.debug.warn("successful.\n\n\n\n",.{});
// Keep synced with README.md
switch(editor){
.VSCode=>{
std.debug.warn(
\\To use ZLS in Visual Studio Code, install the 'ZLS for VSCode' extension from
\\'https://github.com/zigtools/zls-vscode/releases' or via the extensions menu.
\\Then, open VSCode's 'settings.json' file, and add: