rename build_runner_cache_path to global_cache_path

This commit is contained in:
Techatrix 2022-08-18 23:14:32 +02:00
parent 1859afd4c5
commit 0436b05b80
4 changed files with 10 additions and 10 deletions

View File

@ -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. | | `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 | | `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_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_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. | | `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. | | `operator_completions` | `bool` | `true` | Enables `*` and `?` operators in completion lists. |

View File

@ -32,8 +32,8 @@ warn_style: bool = false,
/// Path to the build_runner.zig file. /// Path to the build_runner.zig file.
build_runner_path: ?[]const u8 = null, build_runner_path: ?[]const u8 = null,
/// Path to a directory that will be used as cache when `zig run`ning the build runner /// Path to the global cache directory
build_runner_cache_path: ?[]const u8 = null, global_cache_path: ?[]const u8 = null,
/// Semantic token support /// Semantic token support
enable_semantic_tokens: bool = true, 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" }); 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) try allocator.dupe(u8, p)
else blk: { else blk: {
const cache_dir_path = (try known_folders.getPath(allocator, .cache)) orelse { const cache_dir_path = (try known_folders.getPath(allocator, .cache)) orelse {

View File

@ -110,7 +110,7 @@ const LoadBuildConfigContext = struct {
build_file: *BuildFile, build_file: *BuildFile,
allocator: std.mem.Allocator, allocator: std.mem.Allocator,
build_runner_path: []const u8, build_runner_path: []const u8,
build_runner_cache_path: []const u8, global_cache_path: []const u8,
zig_exe_path: []const u8, zig_exe_path: []const u8,
build_file_path: ?[]const u8 = null, build_file_path: ?[]const u8 = null,
cache_root: []const u8, cache_root: []const u8,
@ -124,7 +124,7 @@ fn loadBuildConfiguration(context: LoadBuildConfigContext) !void {
const allocator = context.allocator; const allocator = context.allocator;
const build_file = context.build_file; const build_file = context.build_file;
const build_runner_path = context.build_runner_path; 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 zig_exe_path = context.zig_exe_path;
const build_file_path = context.build_file_path orelse try URI.parse(allocator, build_file.uri); 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", "run",
build_runner_path, build_runner_path,
"--cache-dir", "--cache-dir",
build_runner_cache_path, global_cache_path,
"--pkg-begin", "--pkg-begin",
"@build@", "@build@",
build_file_path, build_file_path,
@ -255,7 +255,7 @@ fn newDocument(self: *DocumentStore, uri: []const u8, text: [:0]u8) anyerror!*Ha
.build_file = build_file, .build_file = build_file,
.allocator = self.allocator, .allocator = self.allocator,
.build_runner_path = self.config.build_runner_path.?, .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.?, .zig_exe_path = self.config.zig_exe_path.?,
.build_file_path = build_file_path, .build_file_path = build_file_path,
.cache_root = self.zig_cache_root, .cache_root = self.zig_cache_root,
@ -522,7 +522,7 @@ pub fn applySave(self: *DocumentStore, handle: *Handle) !void {
.build_file = build_file, .build_file = build_file,
.allocator = self.allocator, .allocator = self.allocator,
.build_runner_path = self.config.build_runner_path.?, .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.?, .zig_exe_path = self.config.zig_exe_path.?,
.cache_root = self.zig_cache_root, .cache_root = self.zig_cache_root,
.global_cache_root = self.zig_global_cache_root, .global_cache_root = self.zig_global_cache_root,

View File

@ -282,7 +282,7 @@ pub const Configuration = struct {
zig_exe_path: ?[]const u8, zig_exe_path: ?[]const u8,
warn_style: ?bool, warn_style: ?bool,
build_runner_path: ?[]const u8, build_runner_path: ?[]const u8,
build_runner_cache_path: ?[]const u8, global_cache_path: ?[]const u8,
enable_semantic_tokens: ?bool, enable_semantic_tokens: ?bool,
enable_inlay_hints: ?bool, enable_inlay_hints: ?bool,
inlay_hints_show_builtin: ?bool, inlay_hints_show_builtin: ?bool,