Added build_runner_path configuration option
This commit is contained in:
		
							parent
							
								
									02745f1472
								
							
						
					
					
						commit
						b82fb9c790
					
				| @ -51,6 +51,7 @@ The following options are currently available. | |||||||
| | `enable_snippets` | `bool` | `false` | Enables snippet completion, set to false for compatibility with language clients that do not support snippets (such as ale). | | | `enable_snippets` | `bool` | `false` | Enables snippet completion, set to false for compatibility with language clients that do not support snippets (such as ale). | | ||||||
| | `zig_lib_path` | `?[]const u8` | `null` | zig library path, e.g. `/path/to/zig/lib/zig`, used to analyze std library imports. | | | `zig_lib_path` | `?[]const u8` | `null` | zig library path, e.g. `/path/to/zig/lib/zig`, used to analyze std library imports. | | ||||||
| | `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. This option must be present in one of the global configuration files to have any effect. `null` is equivalent to `${executable_directory}/build_runner.zig` | | ||||||
| 
 | 
 | ||||||
| ## Usage | ## Usage | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -9,3 +9,7 @@ zig_lib_path: ?[]const u8 = null, | |||||||
| /// Whether to pay attention to style issues. This is opt-in since the style | /// Whether to pay attention to style issues. This is opt-in since the style | ||||||
| /// guide explicitly states that the style info provided is a guideline only. | /// guide explicitly states that the style info provided is a guideline only. | ||||||
| warn_style: bool = false, | warn_style: bool = false, | ||||||
|  | 
 | ||||||
|  | /// Path to the build_runner.zig file. This option must be present in one of | ||||||
|  | /// the global configuration directories to have any effect. | ||||||
|  | build_runner_path: ?[]const u8 = null, | ||||||
|  | |||||||
| @ -924,12 +924,14 @@ pub fn main() anyerror!void { | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     { |     if (config.build_runner_path) |build_runner_path| { | ||||||
|  |         try document_store.init(allocator, has_zig, try std.mem.dupe(allocator, u8, build_runner_path)); | ||||||
|  |     } else { | ||||||
|         var exe_dir_bytes: [std.fs.MAX_PATH_BYTES]u8 = undefined; |         var exe_dir_bytes: [std.fs.MAX_PATH_BYTES]u8 = undefined; | ||||||
|         const exe_dir_path = try std.fs.selfExeDirPath(&exe_dir_bytes); |         const exe_dir_path = try std.fs.selfExeDirPath(&exe_dir_bytes); | ||||||
| 
 | 
 | ||||||
|         const document_runner_path = try std.fs.path.resolve(allocator, &[_][]const u8{ exe_dir_path, "build_runner.zig" }); |         const build_runner_path = try std.fs.path.resolve(allocator, &[_][]const u8{ exe_dir_path, "build_runner.zig" }); | ||||||
|         try document_store.init(allocator, has_zig, document_runner_path); |         try document_store.init(allocator, has_zig, build_runner_path); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     defer document_store.deinit(); |     defer document_store.deinit(); | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user