From 0436b05b801b6a4603c0233d3a4c2cdb8314d5ae Mon Sep 17 00:00:00 2001 From: Techatrix <19954306+Techatrix@users.noreply.github.com> Date: Thu, 18 Aug 2022 23:14:32 +0200 Subject: [PATCH] rename `build_runner_cache_path` to `global_cache_path` --- README.md | 2 +- src/Config.zig | 6 +++--- src/DocumentStore.zig | 10 +++++----- src/requests.zig | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 740c6ee..68f8fc9 100644 --- a/README.md +++ b/README.md @@ -108,7 +108,7 @@ The following options are currently available. | `zig_exe_path` | `?[]const u8` | `null` | zig executable path, e.g. `/path/to/zig/zig`, used to run the custom build runner. If `null`, zig is looked up in `PATH`. Will be used to infer the zig standard library path if none is provided. | | `warn_style` | `bool` | `false` | Enables warnings for style *guideline* mismatches | | `build_runner_path` | `?[]const u8` | `null` | Path to the build_runner.zig file provided by zls. `null` is equivalent to `${executable_directory}/build_runner.zig` | -| `build_runner_cache_path` | `?[]const u8` | `null` | Path to a directroy that will be used as zig's cache when running `zig run build_runner.zig ...`. `null` is equivalent to `${KnownFloders.Cache}/zls` | +| `global_cache_path` | `?[]const u8` | `null` | Path to a directroy that will be used as zig's cache. `null` is equivalent to `${KnownFloders.Cache}/zls` | | `enable_semantic_tokens` | `bool` | `true` | Enables semantic token support when the client also supports it. | | `enable_inlay_hints` | `bool` | `false` | Enables inlay hint support when the client also supports it. | | `operator_completions` | `bool` | `true` | Enables `*` and `?` operators in completion lists. | diff --git a/src/Config.zig b/src/Config.zig index 55eec53..440a4b3 100644 --- a/src/Config.zig +++ b/src/Config.zig @@ -32,8 +32,8 @@ warn_style: bool = false, /// Path to the build_runner.zig file. build_runner_path: ?[]const u8 = null, -/// Path to a directory that will be used as cache when `zig run`ning the build runner -build_runner_cache_path: ?[]const u8 = null, +/// Path to the global cache directory +global_cache_path: ?[]const u8 = null, /// Semantic token support enable_semantic_tokens: bool = true, @@ -208,7 +208,7 @@ pub fn configChanged(config: *Config, allocator: std.mem.Allocator, builtin_crea break :blk try std.fs.path.resolve(allocator, &[_][]const u8{ exe_dir_path, "build_runner.zig" }); }; - config.build_runner_cache_path = if (config.build_runner_cache_path) |p| + config.global_cache_path = if (config.global_cache_path) |p| try allocator.dupe(u8, p) else blk: { const cache_dir_path = (try known_folders.getPath(allocator, .cache)) orelse { diff --git a/src/DocumentStore.zig b/src/DocumentStore.zig index 438af2b..9f4b3e3 100644 --- a/src/DocumentStore.zig +++ b/src/DocumentStore.zig @@ -110,7 +110,7 @@ const LoadBuildConfigContext = struct { build_file: *BuildFile, allocator: std.mem.Allocator, build_runner_path: []const u8, - build_runner_cache_path: []const u8, + global_cache_path: []const u8, zig_exe_path: []const u8, build_file_path: ?[]const u8 = null, cache_root: []const u8, @@ -124,7 +124,7 @@ fn loadBuildConfiguration(context: LoadBuildConfigContext) !void { const allocator = context.allocator; const build_file = context.build_file; const build_runner_path = context.build_runner_path; - const build_runner_cache_path = context.build_runner_cache_path; + const global_cache_path = context.global_cache_path; const zig_exe_path = context.zig_exe_path; const build_file_path = context.build_file_path orelse try URI.parse(allocator, build_file.uri); @@ -136,7 +136,7 @@ fn loadBuildConfiguration(context: LoadBuildConfigContext) !void { "run", build_runner_path, "--cache-dir", - build_runner_cache_path, + global_cache_path, "--pkg-begin", "@build@", build_file_path, @@ -255,7 +255,7 @@ fn newDocument(self: *DocumentStore, uri: []const u8, text: [:0]u8) anyerror!*Ha .build_file = build_file, .allocator = self.allocator, .build_runner_path = self.config.build_runner_path.?, - .build_runner_cache_path = self.config.build_runner_cache_path.?, + .global_cache_path = self.config.global_cache_path.?, .zig_exe_path = self.config.zig_exe_path.?, .build_file_path = build_file_path, .cache_root = self.zig_cache_root, @@ -522,7 +522,7 @@ pub fn applySave(self: *DocumentStore, handle: *Handle) !void { .build_file = build_file, .allocator = self.allocator, .build_runner_path = self.config.build_runner_path.?, - .build_runner_cache_path = self.config.build_runner_cache_path.?, + .global_cache_path = self.config.global_cache_path.?, .zig_exe_path = self.config.zig_exe_path.?, .cache_root = self.zig_cache_root, .global_cache_root = self.zig_global_cache_root, diff --git a/src/requests.zig b/src/requests.zig index 621ed94..d96496e 100644 --- a/src/requests.zig +++ b/src/requests.zig @@ -282,7 +282,7 @@ pub const Configuration = struct { zig_exe_path: ?[]const u8, warn_style: ?bool, build_runner_path: ?[]const u8, - build_runner_cache_path: ?[]const u8, + global_cache_path: ?[]const u8, enable_semantic_tokens: ?bool, enable_inlay_hints: ?bool, inlay_hints_show_builtin: ?bool,