feat: add support for absolute paths to LSP and formatter binaries
Also, refactor binary resolving functions into the bin_path module. closes #474
This commit is contained in:
parent
d24f335465
commit
4847a1f584
4 changed files with 26 additions and 18 deletions
|
|
@ -46,12 +46,12 @@ pub fn list(allocator: std.mem.Allocator, writer: *std.io.Writer, tty_config: st
|
|||
try write_segmented(writer, file_type.extensions, ",", max_extensions_len + 1, tty_config);
|
||||
|
||||
if (file_type.language_server) |language_server|
|
||||
try write_checkmark(writer, can_execute(allocator, language_server[0]), tty_config);
|
||||
try write_checkmark(writer, bin_path.can_execute(allocator, language_server[0]), tty_config);
|
||||
|
||||
try write_segmented(writer, file_type.language_server, " ", max_langserver_len + 1, tty_config);
|
||||
|
||||
if (file_type.formatter) |formatter|
|
||||
try write_checkmark(writer, can_execute(allocator, formatter[0]), tty_config);
|
||||
try write_checkmark(writer, bin_path.can_execute(allocator, formatter[0]), tty_config);
|
||||
|
||||
try write_segmented(writer, file_type.formatter, " ", null, tty_config);
|
||||
try writer.writeAll("\n");
|
||||
|
|
@ -96,12 +96,6 @@ fn write_segmented(
|
|||
if (pad) |pad_| try write_padding(writer, len, pad_);
|
||||
}
|
||||
|
||||
fn can_execute(allocator: std.mem.Allocator, binary_name: []const u8) bool {
|
||||
const resolved_binary_path = bin_path.find_binary_in_path(allocator, binary_name) catch return false;
|
||||
defer if (resolved_binary_path) |path| allocator.free(path);
|
||||
return resolved_binary_path != null;
|
||||
}
|
||||
|
||||
fn setColorRgb(writer: anytype, color: u24) !void {
|
||||
const fg_rgb_legacy = "\x1b[38;2;{d};{d};{d}m";
|
||||
const rgb = RGB.from_u24(color);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue