ast-check fixes
This commit is contained in:
		
							parent
							
								
									57a35a7bc8
								
							
						
					
					
						commit
						246fee8a1b
					
				@ -237,14 +237,14 @@ fn publishDiagnostics(server: *Server, writer: anytype, handle: DocumentStore.Ha
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (server.config.enable_ast_check_diagnostics) diag: {
 | 
			
		||||
    if (server.config.enable_ast_check_diagnostics and tree.errors.len == 0) diag: {
 | 
			
		||||
        if (server.config.zig_exe_path) |zig_exe_path| {
 | 
			
		||||
            var process = std.ChildProcess.init(&[_][]const u8{ zig_exe_path, "ast-check", "--color", "off" }, server.allocator);
 | 
			
		||||
            process.stdin_behavior = .Pipe;
 | 
			
		||||
            process.stderr_behavior = .Pipe;
 | 
			
		||||
 | 
			
		||||
            process.spawn() catch |err| {
 | 
			
		||||
                Logger.warn(server, writer, "Failed to spawn zig fmt process, error: {}", .{err});
 | 
			
		||||
                Logger.warn(server, writer, "Failed to spawn zig ast-check process, error: {}", .{err});
 | 
			
		||||
                break :diag;
 | 
			
		||||
            };
 | 
			
		||||
            try process.stdin.?.writeAll(handle.document.text);
 | 
			
		||||
 | 
			
		||||
@ -170,7 +170,7 @@ pub fn wizard(allocator: std.mem.Allocator) !void {
 | 
			
		||||
 | 
			
		||||
    const editor = try askSelectOne("Which code editor do you use?", enum { VSCode, Sublime, Kate, Neovim, Vim8, Emacs, Doom, Spacemacs, Helix, Other });
 | 
			
		||||
    const snippets = try askBool("Do you want to enable snippets?");
 | 
			
		||||
    const unused_variables = try askBool("Do you want to enable unused variable warnings?");
 | 
			
		||||
    const ast_check = try askBool("Do you want to enable ast-check diagnostics?");
 | 
			
		||||
    const ief_apc = try askBool("Do you want to enable @import/@embedFile argument path completion?");
 | 
			
		||||
    const style = try askBool("Do you want to enable style warnings?");
 | 
			
		||||
    const semantic_tokens = try askBool("Do you want to enable semantic highlighting?");
 | 
			
		||||
@ -192,7 +192,7 @@ pub fn wizard(allocator: std.mem.Allocator) !void {
 | 
			
		||||
        .@"$schema" = "https://raw.githubusercontent.com/zigtools/zls/master/schema.json",
 | 
			
		||||
        .zig_exe_path = zig_exe_path,
 | 
			
		||||
        .enable_snippets = snippets,
 | 
			
		||||
        .enable_unused_variable_warnings = unused_variables,
 | 
			
		||||
        .enable_ast_check_diagnostics = ast_check,
 | 
			
		||||
        .enable_import_embedfile_argument_completions = ief_apc,
 | 
			
		||||
        .warn_style = style,
 | 
			
		||||
        .enable_semantic_tokens = semantic_tokens,
 | 
			
		||||
 | 
			
		||||
@ -119,7 +119,7 @@ pub const Diagnostic = struct {
 | 
			
		||||
    code: string,
 | 
			
		||||
    source: string,
 | 
			
		||||
    message: string,
 | 
			
		||||
    relatedInformation: []const DiagnosticRelatedInformation = &[0]DiagnosticRelatedInformation{},
 | 
			
		||||
    relatedInformation: []const DiagnosticRelatedInformation = &.{},
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
pub const TextDocument = struct {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user