From defac3239e2ec7d4cec8c20ed0f04f5671946210 Mon Sep 17 00:00:00 2001 From: techatrix <19954306+Techatrix@users.noreply.github.com> Date: Thu, 13 Jul 2023 02:37:49 +0200 Subject: [PATCH 1/2] remove dependency on tres --- build.zig | 6 - build.zig.zon | 4 - src/Config.zig | 2 - src/Server.zig | 82 +- src/config_gen/config_gen.zig | 59 +- src/features/code_actions.zig | 2 +- src/features/selection_range.zig | 11 +- src/lsp.zig | 2868 +++++------------------- src/main.zig | 3 +- tests/context.zig | 13 +- tests/lsp_features/code_actions.zig | 11 +- tests/lsp_features/document_symbol.zig | 11 +- tests/lsp_features/folding_range.zig | 6 +- tests/lsp_features/inlay_hints.zig | 18 +- tests/lsp_features/semantic_tokens.zig | 9 +- 15 files changed, 708 insertions(+), 2397 deletions(-) diff --git a/build.zig b/build.zig index d9ab961d3..f4fa35822 100644 --- a/build.zig +++ b/build.zig @@ -83,9 +83,6 @@ pub fn build(b: *std.build.Builder) !void { const known_folders_module = b.dependency("known_folders", .{}).module("known-folders"); exe.addModule("known-folders", known_folders_module); - const tres_module = b.dependency("tres", .{}).module("tres"); - exe.addModule("tres", tres_module); - const diffz_module = b.dependency("diffz", .{}).module("diffz"); exe.addModule("diffz", diffz_module); @@ -121,7 +118,6 @@ pub fn build(b: *std.build.Builder) !void { .source_file = .{ .path = "src/zls.zig" }, .dependencies = &.{ .{ .name = "known-folders", .module = known_folders_module }, - .{ .name = "tres", .module = tres_module }, .{ .name = "diffz", .module = diffz_module }, .{ .name = "binned_allocator", .module = binned_allocator_module }, .{ .name = "build_options", .module = build_options_module }, @@ -132,7 +128,6 @@ pub fn build(b: *std.build.Builder) !void { .name = "zls_gen", .root_source_file = .{ .path = "src/config_gen/config_gen.zig" }, }); - gen_exe.addModule("tres", tres_module); const gen_cmd = b.addRunArtifact(gen_exe); gen_cmd.addArgs(&.{ @@ -157,7 +152,6 @@ pub fn build(b: *std.build.Builder) !void { }); tests.addModule("zls", zls_module); - tests.addModule("tres", tres_module); tests.addModule("diffz", diffz_module); tests.addModule("binned_allocator", binned_allocator_module); test_step.dependOn(&b.addRunArtifact(tests).step); diff --git a/build.zig.zon b/build.zig.zon index f6f222a51..63003f429 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -7,10 +7,6 @@ .url = "https://github.com/ziglibs/known-folders/archive/d070896807cbbd2847d24d561438994504b929dd.tar.gz", .hash = "122001a81a0ba2faca0271d53c50e8069721fe66a19d71dd8498e61fa26d7ca6f558", }, - .tres = .{ - .url = "https://github.com/ziglibs/tres/archive/9ca9cd547d10d30984565399dec92068fefd7ad2.tar.gz", - .hash = "122026823fb890736435cb5ddbfdf5691d4b9d4759ab1147f245beced0abec17c483", - }, .diffz = .{ .url = "https://github.com/ziglibs/diffz/archive/90353d401c59e2ca5ed0abe5444c29ad3d7489aa.tar.gz", .hash = "122089a8247a693cad53beb161bde6c30f71376cd4298798d45b32740c3581405864", diff --git a/src/Config.zig b/src/Config.zig index 0a8d3f7a3..21496923e 100644 --- a/src/Config.zig +++ b/src/Config.zig @@ -21,8 +21,6 @@ semantic_tokens: enum { none, partial, full, - - pub const tres_string_enum = true; } = .full, /// Enables inlay hint support when the client also supports it diff --git a/src/Server.zig b/src/Server.zig index f7152ecbf..24ff03c39 100644 --- a/src/Server.zig +++ b/src/Server.zig @@ -31,8 +31,6 @@ const hover_handler = @import("features/hover.zig"); const selection_range = @import("features/selection_range.zig"); const diagnostics_gen = @import("features/diagnostics.zig"); -const tres = @import("tres"); - const log = std.log.scoped(.zls_server); // Server fields @@ -142,7 +140,7 @@ fn sendNotification(server: *Server, method: []const u8, params: anytype) void { } fn sendResponseError(server: *Server, id: types.RequestId, err: ?types.ResponseError) void { - server.sendInternal(id, null, err, "", void) catch {}; + server.sendInternal(id, null, err, "", {}) catch {}; } fn sendInternal( @@ -162,27 +160,33 @@ fn sendInternal( try writer.writeAll( \\,"id": ); - try tres.stringify(id, .{}, writer); + try std.json.stringify(id, .{}, writer); } if (maybe_method) |method| { try writer.writeAll( \\,"method": ); - try tres.stringify(method, .{}, writer); + try std.json.stringify(method, .{}, writer); } - if (@TypeOf(extra) != @TypeOf(void)) { - try writer.print( - \\,"{s}": - , .{extra_name}); - try tres.stringify(extra, .{ - .emit_null_optional_fields = false, - }, writer); + switch (@TypeOf(extra)) { + void => {}, + ?void => { + try writer.print( + \\,"{s}":null + , .{extra_name}); + }, + else => { + try writer.print( + \\,"{s}": + , .{extra_name}); + try std.json.stringify(extra, .{ .emit_null_optional_fields = false }, writer); + }, } if (maybe_err) |err| { try writer.writeAll( \\,"error": ); - try tres.stringify(err, .{}, writer); + try std.json.stringify(err, .{}, writer); } try writer.writeByte('}'); @@ -257,7 +261,7 @@ pub fn autofix(server: *Server, allocator: std.mem.Allocator, handle: *const Doc if (action.kind.? != .@"source.fixAll") continue; - const changes = action.edit.?.changes.?; + const changes = action.edit.?.changes.?.map; if (changes.count() != 1) continue; const edits: []const types.TextEdit = changes.get(handle.uri) orelse continue; @@ -807,7 +811,7 @@ fn saveDocumentHandler(server: *Server, notification: types.DidSaveTextDocumentP var text_edits = try server.autofix(allocator, handle); var workspace_edit = types.WorkspaceEdit{ .changes = .{} }; - try workspace_edit.changes.?.putNoClobber(allocator, uri, try text_edits.toOwnedSlice(allocator)); + try workspace_edit.changes.?.map.putNoClobber(allocator, uri, try text_edits.toOwnedSlice(allocator)); server.sendRequest( .{ .string = "apply_edit" }, @@ -966,7 +970,7 @@ fn didChangeConfigurationHandler(server: *Server, request: types.DidChangeConfig // NOTE: VS Code seems to always respond with null if (request.settings != .null) { - const cfg = tres.parse(configuration.Configuration, request.settings.object.get("zls") orelse request.settings, null) catch return; + const cfg = std.json.parseFromValueLeaky(configuration.Configuration, server.arena.allocator(), request.settings.object.get("zls") orelse request.settings, .{}) catch return; inline for (std.meta.fields(configuration.Configuration)) |field| { if (@field(cfg, field.name)) |value| { blk: { @@ -1107,11 +1111,11 @@ pub fn generalReferencesHandler(server: *Server, request: GeneralReferencesReque // TODO can we avoid having to move map from `changes` to `new_changes`? var new_changes: types.Map(types.DocumentUri, []const types.TextEdit) = .{}; - try new_changes.ensureTotalCapacity(allocator, @intCast(changes.count())); + try new_changes.map.ensureTotalCapacity(allocator, @intCast(changes.count())); var changes_it = changes.iterator(); while (changes_it.next()) |entry| { - new_changes.putAssumeCapacityNoClobber(entry.key_ptr.*, try entry.value_ptr.toOwnedSlice(allocator)); + new_changes.map.putAssumeCapacityNoClobber(entry.key_ptr.*, try entry.value_ptr.toOwnedSlice(allocator)); } return .{ .rename = .{ .changes = new_changes } }; @@ -1221,7 +1225,7 @@ fn foldingRangeHandler(server: *Server, request: types.FoldingRangeParams) Error return try folding_range.generateFoldingRanges(allocator, handle.tree, server.offset_encoding); } -fn selectionRangeHandler(server: *Server, request: types.SelectionRangeParams) Error!?[]*selection_range.SelectionRange { +fn selectionRangeHandler(server: *Server, request: types.SelectionRangeParams) Error!?[]*types.SelectionRange { const allocator = server.arena.allocator(); const handle = server.document_store.getHandle(request.textDocument.uri) orelse return null; @@ -1301,21 +1305,24 @@ const Message = union(enum) { }; } - pub fn fromJsonValueTree(root: std.json.Value) error{InvalidRequest}!Message { + pub fn jsonParseFromValue( + allocator: std.mem.Allocator, + source: std.json.Value, + options: std.json.ParseOptions, + ) !Message { const tracy_zone = tracy.trace(@src()); defer tracy_zone.end(); - if (root != .object) return error.InvalidRequest; - const object = root.object; + if (source != .object) return error.UnexpectedToken; + const object = source.object; if (object.get("id")) |id_obj| { - comptime std.debug.assert(!tres.isAllocatorRequired(types.RequestId)); - const msg_id = tres.parse(types.RequestId, id_obj, null) catch return error.InvalidRequest; + const msg_id = try std.json.parseFromValueLeaky(types.RequestId, allocator, id_obj, options); if (object.get("method")) |method_obj| { const msg_method = switch (method_obj) { .string => |str| str, - else => return error.InvalidRequest, + else => return error.UnexpectedToken, }; const msg_params = object.get("params") orelse .null; @@ -1329,10 +1336,9 @@ const Message = union(enum) { const result = object.get("result") orelse .null; const error_obj = object.get("error") orelse .null; - comptime std.debug.assert(!tres.isAllocatorRequired(?types.ResponseError)); - const err = tres.parse(?types.ResponseError, error_obj, null) catch return error.InvalidRequest; + const err = try std.json.parseFromValueLeaky(?types.ResponseError, allocator, error_obj, options); - if (result != .null and err != null) return error.InvalidRequest; + if (result != .null and err != null) return error.UnexpectedToken; return .{ .ResponseMessage = .{ .id = msg_id, @@ -1341,9 +1347,9 @@ const Message = union(enum) { } }; } } else { - const msg_method = switch (object.get("method") orelse return error.InvalidRequest) { + const msg_method = switch (object.get("method") orelse return error.UnexpectedToken) { .string => |str| str, - else => return error.InvalidRequest, + else => return error.UnexpectedToken, }; const msg_params = object.get("params") orelse .null; @@ -1363,13 +1369,12 @@ pub fn processJsonRpc( const tracy_zone = tracy.trace(@src()); defer tracy_zone.end(); - var tree = std.json.parseFromSlice(std.json.Value, server.arena.allocator(), json, .{}) catch |err| { + const tree = std.json.parseFromSliceLeaky(std.json.Value, server.arena.allocator(), json, .{}) catch |err| { log.err("failed to parse message: {}", .{err}); return; // maybe panic? }; - defer tree.deinit(); - const message = Message.fromJsonValueTree(tree.value) catch |err| { + const message = std.json.parseFromValueLeaky(Message, server.arena.allocator(), tree, .{}) catch |err| { log.err("failed to parse message: {}", .{err}); return; // maybe panic? }; @@ -1511,7 +1516,16 @@ pub fn processMessage(server: *Server, message: Message) Error!void { const handler_info: std.builtin.Type.Fn = @typeInfo(@TypeOf(handler)).Fn; const ParamsType = handler_info.params[1].type.?; // TODO add error message on null - const params: ParamsType = tres.parse(ParamsType, message.params().?, server.arena.allocator()) catch return error.InternalError; + const params: ParamsType = if (ParamsType == void) + void{} + else + std.json.parseFromValueLeaky(ParamsType, server.arena.allocator(), message.params().?, .{}) catch |err| { + log.err("failed to parse params from {s}: {}", .{ method, err }); + if (@errorReturnTrace()) |trace| { + std.debug.dumpStackTrace(trace.*); + } + return error.ParseError; + }; const response = blk: { const tracy_zone2 = tracy.trace(@src()); diff --git a/src/config_gen/config_gen.zig b/src/config_gen/config_gen.zig index 285e5adc2..182491430 100644 --- a/src/config_gen/config_gen.zig +++ b/src/config_gen/config_gen.zig @@ -1,8 +1,6 @@ const std = @import("std"); const zig_builtin = @import("builtin"); -const tres = @import("tres"); - const ConfigOption = struct { /// Name of config option name: []const u8, @@ -39,17 +37,12 @@ const ConfigOption = struct { _ = options; if (fmt.len != 0) return std.fmt.invalidFmtError(fmt, ConfigOption); if (config.@"enum") |enum_members| { - try writer.writeAll("enum {\n "); + try writer.writeAll("enum {\n"); for (enum_members) |member_name| { - try writer.writeAll(member_name); - try writer.writeAll(",\n "); + try writer.print(" {s},\n", .{member_name}); } std.debug.assert(enum_members.len > 1); - try writer.writeAll( - \\ - \\ pub const tres_string_enum = true; - \\} - ); + try writer.writeByte('}'); return; } try writer.writeAll(config.type); @@ -88,7 +81,7 @@ const Schema = struct { title: []const u8 = "ZLS Config", description: []const u8 = "Configuration file for the zig language server (ZLS)", type: []const u8 = "object", - properties: std.StringArrayHashMap(SchemaEntry), + properties: std.json.ArrayHashMap(SchemaEntry), }; const SchemaEntry = struct { @@ -146,12 +139,13 @@ fn generateSchemaFile(allocator: std.mem.Allocator, config: Config, path: []cons var buff_out = std.io.bufferedWriter(schema_file.writer()); - var properties = std.StringArrayHashMapUnmanaged(SchemaEntry){}; - defer properties.deinit(allocator); - try properties.ensureTotalCapacity(allocator, config.options.len); + var schema = Schema{ .properties = .{} }; + defer schema.properties.map.deinit(allocator); + + try schema.properties.map.ensureTotalCapacity(allocator, @intCast(config.options.len)); for (config.options) |option| { - properties.putAssumeCapacityNoClobber(option.name, .{ + schema.properties.map.putAssumeCapacityNoClobber(option.name, .{ .description = option.description, .type = try option.getTypescriptType(), .@"enum" = option.@"enum", @@ -159,23 +153,12 @@ fn generateSchemaFile(allocator: std.mem.Allocator, config: Config, path: []cons }); } - _ = try buff_out.write( - \\{ - \\ "$schema": "http://json-schema.org/schema", - \\ "title": "ZLS Config", - \\ "description": "Configuration file for the zig language server (ZLS)", - \\ "type": "object", - \\ "properties": - ); - - try tres.stringify(properties, .{ - .whitespace = .{ - .indent_level = 1, - }, + try std.json.stringify(schema, .{ + .whitespace = .{}, .emit_null_optional_fields = false, }, buff_out.writer()); + try buff_out.writer().writeByte('\n'); - _ = try buff_out.write("\n}\n"); try buff_out.flush(); try schema_file.setEndPos(try schema_file.getPos()); } @@ -236,26 +219,26 @@ fn generateVSCodeConfigFile(allocator: std.mem.Allocator, config: Config, path: defer config_file.close(); const predefined_configurations: usize = 3; - var configuration: std.StringArrayHashMapUnmanaged(ConfigurationProperty) = .{}; - try configuration.ensureTotalCapacity(allocator, predefined_configurations + @as(u32, @intCast(config.options.len))); + var configuration: std.json.ArrayHashMap(ConfigurationProperty) = .{}; + try configuration.map.ensureTotalCapacity(allocator, @intCast(predefined_configurations + config.options.len)); defer { - for (configuration.keys()[predefined_configurations..]) |name| allocator.free(name); - configuration.deinit(allocator); + for (configuration.map.keys()[predefined_configurations..]) |name| allocator.free(name); + configuration.map.deinit(allocator); } - configuration.putAssumeCapacityNoClobber("zig.trace.server", .{ + configuration.map.putAssumeCapacityNoClobber("zig.trace.server", .{ .scope = "window", .type = "string", .@"enum" = &.{ "off", "messages", "verbose" }, .description = "Traces the communication between VS Code and the language server.", .default = .{ .string = "off" }, }); - configuration.putAssumeCapacityNoClobber("zig.zls.checkForUpdate", .{ + configuration.map.putAssumeCapacityNoClobber("zig.zls.checkForUpdate", .{ .type = "boolean", .description = "Whether to automatically check for new updates", .default = .{ .bool = true }, }); - configuration.putAssumeCapacityNoClobber("zig.zls.path", .{ + configuration.map.putAssumeCapacityNoClobber("zig.zls.path", .{ .type = "string", .description = "Path to `zls` executable. Example: `C:/zls/zig-cache/bin/zls.exe`.", .format = "path", @@ -277,7 +260,7 @@ fn generateVSCodeConfigFile(allocator: std.mem.Allocator, config: Config, path: break :blk if (value.value != .null) value.value else null; }; - configuration.putAssumeCapacityNoClobber(name, .{ + configuration.map.putAssumeCapacityNoClobber(name, .{ .type = try option.getTypescriptType(), .description = option.description, .@"enum" = option.@"enum", @@ -289,7 +272,7 @@ fn generateVSCodeConfigFile(allocator: std.mem.Allocator, config: Config, path: var buffered_writer = std.io.bufferedWriter(config_file.writer()); var writer = buffered_writer.writer(); - try tres.stringify(configuration, .{ + try std.json.stringify(configuration, .{ .whitespace = .{}, .emit_null_optional_fields = false, }, writer); diff --git a/src/features/code_actions.zig b/src/features/code_actions.zig index c568ef899..18eed6397 100644 --- a/src/features/code_actions.zig +++ b/src/features/code_actions.zig @@ -58,7 +58,7 @@ pub const Builder = struct { pub fn createWorkspaceEdit(self: *Builder, edits: []const types.TextEdit) error{OutOfMemory}!types.WorkspaceEdit { var workspace_edit = types.WorkspaceEdit{ .changes = .{} }; - try workspace_edit.changes.?.putNoClobber(self.arena, self.handle.uri, try self.arena.dupe(types.TextEdit, edits)); + try workspace_edit.changes.?.map.putNoClobber(self.arena, self.handle.uri, try self.arena.dupe(types.TextEdit, edits)); return workspace_edit; } diff --git a/src/features/selection_range.zig b/src/features/selection_range.zig index cc0a6da46..815fdc20b 100644 --- a/src/features/selection_range.zig +++ b/src/features/selection_range.zig @@ -5,17 +5,12 @@ const DocumentStore = @import("../DocumentStore.zig"); const types = @import("../lsp.zig"); const offsets = @import("../offsets.zig"); -pub const SelectionRange = struct { - range: types.Range, - parent: ?*SelectionRange, -}; - pub fn generateSelectionRanges( arena: std.mem.Allocator, handle: *const DocumentStore.Handle, positions: []const types.Position, offset_encoding: offsets.Encoding, -) error{OutOfMemory}!?[]*SelectionRange { +) error{OutOfMemory}!?[]*types.SelectionRange { // For each of the input positions, we need to compute the stack of AST // nodes/ranges which contain the position. At the moment, we do this in a // super inefficient way, by iterating _all_ nodes, selecting the ones that @@ -23,7 +18,7 @@ pub fn generateSelectionRanges( // // A faster algorithm would be to walk the tree starting from the root, // descending into the child containing the position at every step. - var result = try arena.alloc(*SelectionRange, positions.len); + var result = try arena.alloc(*types.SelectionRange, positions.len); var locs = try std.ArrayListUnmanaged(offsets.Loc).initCapacity(arena, 32); for (positions, result) |position, *out| { const index = offsets.positionToIndex(handle.text, position, offset_encoding); @@ -49,7 +44,7 @@ pub fn generateSelectionRanges( } } - var selection_ranges = try arena.alloc(SelectionRange, locs.items.len); + var selection_ranges = try arena.alloc(types.SelectionRange, locs.items.len); for (selection_ranges, 0..) |*range, i| { range.range = offsets.locToRange(handle.text, locs.items[i], offset_encoding); range.parent = if (i + 1 < selection_ranges.len) &selection_ranges[i + 1] else null; diff --git a/src/lsp.zig b/src/lsp.zig index f70700bb6..a290d17ca 100644 --- a/src/lsp.zig +++ b/src/lsp.zig @@ -1,8 +1,6 @@ //! generated by zig-lsp-codegen const std = @import("std"); -const tres = @import("tres"); -const Undefinedable = tres.Undefinedable; const URI = []const u8; /// The URI of a document @@ -14,16 +12,10 @@ pub const LSPAny = std.json.Value; pub const LSPArray = []LSPAny; pub const LSPObject = std.json.ObjectMap; -pub fn Map(comptime Key: type, comptime Value: type) type { - if (Key == []const u8) - return std.StringHashMapUnmanaged(Value) - else - return std.AutoHashMapUnmanaged(Key, Value); -} - pub const RequestId = union(enum) { integer: i64, string: []const u8, + pub usingnamespace UnionParser(@This()); }; pub const ResponseError = struct { @@ -37,10 +29,11 @@ pub const ResponseError = struct { data: std.json.Value = .null, }; +/// Indicates in which direction a message is sent in the protocol. pub const MessageDirection = enum { - client_to_server, - server_to_client, - bidirectional, + clientToServer, + serverToClient, + both, }; pub const RegistrationMetadata = struct { @@ -67,7 +60,74 @@ pub const RequestMetadata = struct { registration: RegistrationMetadata, }; -test { +pub fn Map(comptime Key: type, comptime Value: type) type { + if (Key != []const u8) @compileError("TODO support non string Key's"); + return std.json.ArrayHashMap(Value); +} + +pub fn UnionParser(comptime T: type) type { + return struct { + pub fn jsonParse(allocator: std.mem.Allocator, source: anytype, options: std.json.ParseOptions) std.json.ParseError(@TypeOf(source.*))!T { + const json_value = try std.json.parseFromTokenSourceLeaky(std.json.Value, allocator, source, options); + return try jsonParseFromValue(allocator, json_value, options); + } + + pub fn jsonParseFromValue(allocator: std.mem.Allocator, source: std.json.Value, options: std.json.ParseOptions) std.json.ParseFromValueError!T { + inline for (std.meta.fields(T)) |field| { + if (std.json.parseFromValueLeaky(field.type, allocator, source, options)) |result| { + return @unionInit(T, field.name, result); + } else |_| {} + } + return error.UnexpectedToken; + } + + pub fn jsonStringify(self: T, options: std.json.StringifyOptions, out_stream: anytype) @TypeOf(out_stream).Error!void { + switch (self) { + inline else => |value| try std.json.stringify(value, options, out_stream), + } + } + }; +} + +pub fn EnumWithEmptyParser(comptime T: type) type { + return struct { + pub fn jsonParse(allocator: std.mem.Allocator, source: anytype, options: std.json.ParseOptions) std.json.ParseError(@TypeOf(source.*))!T { + const token = try source.nextAllocMax(allocator, .alloc_if_needed, options.max_value_len.?); + defer switch (token) { + .allocated_number, .allocated_string => |slice| allocator.free(slice), + else => {}, + }; + const slice = switch (token) { + inline .number, .allocated_number, .string, .allocated_string => |slice| slice, + else => return error.UnexpectedToken, + }; + if (slice.len == 0) return .empty; + return std.meta.stringToEnum(T, slice) orelse return error.InvalidEnumTag; + } + + pub fn jsonParseFromValue(allocator: std.mem.Allocator, source: std.json.Value, options: std.json.ParseOptions) std.json.ParseFromValueError!T { + _ = allocator; + _ = options; + if (source != .string) return error.InvalidEnumTag; + if (source.string.len == 0) return .empty; + return std.meta.stringToEnum(T, source.string) orelse return error.InvalidEnumTag; + } + + pub fn jsonStringify(self: T, options: std.json.StringifyOptions, out_stream: anytype) @TypeOf(out_stream).Error!void { + try std.json.encodeJsonString(if (self == .empty) "" else @tagName(self), options, out_stream); + } + }; +} + +pub fn EnumStringifyAsInt(comptime T: type) type { + return struct { + pub fn jsonStringify(self: T, options: std.json.StringifyOptions, out_stream: anytype) @TypeOf(out_stream).Error!void { + try std.json.stringify(@intFromEnum(self), options, out_stream); + } + }; +} + +comptime { _ = @field(@This(), "notification_metadata"); _ = @field(@This(), "request_metadata"); } @@ -83,6 +143,7 @@ test { pub const Definition = union(enum) { Location: Location, array_of_Location: []const Location, + pub usingnamespace UnionParser(@This()); }; /// Information about where a symbol is defined. @@ -95,6 +156,7 @@ pub const DefinitionLink = LocationLink; pub const Declaration = union(enum) { Location: Location, array_of_Location: []const Location, + pub usingnamespace UnionParser(@This()); }; /// Information about where a symbol is declared. @@ -117,6 +179,7 @@ pub const InlineValue = union(enum) { InlineValueText: InlineValueText, InlineValueVariableLookup: InlineValueVariableLookup, InlineValueEvaluatableExpression: InlineValueEvaluatableExpression, + pub usingnamespace UnionParser(@This()); }; /// The result of a document diagnostic pull request. A report can @@ -129,21 +192,19 @@ pub const InlineValue = union(enum) { pub const DocumentDiagnosticReport = union(enum) { RelatedFullDocumentDiagnosticReport: RelatedFullDocumentDiagnosticReport, RelatedUnchangedDocumentDiagnosticReport: RelatedUnchangedDocumentDiagnosticReport, + pub usingnamespace UnionParser(@This()); }; pub const PrepareRenameResult = union(enum) { Range: Range, literal_1: struct { - pub const tres_null_meaning = .{}; - range: Range, placeholder: []const u8, }, literal_2: struct { - pub const tres_null_meaning = .{}; - defaultBehavior: bool, }, + pub usingnamespace UnionParser(@This()); }; /// A document selector is the combination of one or many document filters. @@ -156,6 +217,7 @@ pub const DocumentSelector = []const DocumentFilter; pub const ProgressToken = union(enum) { integer: i32, string: []const u8, + pub usingnamespace UnionParser(@This()); }; /// An identifier to refer to a change annotation stored with a workspace edit. @@ -167,16 +229,13 @@ pub const ChangeAnnotationIdentifier = []const u8; pub const WorkspaceDocumentDiagnosticReport = union(enum) { WorkspaceFullDocumentDiagnosticReport: WorkspaceFullDocumentDiagnosticReport, WorkspaceUnchangedDocumentDiagnosticReport: WorkspaceUnchangedDocumentDiagnosticReport, + pub usingnamespace UnionParser(@This()); }; /// An event describing a change to a text document. If only a text is provided /// it is considered to be the full content of the document. pub const TextDocumentContentChangeEvent = union(enum) { literal_0: struct { - pub const tres_null_meaning = .{ - .rangeLength = .field, - }; - /// The range of the document that changed. range: Range, /// The optional length of the range that got replaced. @@ -187,11 +246,10 @@ pub const TextDocumentContentChangeEvent = union(enum) { text: []const u8, }, literal_1: struct { - pub const tres_null_meaning = .{}; - /// The new text of the whole document. text: []const u8, }, + pub usingnamespace UnionParser(@This()); }; /// MarkedString can be used to render human readable text. It is either a markdown string @@ -209,11 +267,10 @@ pub const TextDocumentContentChangeEvent = union(enum) { pub const MarkedString = union(enum) { string: []const u8, literal_1: struct { - pub const tres_null_meaning = .{}; - language: []const u8, value: []const u8, }, + pub usingnamespace UnionParser(@This()); }; /// A document filter describes a top level text document or @@ -223,6 +280,7 @@ pub const MarkedString = union(enum) { pub const DocumentFilter = union(enum) { TextDocumentFilter: TextDocumentFilter, NotebookCellTextDocumentFilter: NotebookCellTextDocumentFilter, + pub usingnamespace UnionParser(@This()); }; /// The glob pattern. Either a string pattern or a relative pattern. @@ -231,6 +289,7 @@ pub const DocumentFilter = union(enum) { pub const GlobPattern = union(enum) { Pattern: Pattern, RelativePattern: RelativePattern, + pub usingnamespace UnionParser(@This()); }; /// A document filter denotes a document by different properties like @@ -251,11 +310,6 @@ pub const GlobPattern = union(enum) { /// @since 3.17.0 pub const TextDocumentFilter = union(enum) { literal_0: struct { - pub const tres_null_meaning = .{ - .scheme = .field, - .pattern = .field, - }; - /// A language id, like `typescript`. language: []const u8, /// A Uri {@link Uri.scheme scheme}, like `file` or `untitled`. @@ -264,11 +318,6 @@ pub const TextDocumentFilter = union(enum) { pattern: ?[]const u8 = null, }, literal_1: struct { - pub const tres_null_meaning = .{ - .language = .field, - .pattern = .field, - }; - /// A language id, like `typescript`. language: ?[]const u8 = null, /// A Uri {@link Uri.scheme scheme}, like `file` or `untitled`. @@ -277,11 +326,6 @@ pub const TextDocumentFilter = union(enum) { pattern: ?[]const u8 = null, }, literal_2: struct { - pub const tres_null_meaning = .{ - .language = .field, - .scheme = .field, - }; - /// A language id, like `typescript`. language: ?[]const u8 = null, /// A Uri {@link Uri.scheme scheme}, like `file` or `untitled`. @@ -289,6 +333,7 @@ pub const TextDocumentFilter = union(enum) { /// A glob pattern, like `*.{ts,js}`. pattern: []const u8, }, + pub usingnamespace UnionParser(@This()); }; /// A notebook document filter denotes a notebook document by @@ -298,11 +343,6 @@ pub const TextDocumentFilter = union(enum) { /// @since 3.17.0 pub const NotebookDocumentFilter = union(enum) { literal_0: struct { - pub const tres_null_meaning = .{ - .scheme = .field, - .pattern = .field, - }; - /// The type of the enclosing notebook. notebookType: []const u8, /// A Uri {@link Uri.scheme scheme}, like `file` or `untitled`. @@ -311,11 +351,6 @@ pub const NotebookDocumentFilter = union(enum) { pattern: ?[]const u8 = null, }, literal_1: struct { - pub const tres_null_meaning = .{ - .notebookType = .field, - .pattern = .field, - }; - /// The type of the enclosing notebook. notebookType: ?[]const u8 = null, /// A Uri {@link Uri.scheme scheme}, like `file` or `untitled`. @@ -324,11 +359,6 @@ pub const NotebookDocumentFilter = union(enum) { pattern: ?[]const u8 = null, }, literal_2: struct { - pub const tres_null_meaning = .{ - .notebookType = .field, - .scheme = .field, - }; - /// The type of the enclosing notebook. notebookType: ?[]const u8 = null, /// A Uri {@link Uri.scheme scheme}, like `file` or `untitled`. @@ -336,6 +366,7 @@ pub const NotebookDocumentFilter = union(enum) { /// A glob pattern. pattern: []const u8, }, + pub usingnamespace UnionParser(@This()); }; /// The glob pattern to watch relative to the base path. Glob patterns can have the following syntax: @@ -357,8 +388,6 @@ pub const Pattern = []const u8; /// /// @since 3.16.0 pub const SemanticTokenTypes = enum { - pub const tres_string_enum = {}; - namespace, /// Represents a generic type. Acts as a fallback for types which can't be mapped to /// a specific type like class or enum. @@ -393,8 +422,6 @@ pub const SemanticTokenTypes = enum { /// /// @since 3.16.0 pub const SemanticTokenModifiers = enum { - pub const tres_string_enum = {}; - declaration, definition, readonly, @@ -411,8 +438,6 @@ pub const SemanticTokenModifiers = enum { /// /// @since 3.17.0 pub const DocumentDiagnosticReportKind = enum { - pub const tres_string_enum = {}; - /// A diagnostic report with a full /// set of problems. full, @@ -432,6 +457,7 @@ pub const ErrorCodes = enum(i32) { /// request before the server has received the `initialize` request. ServerNotInitialized = -32002, UnknownErrorCode = -32001, + pub usingnamespace EnumStringifyAsInt(@This()); }; pub const LSPErrorCodes = enum(i32) { @@ -460,12 +486,11 @@ pub const LSPErrorCodes = enum(i32) { /// The client has canceled a request and a server as detected /// the cancel. RequestCancelled = -32800, + pub usingnamespace EnumStringifyAsInt(@This()); }; /// A set of predefined range kinds. pub const FoldingRangeKind = enum { - pub const tres_string_enum = {}; - /// Folding range for a comment comment, /// Folding range for an import or include @@ -502,6 +527,7 @@ pub const SymbolKind = enum(u32) { Event = 24, Operator = 25, TypeParameter = 26, + pub usingnamespace EnumStringifyAsInt(@This()); }; /// Symbol tags are extra annotations that tweak the rendering of a symbol. @@ -511,14 +537,13 @@ pub const SymbolTag = enum(u32) { /// Render a symbol as obsolete, usually using a strike-out. Deprecated = 1, placeholder__, // fixes alignment issue + pub usingnamespace EnumStringifyAsInt(@This()); }; /// Moniker uniqueness level to define scope of the moniker. /// /// @since 3.16.0 pub const UniquenessLevel = enum { - pub const tres_string_enum = {}; - /// The moniker is only unique inside a document document, /// The moniker is unique inside a project for which a dump got created @@ -535,8 +560,6 @@ pub const UniquenessLevel = enum { /// /// @since 3.16.0 pub const MonikerKind = enum { - pub const tres_string_enum = {}; - /// The moniker represent a symbol that is imported into a project import, /// The moniker represents a symbol that is exported from a project @@ -554,6 +577,7 @@ pub const InlayHintKind = enum(u32) { Type = 1, /// An inlay hint that is for a parameter. Parameter = 2, + pub usingnamespace EnumStringifyAsInt(@This()); }; /// The message type @@ -566,6 +590,7 @@ pub const MessageType = enum(u32) { Info = 3, /// A log message. Log = 4, + pub usingnamespace EnumStringifyAsInt(@This()); }; /// Defines how the host (editor) should sync @@ -580,6 +605,7 @@ pub const TextDocumentSyncKind = enum(u32) { /// After that only incremental updates to the document are /// send. Incremental = 2, + pub usingnamespace EnumStringifyAsInt(@This()); }; /// Represents reasons why a text document is saved. @@ -591,6 +617,7 @@ pub const TextDocumentSaveReason = enum(u32) { AfterDelay = 2, /// When the editor lost focus. FocusOut = 3, + pub usingnamespace EnumStringifyAsInt(@This()); }; /// The kind of a completion entry. @@ -620,6 +647,7 @@ pub const CompletionItemKind = enum(u32) { Event = 23, Operator = 24, TypeParameter = 25, + pub usingnamespace EnumStringifyAsInt(@This()); }; /// Completion item tags are extra annotations that tweak the rendering of a completion @@ -630,6 +658,7 @@ pub const CompletionItemTag = enum(u32) { /// Render a completion as obsolete, usually using a strike-out. Deprecated = 1, placeholder__, // fixes alignment issue + pub usingnamespace EnumStringifyAsInt(@This()); }; /// Defines whether the insert text in a completion item should be interpreted as @@ -646,6 +675,7 @@ pub const InsertTextFormat = enum(u32) { /// /// See also: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#snippet_syntax Snippet = 2, + pub usingnamespace EnumStringifyAsInt(@This()); }; /// How whitespace and indentation is handled during completion @@ -667,6 +697,7 @@ pub const InsertTextMode = enum(u32) { /// multi line completion item is indented using 2 tabs and all /// following lines inserted will be indented using 2 tabs as well. adjustIndentation = 2, + pub usingnamespace EnumStringifyAsInt(@This()); }; /// A document highlight kind. @@ -677,12 +708,11 @@ pub const DocumentHighlightKind = enum(u32) { Read = 2, /// Write-access of a symbol, like writing to a variable. Write = 3, + pub usingnamespace EnumStringifyAsInt(@This()); }; /// A set of predefined code action kinds pub const CodeActionKind = enum { - pub const tres_string_enum = {}; - /// Empty kind. empty, /// Base kind for quickfix actions: 'quickfix' @@ -732,40 +762,10 @@ pub const CodeActionKind = enum { /// /// @since 3.15.0 @"source.fixAll", - - pub fn tresParse(json_value: std.json.Value, maybe_allocator: ?std.mem.Allocator) error{InvalidEnumTag}!@This() { - _ = maybe_allocator; - if (json_value != .string) return error.InvalidEnumTag; - if (json_value.string.len == 0) return .empty; - if (std.meta.stringToEnum(@This(), json_value.string)) |val| return val; - - // Some clients (nvim) may report these by the enumeration names rather than the - // actual strings, so let's check those names here - const aliases = std.ComptimeStringMap(CodeActionKind, .{ - .{ "Empty", .empty }, - .{ "QuickFix", .quickfix }, - .{ "Refactor", .refactor }, - .{ "RefactorExtract", .@"refactor.extract" }, - .{ "RefactorInline", .@"refactor.inline" }, - .{ "RefactorRewrite", .@"refactor.rewrite" }, - .{ "Source", .source }, - .{ "SourceOrganizeImports", .@"source.organizeImports" }, - .{ "SourceFixAll", .@"source.fixAll" }, - }); - - if (aliases.get(json_value.string)) |alias| { - return alias; - } - - // Strictly speaking, CodeActionKind is a string an not a enum which means that - // a client may report a unknown kind which can safely be ignored - return .empty; - } + pub usingnamespace EnumWithEmptyParser(@This()); }; pub const TraceValues = enum { - pub const tres_string_enum = {}; - /// Turn tracing off. off, /// Trace messages only. @@ -780,20 +780,28 @@ pub const TraceValues = enum { /// Please note that `MarkupKinds` must not start with a `$`. This kinds /// are reserved for internal usage. pub const MarkupKind = enum { - pub const tres_string_enum = {}; - /// Plain text is supported as a content format plaintext, /// Markdown is supported as a content format markdown, }; +/// Describes how an {@link InlineCompletionItemProvider inline completion provider} was triggered. +/// +/// @since 3.18.0 +/// @proposed +pub const InlineCompletionTriggerKind = enum(u32) { + /// Completion was triggered explicitly by a user gesture. + Invoked = 0, + /// Completion was triggered automatically while editing. + Automatic = 1, + pub usingnamespace EnumStringifyAsInt(@This()); +}; + /// A set of predefined position encoding kinds. /// /// @since 3.17.0 pub const PositionEncodingKind = enum { - pub const tres_string_enum = {}; - /// Character offsets count UTF-8 code units (e.g. bytes). @"utf-8", /// Character offsets count UTF-16 code units. @@ -817,6 +825,7 @@ pub const FileChangeType = enum(u32) { Changed = 2, /// The file got deleted. Deleted = 3, + pub usingnamespace EnumStringifyAsInt(@This()); }; pub const WatchKind = enum(u32) { @@ -826,6 +835,7 @@ pub const WatchKind = enum(u32) { Change = 2, /// Interested in delete events Delete = 4, + pub usingnamespace EnumStringifyAsInt(@This()); }; /// The diagnostic's severity. @@ -838,6 +848,7 @@ pub const DiagnosticSeverity = enum(u32) { Information = 3, /// Reports a hint. Hint = 4, + pub usingnamespace EnumStringifyAsInt(@This()); }; /// The diagnostic tags. @@ -853,6 +864,7 @@ pub const DiagnosticTag = enum(u32) { /// /// Clients are allowed to rendered diagnostics with this tag strike through. Deprecated = 2, + pub usingnamespace EnumStringifyAsInt(@This()); }; /// How a completion was triggered @@ -865,6 +877,7 @@ pub const CompletionTriggerKind = enum(u32) { TriggerCharacter = 2, /// Completion was re-triggered as current completion list is incomplete TriggerForIncompleteCompletions = 3, + pub usingnamespace EnumStringifyAsInt(@This()); }; /// How a signature help was triggered. @@ -877,6 +890,7 @@ pub const SignatureHelpTriggerKind = enum(u32) { TriggerCharacter = 2, /// Signature help was triggered by the cursor moving or by the document content changing. ContentChange = 3, + pub usingnamespace EnumStringifyAsInt(@This()); }; /// The reason why code actions were requested. @@ -890,6 +904,7 @@ pub const CodeActionTriggerKind = enum(u32) { /// This typically happens when current selection in a file changes, but can /// also be triggered when file content changes. Automatic = 2, + pub usingnamespace EnumStringifyAsInt(@This()); }; /// A pattern kind describing if a glob pattern matches a file a folder or @@ -897,8 +912,6 @@ pub const CodeActionTriggerKind = enum(u32) { /// /// @since 3.16.0 pub const FileOperationPatternKind = enum { - pub const tres_string_enum = {}; - /// The pattern matches a file only. file, /// The pattern matches a folder only. @@ -913,11 +926,10 @@ pub const NotebookCellKind = enum(u32) { Markup = 1, /// A code-cell is source code. Code = 2, + pub usingnamespace EnumStringifyAsInt(@This()); }; pub const ResourceOperationKind = enum { - pub const tres_string_enum = {}; - /// Supports creating new files and folders. create, /// Supports renaming existing files and folders. @@ -927,8 +939,6 @@ pub const ResourceOperationKind = enum { }; pub const FailureHandlingKind = enum { - pub const tres_string_enum = {}; - /// Applying the workspace change is simply aborted if one of the changes provided /// fails. All operations executed before the failing operation stay executed. abort, @@ -949,11 +959,10 @@ pub const PrepareSupportDefaultBehavior = enum(u32) { /// according the to language's syntax rule. Identifier = 1, placeholder__, // fixes alignment issue + pub usingnamespace EnumStringifyAsInt(@This()); }; pub const TokenFormat = enum { - pub const tres_string_enum = {}; - relative, placeholder__, // fixes alignment issue }; @@ -961,16 +970,6 @@ pub const TokenFormat = enum { // Structures pub const ImplementationParams = struct { - pub const tres_null_meaning = .{ - - // Extends TextDocumentPositionParams - - // Uses mixin WorkDoneProgressParams - .workDoneToken = .field, - - // Uses mixin PartialResultParams - .partialResultToken = .field, - }; // Extends TextDocumentPositionParams /// The text document. @@ -991,26 +990,11 @@ pub const ImplementationParams = struct { /// Represents a location inside a resource, such as a line /// inside a text file. pub const Location = struct { - pub const tres_null_meaning = .{}; - uri: DocumentUri, range: Range, }; pub const ImplementationRegistrationOptions = struct { - pub const tres_null_meaning = .{ - - // Extends TextDocumentRegistrationOptions - .documentSelector = .value, - - // Extends ImplementationOptions - - // Uses mixin WorkDoneProgressOptions - .workDoneProgress = .field, - - // Uses mixin StaticRegistrationOptions - .id = .field, - }; // Extends TextDocumentRegistrationOptions /// A document selector to identify the scope of the registration. If set to null @@ -1018,6 +1002,7 @@ pub const ImplementationRegistrationOptions = struct { documentSelector: ?DocumentSelector = null, // Extends ImplementationOptions + // Uses mixin WorkDoneProgressOptions workDoneProgress: ?bool = null, @@ -1028,16 +1013,6 @@ pub const ImplementationRegistrationOptions = struct { }; pub const TypeDefinitionParams = struct { - pub const tres_null_meaning = .{ - - // Extends TextDocumentPositionParams - - // Uses mixin WorkDoneProgressParams - .workDoneToken = .field, - - // Uses mixin PartialResultParams - .partialResultToken = .field, - }; // Extends TextDocumentPositionParams /// The text document. @@ -1056,19 +1031,6 @@ pub const TypeDefinitionParams = struct { }; pub const TypeDefinitionRegistrationOptions = struct { - pub const tres_null_meaning = .{ - - // Extends TextDocumentRegistrationOptions - .documentSelector = .value, - - // Extends TypeDefinitionOptions - - // Uses mixin WorkDoneProgressOptions - .workDoneProgress = .field, - - // Uses mixin StaticRegistrationOptions - .id = .field, - }; // Extends TextDocumentRegistrationOptions /// A document selector to identify the scope of the registration. If set to null @@ -1076,6 +1038,7 @@ pub const TypeDefinitionRegistrationOptions = struct { documentSelector: ?DocumentSelector = null, // Extends TypeDefinitionOptions + // Uses mixin WorkDoneProgressOptions workDoneProgress: ?bool = null, @@ -1087,8 +1050,6 @@ pub const TypeDefinitionRegistrationOptions = struct { /// A workspace folder inside a client. pub const WorkspaceFolder = struct { - pub const tres_null_meaning = .{}; - /// The associated URI for this workspace folder. uri: URI, /// The name of the workspace folder. Used to refer to this @@ -1098,32 +1059,20 @@ pub const WorkspaceFolder = struct { /// The parameters of a `workspace/didChangeWorkspaceFolders` notification. pub const DidChangeWorkspaceFoldersParams = struct { - pub const tres_null_meaning = .{}; - /// The actual workspace folder change event. event: WorkspaceFoldersChangeEvent, }; /// The parameters of a configuration request. pub const ConfigurationParams = struct { - pub const tres_null_meaning = .{}; - items: []const ConfigurationItem, }; /// Parameters for a {@link DocumentColorRequest}. pub const DocumentColorParams = struct { - pub const tres_null_meaning = .{ - - // Uses mixin WorkDoneProgressParams - .workDoneToken = .field, - - // Uses mixin PartialResultParams - .partialResultToken = .field, - }; - /// The text document. textDocument: TextDocumentIdentifier, + // Uses mixin WorkDoneProgressParams /// An optional token that a server can use to report work done progress. workDoneToken: ?ProgressToken = null, @@ -1136,8 +1085,6 @@ pub const DocumentColorParams = struct { /// Represents a color range from a document. pub const ColorInformation = struct { - pub const tres_null_meaning = .{}; - /// The range in the document where this color appears. range: Range, /// The actual color value for this color range. @@ -1145,19 +1092,6 @@ pub const ColorInformation = struct { }; pub const DocumentColorRegistrationOptions = struct { - pub const tres_null_meaning = .{ - - // Extends TextDocumentRegistrationOptions - .documentSelector = .value, - - // Extends DocumentColorOptions - - // Uses mixin WorkDoneProgressOptions - .workDoneProgress = .field, - - // Uses mixin StaticRegistrationOptions - .id = .field, - }; // Extends TextDocumentRegistrationOptions /// A document selector to identify the scope of the registration. If set to null @@ -1165,6 +1099,7 @@ pub const DocumentColorRegistrationOptions = struct { documentSelector: ?DocumentSelector = null, // Extends DocumentColorOptions + // Uses mixin WorkDoneProgressOptions workDoneProgress: ?bool = null, @@ -1176,21 +1111,13 @@ pub const DocumentColorRegistrationOptions = struct { /// Parameters for a {@link ColorPresentationRequest}. pub const ColorPresentationParams = struct { - pub const tres_null_meaning = .{ - - // Uses mixin WorkDoneProgressParams - .workDoneToken = .field, - - // Uses mixin PartialResultParams - .partialResultToken = .field, - }; - /// The text document. textDocument: TextDocumentIdentifier, /// The color to request presentations for. color: Color, /// The range where the color would be inserted. Serves as a context. range: Range, + // Uses mixin WorkDoneProgressParams /// An optional token that a server can use to report work done progress. workDoneToken: ?ProgressToken = null, @@ -1202,11 +1129,6 @@ pub const ColorPresentationParams = struct { }; pub const ColorPresentation = struct { - pub const tres_null_meaning = .{ - .textEdit = .field, - .additionalTextEdits = .field, - }; - /// The label of this color presentation. It will be shown on the color /// picker header. By default this is also the text that is inserted when selecting /// this color presentation. @@ -1221,19 +1143,11 @@ pub const ColorPresentation = struct { }; pub const WorkDoneProgressOptions = struct { - pub const tres_null_meaning = .{ - .workDoneProgress = .field, - }; - workDoneProgress: ?bool = null, }; /// General text document registration options. pub const TextDocumentRegistrationOptions = struct { - pub const tres_null_meaning = .{ - .documentSelector = .value, - }; - /// A document selector to identify the scope of the registration. If set to null /// the document selector provided on the client side will be used. documentSelector: ?DocumentSelector = null, @@ -1241,17 +1155,9 @@ pub const TextDocumentRegistrationOptions = struct { /// Parameters for a {@link FoldingRangeRequest}. pub const FoldingRangeParams = struct { - pub const tres_null_meaning = .{ - - // Uses mixin WorkDoneProgressParams - .workDoneToken = .field, - - // Uses mixin PartialResultParams - .partialResultToken = .field, - }; - /// The text document. textDocument: TextDocumentIdentifier, + // Uses mixin WorkDoneProgressParams /// An optional token that a server can use to report work done progress. workDoneToken: ?ProgressToken = null, @@ -1265,13 +1171,6 @@ pub const FoldingRangeParams = struct { /// Represents a folding range. To be valid, start and end line must be bigger than zero and smaller /// than the number of lines in the document. Clients are free to ignore invalid ranges. pub const FoldingRange = struct { - pub const tres_null_meaning = .{ - .startCharacter = .field, - .endCharacter = .field, - .kind = .field, - .collapsedText = .field, - }; - /// The zero-based start line of the range to fold. The folded area starts after the line's last character. /// To be valid, the end must be zero or larger and smaller than the number of lines in the document. startLine: u32, @@ -1295,19 +1194,6 @@ pub const FoldingRange = struct { }; pub const FoldingRangeRegistrationOptions = struct { - pub const tres_null_meaning = .{ - - // Extends TextDocumentRegistrationOptions - .documentSelector = .value, - - // Extends FoldingRangeOptions - - // Uses mixin WorkDoneProgressOptions - .workDoneProgress = .field, - - // Uses mixin StaticRegistrationOptions - .id = .field, - }; // Extends TextDocumentRegistrationOptions /// A document selector to identify the scope of the registration. If set to null @@ -1315,6 +1201,7 @@ pub const FoldingRangeRegistrationOptions = struct { documentSelector: ?DocumentSelector = null, // Extends FoldingRangeOptions + // Uses mixin WorkDoneProgressOptions workDoneProgress: ?bool = null, @@ -1325,16 +1212,6 @@ pub const FoldingRangeRegistrationOptions = struct { }; pub const DeclarationParams = struct { - pub const tres_null_meaning = .{ - - // Extends TextDocumentPositionParams - - // Uses mixin WorkDoneProgressParams - .workDoneToken = .field, - - // Uses mixin PartialResultParams - .partialResultToken = .field, - }; // Extends TextDocumentPositionParams /// The text document. @@ -1353,21 +1230,9 @@ pub const DeclarationParams = struct { }; pub const DeclarationRegistrationOptions = struct { - pub const tres_null_meaning = .{ - - // Extends DeclarationOptions - - // Uses mixin WorkDoneProgressOptions - .workDoneProgress = .field, - - // Extends TextDocumentRegistrationOptions - .documentSelector = .value, - - // Uses mixin StaticRegistrationOptions - .id = .field, - }; // Extends DeclarationOptions + // Uses mixin WorkDoneProgressOptions workDoneProgress: ?bool = null, @@ -1384,19 +1249,11 @@ pub const DeclarationRegistrationOptions = struct { /// A parameter literal used in selection range requests. pub const SelectionRangeParams = struct { - pub const tres_null_meaning = .{ - - // Uses mixin WorkDoneProgressParams - .workDoneToken = .field, - - // Uses mixin PartialResultParams - .partialResultToken = .field, - }; - /// The text document. textDocument: TextDocumentIdentifier, /// The positions inside the text document. positions: []const Position, + // Uses mixin WorkDoneProgressParams /// An optional token that a server can use to report work done progress. workDoneToken: ?ProgressToken = null, @@ -1410,32 +1267,16 @@ pub const SelectionRangeParams = struct { /// A selection range represents a part of a selection hierarchy. A selection range /// may have a parent selection range that contains it. pub const SelectionRange = struct { - pub const tres_null_meaning = .{ - .parent = .field, - }; - /// The {@link Range range} of this selection range. range: Range, /// The parent selection range containing this range. Therefore `parent.range` must contain `this.range`. - parent: ?SelectionRange = null, + parent: ?*SelectionRange = null, }; pub const SelectionRangeRegistrationOptions = struct { - pub const tres_null_meaning = .{ - - // Extends SelectionRangeOptions - - // Uses mixin WorkDoneProgressOptions - .workDoneProgress = .field, - - // Extends TextDocumentRegistrationOptions - .documentSelector = .value, - - // Uses mixin StaticRegistrationOptions - .id = .field, - }; // Extends SelectionRangeOptions + // Uses mixin WorkDoneProgressOptions workDoneProgress: ?bool = null, @@ -1451,15 +1292,11 @@ pub const SelectionRangeRegistrationOptions = struct { }; pub const WorkDoneProgressCreateParams = struct { - pub const tres_null_meaning = .{}; - /// The token to be used to report progress. token: ProgressToken, }; pub const WorkDoneProgressCancelParams = struct { - pub const tres_null_meaning = .{}; - /// The token to be used to report progress. token: ProgressToken, }; @@ -1468,13 +1305,6 @@ pub const WorkDoneProgressCancelParams = struct { /// /// @since 3.16.0 pub const CallHierarchyPrepareParams = struct { - pub const tres_null_meaning = .{ - - // Extends TextDocumentPositionParams - - // Uses mixin WorkDoneProgressParams - .workDoneToken = .field, - }; // Extends TextDocumentPositionParams /// The text document. @@ -1492,12 +1322,6 @@ pub const CallHierarchyPrepareParams = struct { /// /// @since 3.16.0 pub const CallHierarchyItem = struct { - pub const tres_null_meaning = .{ - .tags = .field, - .detail = .field, - .data = .field, - }; - /// The name of this item. name: []const u8, /// The kind of this item. @@ -1522,19 +1346,6 @@ pub const CallHierarchyItem = struct { /// /// @since 3.16.0 pub const CallHierarchyRegistrationOptions = struct { - pub const tres_null_meaning = .{ - - // Extends TextDocumentRegistrationOptions - .documentSelector = .value, - - // Extends CallHierarchyOptions - - // Uses mixin WorkDoneProgressOptions - .workDoneProgress = .field, - - // Uses mixin StaticRegistrationOptions - .id = .field, - }; // Extends TextDocumentRegistrationOptions /// A document selector to identify the scope of the registration. If set to null @@ -1542,6 +1353,7 @@ pub const CallHierarchyRegistrationOptions = struct { documentSelector: ?DocumentSelector = null, // Extends CallHierarchyOptions + // Uses mixin WorkDoneProgressOptions workDoneProgress: ?bool = null, @@ -1555,16 +1367,8 @@ pub const CallHierarchyRegistrationOptions = struct { /// /// @since 3.16.0 pub const CallHierarchyIncomingCallsParams = struct { - pub const tres_null_meaning = .{ - - // Uses mixin WorkDoneProgressParams - .workDoneToken = .field, - - // Uses mixin PartialResultParams - .partialResultToken = .field, - }; - item: CallHierarchyItem, + // Uses mixin WorkDoneProgressParams /// An optional token that a server can use to report work done progress. workDoneToken: ?ProgressToken = null, @@ -1579,8 +1383,6 @@ pub const CallHierarchyIncomingCallsParams = struct { /// /// @since 3.16.0 pub const CallHierarchyIncomingCall = struct { - pub const tres_null_meaning = .{}; - /// The item that makes the call. from: CallHierarchyItem, /// The ranges at which the calls appear. This is relative to the caller @@ -1592,16 +1394,8 @@ pub const CallHierarchyIncomingCall = struct { /// /// @since 3.16.0 pub const CallHierarchyOutgoingCallsParams = struct { - pub const tres_null_meaning = .{ - - // Uses mixin WorkDoneProgressParams - .workDoneToken = .field, - - // Uses mixin PartialResultParams - .partialResultToken = .field, - }; - item: CallHierarchyItem, + // Uses mixin WorkDoneProgressParams /// An optional token that a server can use to report work done progress. workDoneToken: ?ProgressToken = null, @@ -1616,8 +1410,6 @@ pub const CallHierarchyOutgoingCallsParams = struct { /// /// @since 3.16.0 pub const CallHierarchyOutgoingCall = struct { - pub const tres_null_meaning = .{}; - /// The item that is called. to: CallHierarchyItem, /// The range at which this item is called. This is the range relative to the caller, e.g the item @@ -1628,17 +1420,9 @@ pub const CallHierarchyOutgoingCall = struct { /// @since 3.16.0 pub const SemanticTokensParams = struct { - pub const tres_null_meaning = .{ - - // Uses mixin WorkDoneProgressParams - .workDoneToken = .field, - - // Uses mixin PartialResultParams - .partialResultToken = .field, - }; - /// The text document. textDocument: TextDocumentIdentifier, + // Uses mixin WorkDoneProgressParams /// An optional token that a server can use to report work done progress. workDoneToken: ?ProgressToken = null, @@ -1651,10 +1435,6 @@ pub const SemanticTokensParams = struct { /// @since 3.16.0 pub const SemanticTokens = struct { - pub const tres_null_meaning = .{ - .resultId = .field, - }; - /// An optional result id. If provided and clients support delta updating /// the client will include the result id in the next semantic token request. /// A server can then instead of computing all semantic tokens again simply @@ -1666,28 +1446,11 @@ pub const SemanticTokens = struct { /// @since 3.16.0 pub const SemanticTokensPartialResult = struct { - pub const tres_null_meaning = .{}; - data: []const u32, }; /// @since 3.16.0 pub const SemanticTokensRegistrationOptions = struct { - pub const tres_null_meaning = .{ - - // Extends TextDocumentRegistrationOptions - .documentSelector = .value, - - // Extends SemanticTokensOptions - .range = .field, - .full = .field, - - // Uses mixin WorkDoneProgressOptions - .workDoneProgress = .field, - - // Uses mixin StaticRegistrationOptions - .id = .field, - }; // Extends TextDocumentRegistrationOptions /// A document selector to identify the scope of the registration. If set to null @@ -1701,22 +1464,19 @@ pub const SemanticTokensRegistrationOptions = struct { /// of a document. range: ?union(enum) { bool: bool, - literal_1: struct { - pub const tres_null_meaning = .{}; - }, + literal_1: struct {}, + pub usingnamespace UnionParser(@This()); } = null, /// Server supports providing semantic tokens for a full document. full: ?union(enum) { bool: bool, literal_1: struct { - pub const tres_null_meaning = .{ - .delta = .field, - }; - /// The server supports deltas for full documents. delta: ?bool = null, }, + pub usingnamespace UnionParser(@This()); } = null, + // Uses mixin WorkDoneProgressOptions workDoneProgress: ?bool = null, @@ -1728,20 +1488,12 @@ pub const SemanticTokensRegistrationOptions = struct { /// @since 3.16.0 pub const SemanticTokensDeltaParams = struct { - pub const tres_null_meaning = .{ - - // Uses mixin WorkDoneProgressParams - .workDoneToken = .field, - - // Uses mixin PartialResultParams - .partialResultToken = .field, - }; - /// The text document. textDocument: TextDocumentIdentifier, /// The result id of a previous response. The result Id can either point to a full response /// or a delta response depending on what was received last. previousResultId: []const u8, + // Uses mixin WorkDoneProgressParams /// An optional token that a server can use to report work done progress. workDoneToken: ?ProgressToken = null, @@ -1754,10 +1506,6 @@ pub const SemanticTokensDeltaParams = struct { /// @since 3.16.0 pub const SemanticTokensDelta = struct { - pub const tres_null_meaning = .{ - .resultId = .field, - }; - resultId: ?[]const u8 = null, /// The semantic token edits to transform a previous result into a new result. edits: []const SemanticTokensEdit, @@ -1765,26 +1513,16 @@ pub const SemanticTokensDelta = struct { /// @since 3.16.0 pub const SemanticTokensDeltaPartialResult = struct { - pub const tres_null_meaning = .{}; - edits: []const SemanticTokensEdit, }; /// @since 3.16.0 pub const SemanticTokensRangeParams = struct { - pub const tres_null_meaning = .{ - - // Uses mixin WorkDoneProgressParams - .workDoneToken = .field, - - // Uses mixin PartialResultParams - .partialResultToken = .field, - }; - /// The text document. textDocument: TextDocumentIdentifier, /// The range the semantic tokens are requested for. range: Range, + // Uses mixin WorkDoneProgressParams /// An optional token that a server can use to report work done progress. workDoneToken: ?ProgressToken = null, @@ -1799,12 +1537,6 @@ pub const SemanticTokensRangeParams = struct { /// /// @since 3.16.0 pub const ShowDocumentParams = struct { - pub const tres_null_meaning = .{ - .external = .field, - .takeFocus = .field, - .selection = .field, - }; - /// The uri to show. uri: URI, /// Indicates to show the resource in an external program. @@ -1827,20 +1559,11 @@ pub const ShowDocumentParams = struct { /// /// @since 3.16.0 pub const ShowDocumentResult = struct { - pub const tres_null_meaning = .{}; - /// A boolean indicating if the show was successful. success: bool, }; pub const LinkedEditingRangeParams = struct { - pub const tres_null_meaning = .{ - - // Extends TextDocumentPositionParams - - // Uses mixin WorkDoneProgressParams - .workDoneToken = .field, - }; // Extends TextDocumentPositionParams /// The text document. @@ -1857,10 +1580,6 @@ pub const LinkedEditingRangeParams = struct { /// /// @since 3.16.0 pub const LinkedEditingRanges = struct { - pub const tres_null_meaning = .{ - .wordPattern = .field, - }; - /// A list of ranges that can be edited together. The ranges must have /// identical length and contain identical text content. The ranges cannot overlap. ranges: []const Range, @@ -1871,19 +1590,6 @@ pub const LinkedEditingRanges = struct { }; pub const LinkedEditingRangeRegistrationOptions = struct { - pub const tres_null_meaning = .{ - - // Extends TextDocumentRegistrationOptions - .documentSelector = .value, - - // Extends LinkedEditingRangeOptions - - // Uses mixin WorkDoneProgressOptions - .workDoneProgress = .field, - - // Uses mixin StaticRegistrationOptions - .id = .field, - }; // Extends TextDocumentRegistrationOptions /// A document selector to identify the scope of the registration. If set to null @@ -1891,6 +1597,7 @@ pub const LinkedEditingRangeRegistrationOptions = struct { documentSelector: ?DocumentSelector = null, // Extends LinkedEditingRangeOptions + // Uses mixin WorkDoneProgressOptions workDoneProgress: ?bool = null, @@ -1905,8 +1612,6 @@ pub const LinkedEditingRangeRegistrationOptions = struct { /// /// @since 3.16.0 pub const CreateFilesParams = struct { - pub const tres_null_meaning = .{}; - /// An array of all files/folders created in this operation. files: []const FileCreate, }; @@ -1924,12 +1629,6 @@ pub const CreateFilesParams = struct { /// cause failure of the operation. How the client recovers from the failure is described by /// the client capability: `workspace.workspaceEdit.failureHandling` pub const WorkspaceEdit = struct { - pub const tres_null_meaning = .{ - .changes = .field, - .documentChanges = .field, - .changeAnnotations = .field, - }; - /// Holds changes to existing resources. changes: ?Map(DocumentUri, []const TextEdit) = null, /// Depending on the client capability `workspace.workspaceEdit.resourceOperations` document changes @@ -1947,6 +1646,7 @@ pub const WorkspaceEdit = struct { CreateFile: CreateFile, RenameFile: RenameFile, DeleteFile: DeleteFile, + pub usingnamespace UnionParser(@This()); } = null, /// A map of change annotations that can be referenced in `AnnotatedTextEdit`s or create, rename and /// delete file / folder operations. @@ -1961,8 +1661,6 @@ pub const WorkspaceEdit = struct { /// /// @since 3.16.0 pub const FileOperationRegistrationOptions = struct { - pub const tres_null_meaning = .{}; - /// The actual filters. filters: []const FileOperationFilter, }; @@ -1972,8 +1670,6 @@ pub const FileOperationRegistrationOptions = struct { /// /// @since 3.16.0 pub const RenameFilesParams = struct { - pub const tres_null_meaning = .{}; - /// An array of all files/folders renamed in this operation. When a folder is renamed, only /// the folder will be included, and not its children. files: []const FileRename, @@ -1984,23 +1680,11 @@ pub const RenameFilesParams = struct { /// /// @since 3.16.0 pub const DeleteFilesParams = struct { - pub const tres_null_meaning = .{}; - /// An array of all files/folders deleted in this operation. files: []const FileDelete, }; pub const MonikerParams = struct { - pub const tres_null_meaning = .{ - - // Extends TextDocumentPositionParams - - // Uses mixin WorkDoneProgressParams - .workDoneToken = .field, - - // Uses mixin PartialResultParams - .partialResultToken = .field, - }; // Extends TextDocumentPositionParams /// The text document. @@ -2022,10 +1706,6 @@ pub const MonikerParams = struct { /// /// @since 3.16.0 pub const Moniker = struct { - pub const tres_null_meaning = .{ - .kind = .field, - }; - /// The scheme of the moniker. For example tsc or .Net scheme: []const u8, /// The identifier of the moniker. The value is opaque in LSIF however @@ -2038,16 +1718,6 @@ pub const Moniker = struct { }; pub const MonikerRegistrationOptions = struct { - pub const tres_null_meaning = .{ - - // Extends TextDocumentRegistrationOptions - .documentSelector = .value, - - // Extends MonikerOptions - - // Uses mixin WorkDoneProgressOptions - .workDoneProgress = .field, - }; // Extends TextDocumentRegistrationOptions /// A document selector to identify the scope of the registration. If set to null @@ -2055,6 +1725,7 @@ pub const MonikerRegistrationOptions = struct { documentSelector: ?DocumentSelector = null, // Extends MonikerOptions + // Uses mixin WorkDoneProgressOptions workDoneProgress: ?bool = null, }; @@ -2063,13 +1734,6 @@ pub const MonikerRegistrationOptions = struct { /// /// @since 3.17.0 pub const TypeHierarchyPrepareParams = struct { - pub const tres_null_meaning = .{ - - // Extends TextDocumentPositionParams - - // Uses mixin WorkDoneProgressParams - .workDoneToken = .field, - }; // Extends TextDocumentPositionParams /// The text document. @@ -2084,12 +1748,6 @@ pub const TypeHierarchyPrepareParams = struct { /// @since 3.17.0 pub const TypeHierarchyItem = struct { - pub const tres_null_meaning = .{ - .tags = .field, - .detail = .field, - .data = .field, - }; - /// The name of this item. name: []const u8, /// The kind of this item. @@ -2118,19 +1776,6 @@ pub const TypeHierarchyItem = struct { /// /// @since 3.17.0 pub const TypeHierarchyRegistrationOptions = struct { - pub const tres_null_meaning = .{ - - // Extends TextDocumentRegistrationOptions - .documentSelector = .value, - - // Extends TypeHierarchyOptions - - // Uses mixin WorkDoneProgressOptions - .workDoneProgress = .field, - - // Uses mixin StaticRegistrationOptions - .id = .field, - }; // Extends TextDocumentRegistrationOptions /// A document selector to identify the scope of the registration. If set to null @@ -2138,6 +1783,7 @@ pub const TypeHierarchyRegistrationOptions = struct { documentSelector: ?DocumentSelector = null, // Extends TypeHierarchyOptions + // Uses mixin WorkDoneProgressOptions workDoneProgress: ?bool = null, @@ -2151,16 +1797,8 @@ pub const TypeHierarchyRegistrationOptions = struct { /// /// @since 3.17.0 pub const TypeHierarchySupertypesParams = struct { - pub const tres_null_meaning = .{ - - // Uses mixin WorkDoneProgressParams - .workDoneToken = .field, - - // Uses mixin PartialResultParams - .partialResultToken = .field, - }; - item: TypeHierarchyItem, + // Uses mixin WorkDoneProgressParams /// An optional token that a server can use to report work done progress. workDoneToken: ?ProgressToken = null, @@ -2175,16 +1813,8 @@ pub const TypeHierarchySupertypesParams = struct { /// /// @since 3.17.0 pub const TypeHierarchySubtypesParams = struct { - pub const tres_null_meaning = .{ - - // Uses mixin WorkDoneProgressParams - .workDoneToken = .field, - - // Uses mixin PartialResultParams - .partialResultToken = .field, - }; - item: TypeHierarchyItem, + // Uses mixin WorkDoneProgressParams /// An optional token that a server can use to report work done progress. workDoneToken: ?ProgressToken = null, @@ -2199,12 +1829,6 @@ pub const TypeHierarchySubtypesParams = struct { /// /// @since 3.17.0 pub const InlineValueParams = struct { - pub const tres_null_meaning = .{ - - // Uses mixin WorkDoneProgressParams - .workDoneToken = .field, - }; - /// The text document. textDocument: TextDocumentIdentifier, /// The document range for which inline values should be computed. @@ -2212,6 +1836,7 @@ pub const InlineValueParams = struct { /// Additional information about the context in which inline values were /// requested. context: InlineValueContext, + // Uses mixin WorkDoneProgressParams /// An optional token that a server can use to report work done progress. workDoneToken: ?ProgressToken = null, @@ -2221,21 +1846,9 @@ pub const InlineValueParams = struct { /// /// @since 3.17.0 pub const InlineValueRegistrationOptions = struct { - pub const tres_null_meaning = .{ - // Extends InlineValueOptions - - // Uses mixin WorkDoneProgressOptions - .workDoneProgress = .field, + // Extends InlineValueOptions - // Extends TextDocumentRegistrationOptions - .documentSelector = .value, - - // Uses mixin StaticRegistrationOptions - .id = .field, - }; - - // Extends InlineValueOptions // Uses mixin WorkDoneProgressOptions workDoneProgress: ?bool = null, @@ -2254,16 +1867,11 @@ pub const InlineValueRegistrationOptions = struct { /// /// @since 3.17.0 pub const InlayHintParams = struct { - pub const tres_null_meaning = .{ - - // Uses mixin WorkDoneProgressParams - .workDoneToken = .field, - }; - /// The text document. textDocument: TextDocumentIdentifier, /// The document range for which inlay hints should be computed. range: Range, + // Uses mixin WorkDoneProgressParams /// An optional token that a server can use to report work done progress. workDoneToken: ?ProgressToken = null, @@ -2273,15 +1881,6 @@ pub const InlayHintParams = struct { /// /// @since 3.17.0 pub const InlayHint = struct { - pub const tres_null_meaning = .{ - .kind = .field, - .textEdits = .field, - .tooltip = .field, - .paddingLeft = .field, - .paddingRight = .field, - .data = .field, - }; - /// The position of this hint. position: Position, /// The label of this hint. A human readable string or an array of @@ -2291,6 +1890,7 @@ pub const InlayHint = struct { label: union(enum) { string: []const u8, array_of_InlayHintLabelPart: []const InlayHintLabelPart, + pub usingnamespace UnionParser(@This()); }, /// The kind of this hint. Can be omitted in which case the client /// should fall back to a reasonable default. @@ -2305,6 +1905,7 @@ pub const InlayHint = struct { tooltip: ?union(enum) { string: []const u8, MarkupContent: MarkupContent, + pub usingnamespace UnionParser(@This()); } = null, /// Render padding before the hint. /// @@ -2327,25 +1928,12 @@ pub const InlayHint = struct { /// /// @since 3.17.0 pub const InlayHintRegistrationOptions = struct { - pub const tres_null_meaning = .{ - - // Extends InlayHintOptions - .resolveProvider = .field, - - // Uses mixin WorkDoneProgressOptions - .workDoneProgress = .field, - - // Extends TextDocumentRegistrationOptions - .documentSelector = .value, - - // Uses mixin StaticRegistrationOptions - .id = .field, - }; // Extends InlayHintOptions /// The server provides support to resolve additional /// information for an inlay hint item. resolveProvider: ?bool = null, + // Uses mixin WorkDoneProgressOptions workDoneProgress: ?bool = null, @@ -2364,23 +1952,13 @@ pub const InlayHintRegistrationOptions = struct { /// /// @since 3.17.0 pub const DocumentDiagnosticParams = struct { - pub const tres_null_meaning = .{ - .identifier = .field, - .previousResultId = .field, - - // Uses mixin WorkDoneProgressParams - .workDoneToken = .field, - - // Uses mixin PartialResultParams - .partialResultToken = .field, - }; - /// The text document. textDocument: TextDocumentIdentifier, /// The additional identifier provided during registration. identifier: ?[]const u8 = null, /// The result id of a previous response if provided. previousResultId: ?[]const u8 = null, + // Uses mixin WorkDoneProgressParams /// An optional token that a server can use to report work done progress. workDoneToken: ?ProgressToken = null, @@ -2395,11 +1973,10 @@ pub const DocumentDiagnosticParams = struct { /// /// @since 3.17.0 pub const DocumentDiagnosticReportPartialResult = struct { - pub const tres_null_meaning = .{}; - relatedDocuments: Map(DocumentUri, union(enum) { FullDocumentDiagnosticReport: FullDocumentDiagnosticReport, UnchangedDocumentDiagnosticReport: UnchangedDocumentDiagnosticReport, + pub usingnamespace UnionParser(@This()); }), }; @@ -2407,8 +1984,6 @@ pub const DocumentDiagnosticReportPartialResult = struct { /// /// @since 3.17.0 pub const DiagnosticServerCancellationData = struct { - pub const tres_null_meaning = .{}; - retriggerRequest: bool, }; @@ -2416,20 +1991,6 @@ pub const DiagnosticServerCancellationData = struct { /// /// @since 3.17.0 pub const DiagnosticRegistrationOptions = struct { - pub const tres_null_meaning = .{ - - // Extends TextDocumentRegistrationOptions - .documentSelector = .value, - - // Extends DiagnosticOptions - .identifier = .field, - - // Uses mixin WorkDoneProgressOptions - .workDoneProgress = .field, - - // Uses mixin StaticRegistrationOptions - .id = .field, - }; // Extends TextDocumentRegistrationOptions /// A document selector to identify the scope of the registration. If set to null @@ -2447,6 +2008,7 @@ pub const DiagnosticRegistrationOptions = struct { interFileDependencies: bool, /// The server provides support for workspace diagnostics as well. workspaceDiagnostics: bool, + // Uses mixin WorkDoneProgressOptions workDoneProgress: ?bool = null, @@ -2460,21 +2022,12 @@ pub const DiagnosticRegistrationOptions = struct { /// /// @since 3.17.0 pub const WorkspaceDiagnosticParams = struct { - pub const tres_null_meaning = .{ - .identifier = .field, - - // Uses mixin WorkDoneProgressParams - .workDoneToken = .field, - - // Uses mixin PartialResultParams - .partialResultToken = .field, - }; - /// The additional identifier provided during registration. identifier: ?[]const u8 = null, /// The currently known diagnostic reports with their /// previous result ids. previousResultIds: []const PreviousResultId, + // Uses mixin WorkDoneProgressParams /// An optional token that a server can use to report work done progress. workDoneToken: ?ProgressToken = null, @@ -2489,8 +2042,6 @@ pub const WorkspaceDiagnosticParams = struct { /// /// @since 3.17.0 pub const WorkspaceDiagnosticReport = struct { - pub const tres_null_meaning = .{}; - items: []const WorkspaceDocumentDiagnosticReport, }; @@ -2498,8 +2049,6 @@ pub const WorkspaceDiagnosticReport = struct { /// /// @since 3.17.0 pub const WorkspaceDiagnosticReportPartialResult = struct { - pub const tres_null_meaning = .{}; - items: []const WorkspaceDocumentDiagnosticReport, }; @@ -2507,8 +2056,6 @@ pub const WorkspaceDiagnosticReportPartialResult = struct { /// /// @since 3.17.0 pub const DidOpenNotebookDocumentParams = struct { - pub const tres_null_meaning = .{}; - /// The notebook document that got opened. notebookDocument: NotebookDocument, /// The text documents that represent the content @@ -2520,8 +2067,6 @@ pub const DidOpenNotebookDocumentParams = struct { /// /// @since 3.17.0 pub const DidChangeNotebookDocumentParams = struct { - pub const tres_null_meaning = .{}; - /// The notebook document that did change. The version number points /// to the version after all provided changes have been applied. If /// only the text document content of a cell changes the notebook version @@ -2547,8 +2092,6 @@ pub const DidChangeNotebookDocumentParams = struct { /// /// @since 3.17.0 pub const DidSaveNotebookDocumentParams = struct { - pub const tres_null_meaning = .{}; - /// The notebook document that got saved. notebookDocument: NotebookDocumentIdentifier, }; @@ -2557,8 +2100,6 @@ pub const DidSaveNotebookDocumentParams = struct { /// /// @since 3.17.0 pub const DidCloseNotebookDocumentParams = struct { - pub const tres_null_meaning = .{}; - /// The notebook document that got closed. notebookDocument: NotebookDocumentIdentifier, /// The text documents that represent the content @@ -2566,36 +2107,85 @@ pub const DidCloseNotebookDocumentParams = struct { cellTextDocuments: []const TextDocumentIdentifier, }; -pub const RegistrationParams = struct { - pub const tres_null_meaning = .{}; +/// A parameter literal used in inline completion requests. +/// +/// @since 3.18.0 +/// @proposed +pub const InlineCompletionParams = struct { + /// Additional information about the context in which inline completions were + /// requested. + context: InlineCompletionContext, + + // Extends TextDocumentPositionParams + /// The text document. + textDocument: TextDocumentIdentifier, + /// The position inside the text document. + position: Position, + + // Uses mixin WorkDoneProgressParams + /// An optional token that a server can use to report work done progress. + workDoneToken: ?ProgressToken = null, +}; + +/// Represents a collection of {@link InlineCompletionItem inline completion items} to be presented in the editor. +/// +/// @since 3.18.0 +/// @proposed +pub const InlineCompletionList = struct { + /// The inline completion items + items: []const InlineCompletionItem, +}; + +/// An inline completion item represents a text snippet that is proposed inline to complete text that is being typed. +/// +/// @since 3.18.0 +/// @proposed +pub const InlineCompletionItem = struct { + /// The text to replace the range with. Must be set. + insertText: union(enum) { + string: []const u8, + StringValue: StringValue, + pub usingnamespace UnionParser(@This()); + }, + /// A text that is used to decide if this inline completion should be shown. When `falsy` the {@link InlineCompletionItem.insertText} is used. + filterText: ?[]const u8 = null, + /// The range to replace. Must begin and end on the same line. + range: ?Range = null, + /// An optional {@link Command} that is executed *after* inserting this completion. + command: ?Command = null, +}; +/// Inline completion options used during static or dynamic registration. +/// +/// @since 3.18.0 +/// @proposed +pub const InlineCompletionRegistrationOptions = struct { + + // Extends InlineCompletionOptions + + // Uses mixin WorkDoneProgressOptions + workDoneProgress: ?bool = null, + + // Extends TextDocumentRegistrationOptions + /// A document selector to identify the scope of the registration. If set to null + /// the document selector provided on the client side will be used. + documentSelector: ?DocumentSelector = null, + + // Uses mixin StaticRegistrationOptions + /// The id used to register the request. The id can be used to deregister + /// the request again. See also Registration#id. + id: ?[]const u8 = null, +}; + +pub const RegistrationParams = struct { registrations: []const Registration, }; pub const UnregistrationParams = struct { - pub const tres_null_meaning = .{}; - unregisterations: []const Unregistration, }; pub const InitializeParams = struct { - pub const tres_null_meaning = .{ - - // Extends _InitializeParams - .processId = .value, - .clientInfo = .field, - .locale = .field, - .rootPath = .dual, - .rootUri = .value, - .initializationOptions = .field, - .trace = .field, - - // Uses mixin WorkDoneProgressParams - .workDoneToken = .field, - - // Extends WorkspaceFoldersInitializeParams - .workspaceFolders = .dual, - }; // Extends _InitializeParams /// The process Id of the parent process that started @@ -2608,10 +2198,6 @@ pub const InitializeParams = struct { /// /// @since 3.15.0 clientInfo: ?struct { - pub const tres_null_meaning = .{ - .version = .field, - }; - /// The name of the client as defined by the client. name: []const u8, /// The client's version as defined by the client. @@ -2643,6 +2229,7 @@ pub const InitializeParams = struct { initializationOptions: ?LSPAny = null, /// The initial trace setting. If omitted trace is disabled ('off'). trace: ?TraceValues = null, + // Uses mixin WorkDoneProgressParams /// An optional token that a server can use to report work done progress. workDoneToken: ?ProgressToken = null, @@ -2660,20 +2247,12 @@ pub const InitializeParams = struct { /// The result returned from an initialize request. pub const InitializeResult = struct { - pub const tres_null_meaning = .{ - .serverInfo = .field, - }; - /// The capabilities the language server provides. capabilities: ServerCapabilities, /// Information about the server. /// /// @since 3.15.0 serverInfo: ?struct { - pub const tres_null_meaning = .{ - .version = .field, - }; - /// The name of the server as defined by the server. name: []const u8, /// The server's version as defined by the server. @@ -2684,8 +2263,6 @@ pub const InitializeResult = struct { /// The data type of the ResponseError if the /// initialize request fails. pub const InitializeError = struct { - pub const tres_null_meaning = .{}; - /// Indicates whether the client execute the following retry logic: /// (1) show the message provided by the ResponseError to the user /// (2) user selects retry or cancel @@ -2693,33 +2270,24 @@ pub const InitializeError = struct { retry: bool, }; -pub const InitializedParams = struct { - pub const tres_null_meaning = .{}; -}; +pub const InitializedParams = struct {}; /// The parameters of a change configuration notification. pub const DidChangeConfigurationParams = struct { - pub const tres_null_meaning = .{}; - /// The actual changed settings settings: LSPAny, }; pub const DidChangeConfigurationRegistrationOptions = struct { - pub const tres_null_meaning = .{ - .section = .field, - }; - section: ?union(enum) { string: []const u8, array_of_string: []const []const u8, + pub usingnamespace UnionParser(@This()); } = null, }; /// The parameters of a notification message. pub const ShowMessageParams = struct { - pub const tres_null_meaning = .{}; - /// The message type. See {@link MessageType} type: MessageType, /// The actual message. @@ -2727,10 +2295,6 @@ pub const ShowMessageParams = struct { }; pub const ShowMessageRequestParams = struct { - pub const tres_null_meaning = .{ - .actions = .field, - }; - /// The message type. See {@link MessageType} type: MessageType, /// The actual message. @@ -2740,16 +2304,12 @@ pub const ShowMessageRequestParams = struct { }; pub const MessageActionItem = struct { - pub const tres_null_meaning = .{}; - /// A short title like 'Retry', 'Open Log' etc. title: []const u8, }; /// The log message parameters. pub const LogMessageParams = struct { - pub const tres_null_meaning = .{}; - /// The message type. See {@link MessageType} type: MessageType, /// The actual message. @@ -2758,16 +2318,12 @@ pub const LogMessageParams = struct { /// The parameters sent in an open text document notification pub const DidOpenTextDocumentParams = struct { - pub const tres_null_meaning = .{}; - /// The document that was opened. textDocument: TextDocumentItem, }; /// The change text document notification's parameters. pub const DidChangeTextDocumentParams = struct { - pub const tres_null_meaning = .{}; - /// The document that did change. The version number points /// to the version after all provided content changes have /// been applied. @@ -2788,14 +2344,9 @@ pub const DidChangeTextDocumentParams = struct { /// Describe options to be used when registered for text document change events. pub const TextDocumentChangeRegistrationOptions = struct { - pub const tres_null_meaning = .{ - - // Extends TextDocumentRegistrationOptions - .documentSelector = .value, - }; - /// How documents are synced to the server. syncKind: TextDocumentSyncKind, + // Extends TextDocumentRegistrationOptions /// A document selector to identify the scope of the registration. If set to null /// the document selector provided on the client side will be used. @@ -2804,18 +2355,12 @@ pub const TextDocumentChangeRegistrationOptions = struct { /// The parameters sent in a close text document notification pub const DidCloseTextDocumentParams = struct { - pub const tres_null_meaning = .{}; - /// The document that was closed. textDocument: TextDocumentIdentifier, }; /// The parameters sent in a save text document notification pub const DidSaveTextDocumentParams = struct { - pub const tres_null_meaning = .{ - .text = .field, - }; - /// The document that was saved. textDocument: TextDocumentIdentifier, /// Optional the content when saved. Depends on the includeText value @@ -2825,14 +2370,6 @@ pub const DidSaveTextDocumentParams = struct { /// Save registration options. pub const TextDocumentSaveRegistrationOptions = struct { - pub const tres_null_meaning = .{ - - // Extends TextDocumentRegistrationOptions - .documentSelector = .value, - - // Extends SaveOptions - .includeText = .field, - }; // Extends TextDocumentRegistrationOptions /// A document selector to identify the scope of the registration. If set to null @@ -2846,8 +2383,6 @@ pub const TextDocumentSaveRegistrationOptions = struct { /// The parameters sent in a will save text document notification. pub const WillSaveTextDocumentParams = struct { - pub const tres_null_meaning = .{}; - /// The document that will be saved. textDocument: TextDocumentIdentifier, /// The 'TextDocumentSaveReason'. @@ -2856,8 +2391,6 @@ pub const WillSaveTextDocumentParams = struct { /// A text edit applicable to a text document. pub const TextEdit = struct { - pub const tres_null_meaning = .{}; - /// The range of the text document to be manipulated. To insert /// text into a document create a range where start === end. range: Range, @@ -2868,26 +2401,18 @@ pub const TextEdit = struct { /// The watched files change notification's parameters. pub const DidChangeWatchedFilesParams = struct { - pub const tres_null_meaning = .{}; - /// The actual file events. changes: []const FileEvent, }; /// Describe options to be used when registered for text document change events. pub const DidChangeWatchedFilesRegistrationOptions = struct { - pub const tres_null_meaning = .{}; - /// The watchers to register. watchers: []const FileSystemWatcher, }; /// The publish diagnostic notification's parameters. pub const PublishDiagnosticsParams = struct { - pub const tres_null_meaning = .{ - .version = .field, - }; - /// The URI for which diagnostic information is reported. uri: DocumentUri, /// Optional the version number of the document the diagnostics are published for. @@ -2900,21 +2425,10 @@ pub const PublishDiagnosticsParams = struct { /// Completion parameters pub const CompletionParams = struct { - pub const tres_null_meaning = .{ - .context = .field, - - // Extends TextDocumentPositionParams - - // Uses mixin WorkDoneProgressParams - .workDoneToken = .field, - - // Uses mixin PartialResultParams - .partialResultToken = .field, - }; - /// The completion context. This is only available it the client specifies /// to send this using the client capability `textDocument.completion.contextSupport === true` context: ?CompletionContext = null, + // Extends TextDocumentPositionParams /// The text document. textDocument: TextDocumentIdentifier, @@ -2934,27 +2448,6 @@ pub const CompletionParams = struct { /// A completion item represents a text snippet that is /// proposed to complete text that is being typed. pub const CompletionItem = struct { - pub const tres_null_meaning = .{ - .labelDetails = .field, - .kind = .field, - .tags = .field, - .detail = .field, - .documentation = .field, - .deprecated = .field, - .preselect = .field, - .sortText = .field, - .filterText = .field, - .insertText = .field, - .insertTextFormat = .field, - .insertTextMode = .field, - .textEdit = .field, - .textEditText = .field, - .additionalTextEdits = .field, - .commitCharacters = .field, - .command = .field, - .data = .field, - }; - /// The label of this completion item. /// /// The label property is also by default the text that @@ -2981,6 +2474,7 @@ pub const CompletionItem = struct { documentation: ?union(enum) { string: []const u8, MarkupContent: MarkupContent, + pub usingnamespace UnionParser(@This()); } = null, /// Indicates if this item is deprecated. /// @deprecated Use `tags` instead. @@ -3047,6 +2541,7 @@ pub const CompletionItem = struct { textEdit: ?union(enum) { TextEdit: TextEdit, InsertReplaceEdit: InsertReplaceEdit, + pub usingnamespace UnionParser(@This()); } = null, /// The edit text used if the completion item is part of a CompletionList and /// CompletionList defines an item default for the text edit range. @@ -3083,10 +2578,6 @@ pub const CompletionItem = struct { /// Represents a collection of {@link CompletionItem completion items} to be presented /// in the editor. pub const CompletionList = struct { - pub const tres_null_meaning = .{ - .itemDefaults = .field, - }; - /// This list it not complete. Further typing results in recomputing this list. /// /// Recomputed lists have all their items replaced (not appended) in the @@ -3106,14 +2597,6 @@ pub const CompletionList = struct { /// /// @since 3.17.0 itemDefaults: ?struct { - pub const tres_null_meaning = .{ - .commitCharacters = .field, - .editRange = .field, - .insertTextFormat = .field, - .insertTextMode = .field, - .data = .field, - }; - /// A default commit character set. /// /// @since 3.17.0 @@ -3124,11 +2607,10 @@ pub const CompletionList = struct { editRange: ?union(enum) { Range: Range, literal_1: struct { - pub const tres_null_meaning = .{}; - insert: Range, replace: Range, }, + pub usingnamespace UnionParser(@This()); } = null, /// A default insert text format. /// @@ -3149,20 +2631,6 @@ pub const CompletionList = struct { /// Registration options for a {@link CompletionRequest}. pub const CompletionRegistrationOptions = struct { - pub const tres_null_meaning = .{ - - // Extends TextDocumentRegistrationOptions - .documentSelector = .value, - - // Extends CompletionOptions - .triggerCharacters = .field, - .allCommitCharacters = .field, - .resolveProvider = .field, - .completionItem = .field, - - // Uses mixin WorkDoneProgressOptions - .workDoneProgress = .field, - }; // Extends TextDocumentRegistrationOptions /// A document selector to identify the scope of the registration. If set to null @@ -3196,10 +2664,6 @@ pub const CompletionRegistrationOptions = struct { /// /// @since 3.17.0 completionItem: ?struct { - pub const tres_null_meaning = .{ - .labelDetailsSupport = .field, - }; - /// The server has support for completion item label /// details (see also `CompletionItemLabelDetails`) when /// receiving a completion item in a resolve call. @@ -3207,19 +2671,13 @@ pub const CompletionRegistrationOptions = struct { /// @since 3.17.0 labelDetailsSupport: ?bool = null, } = null, + // Uses mixin WorkDoneProgressOptions workDoneProgress: ?bool = null, }; /// Parameters for a {@link HoverRequest}. pub const HoverParams = struct { - pub const tres_null_meaning = .{ - - // Extends TextDocumentPositionParams - - // Uses mixin WorkDoneProgressParams - .workDoneToken = .field, - }; // Extends TextDocumentPositionParams /// The text document. @@ -3234,15 +2692,12 @@ pub const HoverParams = struct { /// The result of a hover request. pub const Hover = struct { - pub const tres_null_meaning = .{ - .range = .field, - }; - /// The hover's content contents: union(enum) { MarkupContent: MarkupContent, MarkedString: MarkedString, array_of_MarkedString: []const MarkedString, + pub usingnamespace UnionParser(@This()); }, /// An optional range inside the text document that is used to /// visualize the hover, e.g. by changing the background color. @@ -3251,16 +2706,6 @@ pub const Hover = struct { /// Registration options for a {@link HoverRequest}. pub const HoverRegistrationOptions = struct { - pub const tres_null_meaning = .{ - - // Extends TextDocumentRegistrationOptions - .documentSelector = .value, - - // Extends HoverOptions - - // Uses mixin WorkDoneProgressOptions - .workDoneProgress = .field, - }; // Extends TextDocumentRegistrationOptions /// A document selector to identify the scope of the registration. If set to null @@ -3268,26 +2713,19 @@ pub const HoverRegistrationOptions = struct { documentSelector: ?DocumentSelector = null, // Extends HoverOptions + // Uses mixin WorkDoneProgressOptions workDoneProgress: ?bool = null, }; /// Parameters for a {@link SignatureHelpRequest}. pub const SignatureHelpParams = struct { - pub const tres_null_meaning = .{ - .context = .field, - - // Extends TextDocumentPositionParams - - // Uses mixin WorkDoneProgressParams - .workDoneToken = .field, - }; - /// The signature help context. This is only available if the client specifies /// to send this using the client capability `textDocument.signatureHelp.contextSupport === true` /// /// @since 3.15.0 context: ?SignatureHelpContext = null, + // Extends TextDocumentPositionParams /// The text document. textDocument: TextDocumentIdentifier, @@ -3303,11 +2741,6 @@ pub const SignatureHelpParams = struct { /// callable. There can be multiple signature but only one /// active and only one active parameter. pub const SignatureHelp = struct { - pub const tres_null_meaning = .{ - .activeSignature = .field, - .activeParameter = .field, - }; - /// One or more signatures. signatures: []const SignatureInformation, /// The active signature. If omitted or the value lies outside the @@ -3332,18 +2765,6 @@ pub const SignatureHelp = struct { /// Registration options for a {@link SignatureHelpRequest}. pub const SignatureHelpRegistrationOptions = struct { - pub const tres_null_meaning = .{ - - // Extends TextDocumentRegistrationOptions - .documentSelector = .value, - - // Extends SignatureHelpOptions - .triggerCharacters = .field, - .retriggerCharacters = .field, - - // Uses mixin WorkDoneProgressOptions - .workDoneProgress = .field, - }; // Extends TextDocumentRegistrationOptions /// A document selector to identify the scope of the registration. If set to null @@ -3360,22 +2781,13 @@ pub const SignatureHelpRegistrationOptions = struct { /// /// @since 3.15.0 retriggerCharacters: ?[]const []const u8 = null, + // Uses mixin WorkDoneProgressOptions workDoneProgress: ?bool = null, }; /// Parameters for a {@link DefinitionRequest}. pub const DefinitionParams = struct { - pub const tres_null_meaning = .{ - - // Extends TextDocumentPositionParams - - // Uses mixin WorkDoneProgressParams - .workDoneToken = .field, - - // Uses mixin PartialResultParams - .partialResultToken = .field, - }; // Extends TextDocumentPositionParams /// The text document. @@ -3395,16 +2807,6 @@ pub const DefinitionParams = struct { /// Registration options for a {@link DefinitionRequest}. pub const DefinitionRegistrationOptions = struct { - pub const tres_null_meaning = .{ - - // Extends TextDocumentRegistrationOptions - .documentSelector = .value, - - // Extends DefinitionOptions - - // Uses mixin WorkDoneProgressOptions - .workDoneProgress = .field, - }; // Extends TextDocumentRegistrationOptions /// A document selector to identify the scope of the registration. If set to null @@ -3412,24 +2814,15 @@ pub const DefinitionRegistrationOptions = struct { documentSelector: ?DocumentSelector = null, // Extends DefinitionOptions + // Uses mixin WorkDoneProgressOptions workDoneProgress: ?bool = null, }; /// Parameters for a {@link ReferencesRequest}. pub const ReferenceParams = struct { - pub const tres_null_meaning = .{ - - // Extends TextDocumentPositionParams - - // Uses mixin WorkDoneProgressParams - .workDoneToken = .field, - - // Uses mixin PartialResultParams - .partialResultToken = .field, - }; - context: ReferenceContext, + // Extends TextDocumentPositionParams /// The text document. textDocument: TextDocumentIdentifier, @@ -3448,16 +2841,6 @@ pub const ReferenceParams = struct { /// Registration options for a {@link ReferencesRequest}. pub const ReferenceRegistrationOptions = struct { - pub const tres_null_meaning = .{ - - // Extends TextDocumentRegistrationOptions - .documentSelector = .value, - - // Extends ReferenceOptions - - // Uses mixin WorkDoneProgressOptions - .workDoneProgress = .field, - }; // Extends TextDocumentRegistrationOptions /// A document selector to identify the scope of the registration. If set to null @@ -3465,22 +2848,13 @@ pub const ReferenceRegistrationOptions = struct { documentSelector: ?DocumentSelector = null, // Extends ReferenceOptions + // Uses mixin WorkDoneProgressOptions workDoneProgress: ?bool = null, }; /// Parameters for a {@link DocumentHighlightRequest}. pub const DocumentHighlightParams = struct { - pub const tres_null_meaning = .{ - - // Extends TextDocumentPositionParams - - // Uses mixin WorkDoneProgressParams - .workDoneToken = .field, - - // Uses mixin PartialResultParams - .partialResultToken = .field, - }; // Extends TextDocumentPositionParams /// The text document. @@ -3502,10 +2876,6 @@ pub const DocumentHighlightParams = struct { /// special attention. Usually a document highlight is visualized by changing /// the background color of its range. pub const DocumentHighlight = struct { - pub const tres_null_meaning = .{ - .kind = .field, - }; - /// The range this highlight applies to. range: Range, /// The highlight kind, default is {@link DocumentHighlightKind.Text text}. @@ -3514,16 +2884,6 @@ pub const DocumentHighlight = struct { /// Registration options for a {@link DocumentHighlightRequest}. pub const DocumentHighlightRegistrationOptions = struct { - pub const tres_null_meaning = .{ - - // Extends TextDocumentRegistrationOptions - .documentSelector = .value, - - // Extends DocumentHighlightOptions - - // Uses mixin WorkDoneProgressOptions - .workDoneProgress = .field, - }; // Extends TextDocumentRegistrationOptions /// A document selector to identify the scope of the registration. If set to null @@ -3531,23 +2891,16 @@ pub const DocumentHighlightRegistrationOptions = struct { documentSelector: ?DocumentSelector = null, // Extends DocumentHighlightOptions + // Uses mixin WorkDoneProgressOptions workDoneProgress: ?bool = null, }; /// Parameters for a {@link DocumentSymbolRequest}. pub const DocumentSymbolParams = struct { - pub const tres_null_meaning = .{ - - // Uses mixin WorkDoneProgressParams - .workDoneToken = .field, - - // Uses mixin PartialResultParams - .partialResultToken = .field, - }; - /// The text document. textDocument: TextDocumentIdentifier, + // Uses mixin WorkDoneProgressParams /// An optional token that a server can use to report work done progress. workDoneToken: ?ProgressToken = null, @@ -3561,14 +2914,6 @@ pub const DocumentSymbolParams = struct { /// Represents information about programming constructs like variables, classes, /// interfaces etc. pub const SymbolInformation = struct { - pub const tres_null_meaning = .{ - .deprecated = .field, - - // Extends BaseSymbolInformation - .tags = .field, - .containerName = .field, - }; - /// Indicates if this symbol is deprecated. /// /// @deprecated Use tags instead @@ -3583,6 +2928,7 @@ pub const SymbolInformation = struct { /// syntax tree. It can therefore not be used to re-construct a hierarchy of /// the symbols. location: Location, + // Extends BaseSymbolInformation /// The name of this symbol. name: []const u8, @@ -3604,13 +2950,6 @@ pub const SymbolInformation = struct { /// have two ranges: one that encloses its definition and one that points to /// its most interesting range, e.g. the range of an identifier. pub const DocumentSymbol = struct { - pub const tres_null_meaning = .{ - .detail = .field, - .tags = .field, - .deprecated = .field, - .children = .field, - }; - /// The name of this symbol. Will be displayed in the user interface and therefore must not be /// an empty string or a string only consisting of white spaces. name: []const u8, @@ -3639,17 +2978,6 @@ pub const DocumentSymbol = struct { /// Registration options for a {@link DocumentSymbolRequest}. pub const DocumentSymbolRegistrationOptions = struct { - pub const tres_null_meaning = .{ - - // Extends TextDocumentRegistrationOptions - .documentSelector = .value, - - // Extends DocumentSymbolOptions - .label = .field, - - // Uses mixin WorkDoneProgressOptions - .workDoneProgress = .field, - }; // Extends TextDocumentRegistrationOptions /// A document selector to identify the scope of the registration. If set to null @@ -3662,27 +2990,20 @@ pub const DocumentSymbolRegistrationOptions = struct { /// /// @since 3.16.0 label: ?[]const u8 = null, + // Uses mixin WorkDoneProgressOptions workDoneProgress: ?bool = null, }; /// The parameters of a {@link CodeActionRequest}. pub const CodeActionParams = struct { - pub const tres_null_meaning = .{ - - // Uses mixin WorkDoneProgressParams - .workDoneToken = .field, - - // Uses mixin PartialResultParams - .partialResultToken = .field, - }; - /// The document in which the command was invoked. textDocument: TextDocumentIdentifier, /// The range for which the command was invoked. range: Range, /// Context carrying additional information. context: CodeActionContext, + // Uses mixin WorkDoneProgressParams /// An optional token that a server can use to report work done progress. workDoneToken: ?ProgressToken = null, @@ -3698,10 +3019,6 @@ pub const CodeActionParams = struct { /// an array of arguments which will be passed to the command handler /// function when invoked. pub const Command = struct { - pub const tres_null_meaning = .{ - .arguments = .field, - }; - /// Title of the command, like `save`. title: []const u8, /// The identifier of the actual command handler. @@ -3716,16 +3033,6 @@ pub const Command = struct { /// /// A CodeAction must set either `edit` and/or a `command`. If both are supplied, the `edit` is applied first, then the `command` is executed. pub const CodeAction = struct { - pub const tres_null_meaning = .{ - .kind = .field, - .diagnostics = .field, - .isPreferred = .field, - .disabled = .field, - .edit = .field, - .command = .field, - .data = .field, - }; - /// A short, human-readable, title for this code action. title: []const u8, /// The kind of the code action. @@ -3758,8 +3065,6 @@ pub const CodeAction = struct { /// /// @since 3.16.0 disabled: ?struct { - pub const tres_null_meaning = .{}; - /// Human readable description of why the code action is currently disabled. /// /// This is displayed in the code actions UI. @@ -3780,18 +3085,6 @@ pub const CodeAction = struct { /// Registration options for a {@link CodeActionRequest}. pub const CodeActionRegistrationOptions = struct { - pub const tres_null_meaning = .{ - - // Extends TextDocumentRegistrationOptions - .documentSelector = .value, - - // Extends CodeActionOptions - .codeActionKinds = .field, - .resolveProvider = .field, - - // Uses mixin WorkDoneProgressOptions - .workDoneProgress = .field, - }; // Extends TextDocumentRegistrationOptions /// A document selector to identify the scope of the registration. If set to null @@ -3809,24 +3102,17 @@ pub const CodeActionRegistrationOptions = struct { /// /// @since 3.16.0 resolveProvider: ?bool = null, + // Uses mixin WorkDoneProgressOptions workDoneProgress: ?bool = null, }; /// The parameters of a {@link WorkspaceSymbolRequest}. pub const WorkspaceSymbolParams = struct { - pub const tres_null_meaning = .{ - - // Uses mixin WorkDoneProgressParams - .workDoneToken = .field, - - // Uses mixin PartialResultParams - .partialResultToken = .field, - }; - /// A query string to filter symbols by. Clients may send an empty /// string here to request all symbols. query: []const u8, + // Uses mixin WorkDoneProgressParams /// An optional token that a server can use to report work done progress. workDoneToken: ?ProgressToken = null, @@ -3843,14 +3129,6 @@ pub const WorkspaceSymbolParams = struct { /// /// @since 3.17.0 pub const WorkspaceSymbol = struct { - pub const tres_null_meaning = .{ - .data = .field, - - // Extends BaseSymbolInformation - .tags = .field, - .containerName = .field, - }; - /// The location of the symbol. Whether a server is allowed to /// return a location without a range depends on the client /// capability `workspace.symbol.resolveSupport`. @@ -3859,14 +3137,14 @@ pub const WorkspaceSymbol = struct { location: union(enum) { Location: Location, literal_1: struct { - pub const tres_null_meaning = .{}; - uri: DocumentUri, }, + pub usingnamespace UnionParser(@This()); }, /// A data entry field that is preserved on a workspace symbol between a /// workspace symbol request and a workspace symbol resolve request. data: ?LSPAny = null, + // Extends BaseSymbolInformation /// The name of this symbol. name: []const u8, @@ -3885,14 +3163,6 @@ pub const WorkspaceSymbol = struct { /// Registration options for a {@link WorkspaceSymbolRequest}. pub const WorkspaceSymbolRegistrationOptions = struct { - pub const tres_null_meaning = .{ - - // Extends WorkspaceSymbolOptions - .resolveProvider = .field, - - // Uses mixin WorkDoneProgressOptions - .workDoneProgress = .field, - }; // Extends WorkspaceSymbolOptions /// The server provides support to resolve additional @@ -3900,23 +3170,16 @@ pub const WorkspaceSymbolRegistrationOptions = struct { /// /// @since 3.17.0 resolveProvider: ?bool = null, + // Uses mixin WorkDoneProgressOptions workDoneProgress: ?bool = null, }; /// The parameters of a {@link CodeLensRequest}. pub const CodeLensParams = struct { - pub const tres_null_meaning = .{ - - // Uses mixin WorkDoneProgressParams - .workDoneToken = .field, - - // Uses mixin PartialResultParams - .partialResultToken = .field, - }; - /// The document to request code lens for. textDocument: TextDocumentIdentifier, + // Uses mixin WorkDoneProgressParams /// An optional token that a server can use to report work done progress. workDoneToken: ?ProgressToken = null, @@ -3933,11 +3196,6 @@ pub const CodeLensParams = struct { /// A code lens is _unresolved_ when no command is associated to it. For performance /// reasons the creation of a code lens and resolving should be done in two stages. pub const CodeLens = struct { - pub const tres_null_meaning = .{ - .command = .field, - .data = .field, - }; - /// The range in which this code lens is valid. Should only span a single line. range: Range, /// The command this code lens represents. @@ -3950,17 +3208,6 @@ pub const CodeLens = struct { /// Registration options for a {@link CodeLensRequest}. pub const CodeLensRegistrationOptions = struct { - pub const tres_null_meaning = .{ - - // Extends TextDocumentRegistrationOptions - .documentSelector = .value, - - // Extends CodeLensOptions - .resolveProvider = .field, - - // Uses mixin WorkDoneProgressOptions - .workDoneProgress = .field, - }; // Extends TextDocumentRegistrationOptions /// A document selector to identify the scope of the registration. If set to null @@ -3970,23 +3217,16 @@ pub const CodeLensRegistrationOptions = struct { // Extends CodeLensOptions /// Code lens has a resolve provider as well. resolveProvider: ?bool = null, + // Uses mixin WorkDoneProgressOptions workDoneProgress: ?bool = null, }; /// The parameters of a {@link DocumentLinkRequest}. pub const DocumentLinkParams = struct { - pub const tres_null_meaning = .{ - - // Uses mixin WorkDoneProgressParams - .workDoneToken = .field, - - // Uses mixin PartialResultParams - .partialResultToken = .field, - }; - /// The document to provide document links for. textDocument: TextDocumentIdentifier, + // Uses mixin WorkDoneProgressParams /// An optional token that a server can use to report work done progress. workDoneToken: ?ProgressToken = null, @@ -4000,12 +3240,6 @@ pub const DocumentLinkParams = struct { /// A document link is a range in a text document that links to an internal or external resource, like another /// text document or a web site. pub const DocumentLink = struct { - pub const tres_null_meaning = .{ - .target = .field, - .tooltip = .field, - .data = .field, - }; - /// The range this link applies to. range: Range, /// The uri this link points to. If missing a resolve request is sent later. @@ -4025,17 +3259,6 @@ pub const DocumentLink = struct { /// Registration options for a {@link DocumentLinkRequest}. pub const DocumentLinkRegistrationOptions = struct { - pub const tres_null_meaning = .{ - - // Extends TextDocumentRegistrationOptions - .documentSelector = .value, - - // Extends DocumentLinkOptions - .resolveProvider = .field, - - // Uses mixin WorkDoneProgressOptions - .workDoneProgress = .field, - }; // Extends TextDocumentRegistrationOptions /// A document selector to identify the scope of the registration. If set to null @@ -4045,22 +3268,18 @@ pub const DocumentLinkRegistrationOptions = struct { // Extends DocumentLinkOptions /// Document links have a resolve provider as well. resolveProvider: ?bool = null, + // Uses mixin WorkDoneProgressOptions workDoneProgress: ?bool = null, }; /// The parameters of a {@link DocumentFormattingRequest}. pub const DocumentFormattingParams = struct { - pub const tres_null_meaning = .{ - - // Uses mixin WorkDoneProgressParams - .workDoneToken = .field, - }; - /// The document to format. textDocument: TextDocumentIdentifier, /// The format options. options: FormattingOptions, + // Uses mixin WorkDoneProgressParams /// An optional token that a server can use to report work done progress. workDoneToken: ?ProgressToken = null, @@ -4068,16 +3287,6 @@ pub const DocumentFormattingParams = struct { /// Registration options for a {@link DocumentFormattingRequest}. pub const DocumentFormattingRegistrationOptions = struct { - pub const tres_null_meaning = .{ - - // Extends TextDocumentRegistrationOptions - .documentSelector = .value, - - // Extends DocumentFormattingOptions - - // Uses mixin WorkDoneProgressOptions - .workDoneProgress = .field, - }; // Extends TextDocumentRegistrationOptions /// A document selector to identify the scope of the registration. If set to null @@ -4085,24 +3294,20 @@ pub const DocumentFormattingRegistrationOptions = struct { documentSelector: ?DocumentSelector = null, // Extends DocumentFormattingOptions + // Uses mixin WorkDoneProgressOptions workDoneProgress: ?bool = null, }; /// The parameters of a {@link DocumentRangeFormattingRequest}. pub const DocumentRangeFormattingParams = struct { - pub const tres_null_meaning = .{ - - // Uses mixin WorkDoneProgressParams - .workDoneToken = .field, - }; - /// The document to format. textDocument: TextDocumentIdentifier, /// The range to format range: Range, /// The format options options: FormattingOptions, + // Uses mixin WorkDoneProgressParams /// An optional token that a server can use to report work done progress. workDoneToken: ?ProgressToken = null, @@ -4110,16 +3315,6 @@ pub const DocumentRangeFormattingParams = struct { /// Registration options for a {@link DocumentRangeFormattingRequest}. pub const DocumentRangeFormattingRegistrationOptions = struct { - pub const tres_null_meaning = .{ - - // Extends TextDocumentRegistrationOptions - .documentSelector = .value, - - // Extends DocumentRangeFormattingOptions - - // Uses mixin WorkDoneProgressOptions - .workDoneProgress = .field, - }; // Extends TextDocumentRegistrationOptions /// A document selector to identify the scope of the registration. If set to null @@ -4127,14 +3322,35 @@ pub const DocumentRangeFormattingRegistrationOptions = struct { documentSelector: ?DocumentSelector = null, // Extends DocumentRangeFormattingOptions + /// Whether the server supports formatting multiple ranges at once. + /// + /// @since 3.18.0 + /// @proposed + rangesSupport: ?bool = null, + // Uses mixin WorkDoneProgressOptions workDoneProgress: ?bool = null, }; +/// The parameters of a {@link DocumentRangesFormattingRequest}. +/// +/// @since 3.18.0 +/// @proposed +pub const DocumentRangesFormattingParams = struct { + /// The document to format. + textDocument: TextDocumentIdentifier, + /// The ranges to format + ranges: []const Range, + /// The format options + options: FormattingOptions, + + // Uses mixin WorkDoneProgressParams + /// An optional token that a server can use to report work done progress. + workDoneToken: ?ProgressToken = null, +}; + /// The parameters of a {@link DocumentOnTypeFormattingRequest}. pub const DocumentOnTypeFormattingParams = struct { - pub const tres_null_meaning = .{}; - /// The document to format. textDocument: TextDocumentIdentifier, /// The position around which the on type formatting should happen. @@ -4152,14 +3368,6 @@ pub const DocumentOnTypeFormattingParams = struct { /// Registration options for a {@link DocumentOnTypeFormattingRequest}. pub const DocumentOnTypeFormattingRegistrationOptions = struct { - pub const tres_null_meaning = .{ - - // Extends TextDocumentRegistrationOptions - .documentSelector = .value, - - // Extends DocumentOnTypeFormattingOptions - .moreTriggerCharacter = .field, - }; // Extends TextDocumentRegistrationOptions /// A document selector to identify the scope of the registration. If set to null @@ -4175,12 +3383,6 @@ pub const DocumentOnTypeFormattingRegistrationOptions = struct { /// The parameters of a {@link RenameRequest}. pub const RenameParams = struct { - pub const tres_null_meaning = .{ - - // Uses mixin WorkDoneProgressParams - .workDoneToken = .field, - }; - /// The document to rename. textDocument: TextDocumentIdentifier, /// The position at which this request was sent. @@ -4189,6 +3391,7 @@ pub const RenameParams = struct { /// request must return a {@link ResponseError} with an /// appropriate message set. newName: []const u8, + // Uses mixin WorkDoneProgressParams /// An optional token that a server can use to report work done progress. workDoneToken: ?ProgressToken = null, @@ -4196,17 +3399,6 @@ pub const RenameParams = struct { /// Registration options for a {@link RenameRequest}. pub const RenameRegistrationOptions = struct { - pub const tres_null_meaning = .{ - - // Extends TextDocumentRegistrationOptions - .documentSelector = .value, - - // Extends RenameOptions - .prepareProvider = .field, - - // Uses mixin WorkDoneProgressOptions - .workDoneProgress = .field, - }; // Extends TextDocumentRegistrationOptions /// A document selector to identify the scope of the registration. If set to null @@ -4218,18 +3410,12 @@ pub const RenameRegistrationOptions = struct { /// /// @since version 3.12.0 prepareProvider: ?bool = null, + // Uses mixin WorkDoneProgressOptions workDoneProgress: ?bool = null, }; pub const PrepareRenameParams = struct { - pub const tres_null_meaning = .{ - - // Extends TextDocumentPositionParams - - // Uses mixin WorkDoneProgressParams - .workDoneToken = .field, - }; // Extends TextDocumentPositionParams /// The text document. @@ -4244,17 +3430,11 @@ pub const PrepareRenameParams = struct { /// The parameters of a {@link ExecuteCommandRequest}. pub const ExecuteCommandParams = struct { - pub const tres_null_meaning = .{ - .arguments = .field, - - // Uses mixin WorkDoneProgressParams - .workDoneToken = .field, - }; - /// The identifier of the actual command handler. command: []const u8, /// Arguments that the command should be invoked with. arguments: ?[]const LSPAny = null, + // Uses mixin WorkDoneProgressParams /// An optional token that a server can use to report work done progress. workDoneToken: ?ProgressToken = null, @@ -4262,27 +3442,17 @@ pub const ExecuteCommandParams = struct { /// Registration options for a {@link ExecuteCommandRequest}. pub const ExecuteCommandRegistrationOptions = struct { - pub const tres_null_meaning = .{ - - // Extends ExecuteCommandOptions - - // Uses mixin WorkDoneProgressOptions - .workDoneProgress = .field, - }; // Extends ExecuteCommandOptions /// The commands to be executed on the server commands: []const []const u8, + // Uses mixin WorkDoneProgressOptions workDoneProgress: ?bool = null, }; /// The parameters passed via an apply workspace edit request. pub const ApplyWorkspaceEditParams = struct { - pub const tres_null_meaning = .{ - .label = .field, - }; - /// An optional label of the workspace edit. This label is /// presented in the user interface for example on an undo /// stack to undo the workspace edit. @@ -4295,11 +3465,6 @@ pub const ApplyWorkspaceEditParams = struct { /// /// @since 3.17 renamed from ApplyWorkspaceEditResponse pub const ApplyWorkspaceEditResult = struct { - pub const tres_null_meaning = .{ - .failureReason = .field, - .failedChange = .field, - }; - /// Indicates whether the edit was applied or not. applied: bool, /// An optional textual description for why the edit was not applied. @@ -4313,13 +3478,7 @@ pub const ApplyWorkspaceEditResult = struct { }; pub const WorkDoneProgressBegin = struct { - pub const tres_null_meaning = .{ - .cancellable = .field, - .message = .field, - .percentage = .field, - }; - - comptime kind: []const u8 = "begin", + kind: []const u8 = "begin", /// Mandatory title of the progress operation. Used to briefly inform about /// the kind of operation being performed. /// @@ -4345,13 +3504,7 @@ pub const WorkDoneProgressBegin = struct { }; pub const WorkDoneProgressReport = struct { - pub const tres_null_meaning = .{ - .cancellable = .field, - .message = .field, - .percentage = .field, - }; - - comptime kind: []const u8 = "report", + kind: []const u8 = "report", /// Controls enablement state of a cancel button. /// /// Clients that don't support cancellation or don't support controlling the button's @@ -4373,44 +3526,31 @@ pub const WorkDoneProgressReport = struct { }; pub const WorkDoneProgressEnd = struct { - pub const tres_null_meaning = .{ - .message = .field, - }; - - comptime kind: []const u8 = "end", + kind: []const u8 = "end", /// Optional, a final message indicating to for example indicate the outcome /// of the operation. message: ?[]const u8 = null, }; pub const SetTraceParams = struct { - pub const tres_null_meaning = .{}; - value: TraceValues, }; pub const LogTraceParams = struct { - pub const tres_null_meaning = .{ - .verbose = .field, - }; - message: []const u8, verbose: ?[]const u8 = null, }; pub const CancelParams = struct { - pub const tres_null_meaning = .{}; - /// The request id to cancel. id: union(enum) { integer: i32, string: []const u8, + pub usingnamespace UnionParser(@This()); }, }; pub const ProgressParams = struct { - pub const tres_null_meaning = .{}; - /// The progress token provided by the client or server. token: ProgressToken, /// The progress data. @@ -4420,8 +3560,6 @@ pub const ProgressParams = struct { /// A parameter literal used in requests to pass a text document and a position inside that /// document. pub const TextDocumentPositionParams = struct { - pub const tres_null_meaning = .{}; - /// The text document. textDocument: TextDocumentIdentifier, /// The position inside the text document. @@ -4429,19 +3567,11 @@ pub const TextDocumentPositionParams = struct { }; pub const WorkDoneProgressParams = struct { - pub const tres_null_meaning = .{ - .workDoneToken = .field, - }; - /// An optional token that a server can use to report work done progress. workDoneToken: ?ProgressToken = null, }; pub const PartialResultParams = struct { - pub const tres_null_meaning = .{ - .partialResultToken = .field, - }; - /// An optional token that a server can use to report partial results (e.g. streaming) to /// the client. partialResultToken: ?ProgressToken = null, @@ -4450,10 +3580,6 @@ pub const PartialResultParams = struct { /// Represents the connection of two locations. Provides additional metadata over normal {@link Location locations}, /// including an origin range. pub const LocationLink = struct { - pub const tres_null_meaning = .{ - .originSelectionRange = .field, - }; - /// Span of the origin of this link. /// /// Used as the underlined span for mouse interaction. Defaults to the word range at @@ -4482,8 +3608,6 @@ pub const LocationLink = struct { /// } /// ``` pub const Range = struct { - pub const tres_null_meaning = .{}; - /// The range's start position. start: Position, /// The range's end position. @@ -4491,11 +3615,6 @@ pub const Range = struct { }; pub const ImplementationOptions = struct { - pub const tres_null_meaning = .{ - - // Uses mixin WorkDoneProgressOptions - .workDoneProgress = .field, - }; // Uses mixin WorkDoneProgressOptions workDoneProgress: ?bool = null, @@ -4504,21 +3623,12 @@ pub const ImplementationOptions = struct { /// Static registration options to be returned in the initialize /// request. pub const StaticRegistrationOptions = struct { - pub const tres_null_meaning = .{ - .id = .field, - }; - /// The id used to register the request. The id can be used to deregister /// the request again. See also Registration#id. id: ?[]const u8 = null, }; pub const TypeDefinitionOptions = struct { - pub const tres_null_meaning = .{ - - // Uses mixin WorkDoneProgressOptions - .workDoneProgress = .field, - }; // Uses mixin WorkDoneProgressOptions workDoneProgress: ?bool = null, @@ -4526,8 +3636,6 @@ pub const TypeDefinitionOptions = struct { /// The workspace folder change event. pub const WorkspaceFoldersChangeEvent = struct { - pub const tres_null_meaning = .{}; - /// The array of added workspace folders added: []const WorkspaceFolder, /// The array of the removed workspace folders @@ -4535,11 +3643,6 @@ pub const WorkspaceFoldersChangeEvent = struct { }; pub const ConfigurationItem = struct { - pub const tres_null_meaning = .{ - .scopeUri = .field, - .section = .field, - }; - /// The scope to get the configuration section for. scopeUri: ?[]const u8 = null, /// The configuration section asked for. @@ -4548,16 +3651,12 @@ pub const ConfigurationItem = struct { /// A literal to identify a text document in the client. pub const TextDocumentIdentifier = struct { - pub const tres_null_meaning = .{}; - /// The text document's uri. uri: DocumentUri, }; /// Represents a color in RGBA space. pub const Color = struct { - pub const tres_null_meaning = .{}; - /// The red component of this color in the range [0-1]. red: f32, /// The green component of this color in the range [0-1]. @@ -4569,33 +3668,18 @@ pub const Color = struct { }; pub const DocumentColorOptions = struct { - pub const tres_null_meaning = .{ - - // Uses mixin WorkDoneProgressOptions - .workDoneProgress = .field, - }; // Uses mixin WorkDoneProgressOptions workDoneProgress: ?bool = null, }; pub const FoldingRangeOptions = struct { - pub const tres_null_meaning = .{ - - // Uses mixin WorkDoneProgressOptions - .workDoneProgress = .field, - }; // Uses mixin WorkDoneProgressOptions workDoneProgress: ?bool = null, }; pub const DeclarationOptions = struct { - pub const tres_null_meaning = .{ - - // Uses mixin WorkDoneProgressOptions - .workDoneProgress = .field, - }; // Uses mixin WorkDoneProgressOptions workDoneProgress: ?bool = null, @@ -4629,8 +3713,6 @@ pub const DeclarationOptions = struct { /// /// @since 3.17.0 - support for negotiated position encoding. pub const Position = struct { - pub const tres_null_meaning = .{}; - /// Line position in a document (zero-based). /// /// If a line number is greater than the number of lines in a document, it defaults back to the number of lines in the document. @@ -4647,11 +3729,6 @@ pub const Position = struct { }; pub const SelectionRangeOptions = struct { - pub const tres_null_meaning = .{ - - // Uses mixin WorkDoneProgressOptions - .workDoneProgress = .field, - }; // Uses mixin WorkDoneProgressOptions workDoneProgress: ?bool = null, @@ -4661,11 +3738,6 @@ pub const SelectionRangeOptions = struct { /// /// @since 3.16.0 pub const CallHierarchyOptions = struct { - pub const tres_null_meaning = .{ - - // Uses mixin WorkDoneProgressOptions - .workDoneProgress = .field, - }; // Uses mixin WorkDoneProgressOptions workDoneProgress: ?bool = null, @@ -4673,46 +3745,31 @@ pub const CallHierarchyOptions = struct { /// @since 3.16.0 pub const SemanticTokensOptions = struct { - pub const tres_null_meaning = .{ - .range = .field, - .full = .field, - - // Uses mixin WorkDoneProgressOptions - .workDoneProgress = .field, - }; - /// The legend used by the server legend: SemanticTokensLegend, /// Server supports providing semantic tokens for a specific range /// of a document. range: ?union(enum) { bool: bool, - literal_1: struct { - pub const tres_null_meaning = .{}; - }, + literal_1: struct {}, + pub usingnamespace UnionParser(@This()); } = null, /// Server supports providing semantic tokens for a full document. full: ?union(enum) { bool: bool, literal_1: struct { - pub const tres_null_meaning = .{ - .delta = .field, - }; - /// The server supports deltas for full documents. delta: ?bool = null, }, + pub usingnamespace UnionParser(@This()); } = null, + // Uses mixin WorkDoneProgressOptions workDoneProgress: ?bool = null, }; /// @since 3.16.0 pub const SemanticTokensEdit = struct { - pub const tres_null_meaning = .{ - .data = .field, - }; - /// The start offset of the edit. start: u32, /// The count of elements to remove. @@ -4722,11 +3779,6 @@ pub const SemanticTokensEdit = struct { }; pub const LinkedEditingRangeOptions = struct { - pub const tres_null_meaning = .{ - - // Uses mixin WorkDoneProgressOptions - .workDoneProgress = .field, - }; // Uses mixin WorkDoneProgressOptions workDoneProgress: ?bool = null, @@ -4736,8 +3788,6 @@ pub const LinkedEditingRangeOptions = struct { /// /// @since 3.16.0 pub const FileCreate = struct { - pub const tres_null_meaning = .{}; - /// A file:// URI for the location of the file/folder being created. uri: []const u8, }; @@ -4747,8 +3797,6 @@ pub const FileCreate = struct { /// So the creator of a TextDocumentEdit doesn't need to sort the array of edits or do any /// kind of ordering. However the edits must be non overlapping. pub const TextDocumentEdit = struct { - pub const tres_null_meaning = .{}; - /// The text document to change. textDocument: OptionalVersionedTextDocumentIdentifier, /// The edits to be applied. @@ -4758,24 +3806,19 @@ pub const TextDocumentEdit = struct { edits: []const union(enum) { TextEdit: TextEdit, AnnotatedTextEdit: AnnotatedTextEdit, + pub usingnamespace UnionParser(@This()); }, }; /// Create file operation. pub const CreateFile = struct { - pub const tres_null_meaning = .{ - .options = .field, - - // Extends ResourceOperation - .annotationId = .field, - }; - /// A create - comptime kind: []const u8 = "create", + kind: []const u8 = "create", /// The resource to create. uri: DocumentUri, /// Additional options options: ?CreateFileOptions = null, + // Extends ResourceOperation /// An optional annotation identifier describing the operation. /// @@ -4785,21 +3828,15 @@ pub const CreateFile = struct { /// Rename file operation pub const RenameFile = struct { - pub const tres_null_meaning = .{ - .options = .field, - - // Extends ResourceOperation - .annotationId = .field, - }; - /// A rename - comptime kind: []const u8 = "rename", + kind: []const u8 = "rename", /// The old (existing) location. oldUri: DocumentUri, /// The new location. newUri: DocumentUri, /// Rename options. options: ?RenameFileOptions = null, + // Extends ResourceOperation /// An optional annotation identifier describing the operation. /// @@ -4809,19 +3846,13 @@ pub const RenameFile = struct { /// Delete file operation pub const DeleteFile = struct { - pub const tres_null_meaning = .{ - .options = .field, - - // Extends ResourceOperation - .annotationId = .field, - }; - /// A delete - comptime kind: []const u8 = "delete", + kind: []const u8 = "delete", /// The file to delete. uri: DocumentUri, /// Delete options. options: ?DeleteFileOptions = null, + // Extends ResourceOperation /// An optional annotation identifier describing the operation. /// @@ -4833,11 +3864,6 @@ pub const DeleteFile = struct { /// /// @since 3.16.0 pub const ChangeAnnotation = struct { - pub const tres_null_meaning = .{ - .needsConfirmation = .field, - .description = .field, - }; - /// A human-readable string describing the actual change. The string /// is rendered prominent in the user interface. label: []const u8, @@ -4854,10 +3880,6 @@ pub const ChangeAnnotation = struct { /// /// @since 3.16.0 pub const FileOperationFilter = struct { - pub const tres_null_meaning = .{ - .scheme = .field, - }; - /// A Uri scheme like `file` or `untitled`. scheme: ?[]const u8 = null, /// The actual file operation pattern. @@ -4868,8 +3890,6 @@ pub const FileOperationFilter = struct { /// /// @since 3.16.0 pub const FileRename = struct { - pub const tres_null_meaning = .{}; - /// A file:// URI for the original location of the file/folder being renamed. oldUri: []const u8, /// A file:// URI for the new location of the file/folder being renamed. @@ -4880,18 +3900,11 @@ pub const FileRename = struct { /// /// @since 3.16.0 pub const FileDelete = struct { - pub const tres_null_meaning = .{}; - /// A file:// URI for the location of the file/folder being deleted. uri: []const u8, }; pub const MonikerOptions = struct { - pub const tres_null_meaning = .{ - - // Uses mixin WorkDoneProgressOptions - .workDoneProgress = .field, - }; // Uses mixin WorkDoneProgressOptions workDoneProgress: ?bool = null, @@ -4901,11 +3914,6 @@ pub const MonikerOptions = struct { /// /// @since 3.17.0 pub const TypeHierarchyOptions = struct { - pub const tres_null_meaning = .{ - - // Uses mixin WorkDoneProgressOptions - .workDoneProgress = .field, - }; // Uses mixin WorkDoneProgressOptions workDoneProgress: ?bool = null, @@ -4913,8 +3921,6 @@ pub const TypeHierarchyOptions = struct { /// @since 3.17.0 pub const InlineValueContext = struct { - pub const tres_null_meaning = .{}; - /// The stack frame (as a DAP Id) where the execution has stopped. frameId: i32, /// The document range where execution has stopped. @@ -4926,8 +3932,6 @@ pub const InlineValueContext = struct { /// /// @since 3.17.0 pub const InlineValueText = struct { - pub const tres_null_meaning = .{}; - /// The document range for which the inline value applies. range: Range, /// The text of the inline value. @@ -4940,10 +3944,6 @@ pub const InlineValueText = struct { /// /// @since 3.17.0 pub const InlineValueVariableLookup = struct { - pub const tres_null_meaning = .{ - .variableName = .field, - }; - /// The document range for which the inline value applies. /// The range is used to extract the variable name from the underlying document. range: Range, @@ -4959,10 +3959,6 @@ pub const InlineValueVariableLookup = struct { /// /// @since 3.17.0 pub const InlineValueEvaluatableExpression = struct { - pub const tres_null_meaning = .{ - .expression = .field, - }; - /// The document range for which the inline value applies. /// The range is used to extract the evaluatable expression from the underlying document. range: Range, @@ -4974,11 +3970,6 @@ pub const InlineValueEvaluatableExpression = struct { /// /// @since 3.17.0 pub const InlineValueOptions = struct { - pub const tres_null_meaning = .{ - - // Uses mixin WorkDoneProgressOptions - .workDoneProgress = .field, - }; // Uses mixin WorkDoneProgressOptions workDoneProgress: ?bool = null, @@ -4989,12 +3980,6 @@ pub const InlineValueOptions = struct { /// /// @since 3.17.0 pub const InlayHintLabelPart = struct { - pub const tres_null_meaning = .{ - .tooltip = .field, - .location = .field, - .command = .field, - }; - /// The value of this label part. value: []const u8, /// The tooltip text when you hover over this label part. Depending on @@ -5003,6 +3988,7 @@ pub const InlayHintLabelPart = struct { tooltip: ?union(enum) { string: []const u8, MarkupContent: MarkupContent, + pub usingnamespace UnionParser(@This()); } = null, /// An optional source code location that represents this /// label part. @@ -5046,8 +4032,6 @@ pub const InlayHintLabelPart = struct { /// *Please Note* that clients might sanitize the return markdown. A client could decide to /// remove HTML from the markdown to avoid script execution. pub const MarkupContent = struct { - pub const tres_null_meaning = .{}; - /// The type of the Markup kind: MarkupKind, /// The content itself @@ -5058,16 +4042,10 @@ pub const MarkupContent = struct { /// /// @since 3.17.0 pub const InlayHintOptions = struct { - pub const tres_null_meaning = .{ - .resolveProvider = .field, - - // Uses mixin WorkDoneProgressOptions - .workDoneProgress = .field, - }; - /// The server provides support to resolve additional /// information for an inlay hint item. resolveProvider: ?bool = null, + // Uses mixin WorkDoneProgressOptions workDoneProgress: ?bool = null, }; @@ -5076,13 +4054,6 @@ pub const InlayHintOptions = struct { /// /// @since 3.17.0 pub const RelatedFullDocumentDiagnosticReport = struct { - pub const tres_null_meaning = .{ - .relatedDocuments = .field, - - // Extends FullDocumentDiagnosticReport - .resultId = .field, - }; - /// Diagnostics of related documents. This information is useful /// in programming languages where code in a file A can generate /// diagnostics in a file B which A depends on. An example of @@ -5093,10 +4064,12 @@ pub const RelatedFullDocumentDiagnosticReport = struct { relatedDocuments: ?Map(DocumentUri, union(enum) { FullDocumentDiagnosticReport: FullDocumentDiagnosticReport, UnchangedDocumentDiagnosticReport: UnchangedDocumentDiagnosticReport, + pub usingnamespace UnionParser(@This()); }) = null, + // Extends FullDocumentDiagnosticReport /// A full document diagnostic report. - comptime kind: []const u8 = "full", + kind: []const u8 = "full", /// An optional result id. If provided it will /// be sent on the next diagnostic request for the /// same document. @@ -5109,13 +4082,6 @@ pub const RelatedFullDocumentDiagnosticReport = struct { /// /// @since 3.17.0 pub const RelatedUnchangedDocumentDiagnosticReport = struct { - pub const tres_null_meaning = .{ - .relatedDocuments = .field, - - // Extends UnchangedDocumentDiagnosticReport - - }; - /// Diagnostics of related documents. This information is useful /// in programming languages where code in a file A can generate /// diagnostics in a file B which A depends on. An example of @@ -5126,13 +4092,15 @@ pub const RelatedUnchangedDocumentDiagnosticReport = struct { relatedDocuments: ?Map(DocumentUri, union(enum) { FullDocumentDiagnosticReport: FullDocumentDiagnosticReport, UnchangedDocumentDiagnosticReport: UnchangedDocumentDiagnosticReport, + pub usingnamespace UnionParser(@This()); }) = null, + // Extends UnchangedDocumentDiagnosticReport /// A document diagnostic report indicating /// no changes to the last result. A server can /// only return `unchanged` if result ids are /// provided. - comptime kind: []const u8 = "unchanged", + kind: []const u8 = "unchanged", /// A result id which will be sent on the next /// diagnostic request for the same document. resultId: []const u8, @@ -5142,12 +4110,8 @@ pub const RelatedUnchangedDocumentDiagnosticReport = struct { /// /// @since 3.17.0 pub const FullDocumentDiagnosticReport = struct { - pub const tres_null_meaning = .{ - .resultId = .field, - }; - /// A full document diagnostic report. - comptime kind: []const u8 = "full", + kind: []const u8 = "full", /// An optional result id. If provided it will /// be sent on the next diagnostic request for the /// same document. @@ -5161,13 +4125,11 @@ pub const FullDocumentDiagnosticReport = struct { /// /// @since 3.17.0 pub const UnchangedDocumentDiagnosticReport = struct { - pub const tres_null_meaning = .{}; - /// A document diagnostic report indicating /// no changes to the last result. A server can /// only return `unchanged` if result ids are /// provided. - comptime kind: []const u8 = "unchanged", + kind: []const u8 = "unchanged", /// A result id which will be sent on the next /// diagnostic request for the same document. resultId: []const u8, @@ -5177,13 +4139,6 @@ pub const UnchangedDocumentDiagnosticReport = struct { /// /// @since 3.17.0 pub const DiagnosticOptions = struct { - pub const tres_null_meaning = .{ - .identifier = .field, - - // Uses mixin WorkDoneProgressOptions - .workDoneProgress = .field, - }; - /// An optional identifier under which the diagnostics are /// managed by the client. identifier: ?[]const u8 = null, @@ -5194,6 +4149,7 @@ pub const DiagnosticOptions = struct { interFileDependencies: bool, /// The server provides support for workspace diagnostics as well. workspaceDiagnostics: bool, + // Uses mixin WorkDoneProgressOptions workDoneProgress: ?bool = null, }; @@ -5202,8 +4158,6 @@ pub const DiagnosticOptions = struct { /// /// @since 3.17.0 pub const PreviousResultId = struct { - pub const tres_null_meaning = .{}; - /// The URI for which the client knowns a /// result id. uri: DocumentUri, @@ -5215,10 +4169,6 @@ pub const PreviousResultId = struct { /// /// @since 3.17.0 pub const NotebookDocument = struct { - pub const tres_null_meaning = .{ - .metadata = .field, - }; - /// The notebook document's uri. uri: URI, /// The type of the notebook. @@ -5238,8 +4188,6 @@ pub const NotebookDocument = struct { /// An item to transfer a text document from the client to the /// server. pub const TextDocumentItem = struct { - pub const tres_null_meaning = .{}; - /// The text document's uri. uri: DocumentUri, /// The text document's language identifier. @@ -5255,8 +4203,6 @@ pub const TextDocumentItem = struct { /// /// @since 3.17.0 pub const VersionedNotebookDocumentIdentifier = struct { - pub const tres_null_meaning = .{}; - /// The version number of this notebook document. version: i32, /// The notebook document's uri. @@ -5267,31 +4213,15 @@ pub const VersionedNotebookDocumentIdentifier = struct { /// /// @since 3.17.0 pub const NotebookDocumentChangeEvent = struct { - pub const tres_null_meaning = .{ - .metadata = .field, - .cells = .field, - }; - /// The changed meta data if any. /// /// Note: should always be an object literal (e.g. LSPObject) metadata: ?LSPObject = null, /// Changes to cells cells: ?struct { - pub const tres_null_meaning = .{ - .structure = .field, - .data = .field, - .textContent = .field, - }; - /// Changes to the cell structure to add or /// remove cells. structure: ?struct { - pub const tres_null_meaning = .{ - .didOpen = .field, - .didClose = .field, - }; - /// The change to the cell array. array: NotebookCellArrayChange, /// Additional opened cell text documents. @@ -5304,8 +4234,6 @@ pub const NotebookDocumentChangeEvent = struct { data: ?[]const NotebookCell = null, /// Changes to the text content of notebook cells. textContent: ?[]const struct { - pub const tres_null_meaning = .{}; - document: VersionedTextDocumentIdentifier, changes: []const TextDocumentContentChangeEvent, } = null, @@ -5316,18 +4244,50 @@ pub const NotebookDocumentChangeEvent = struct { /// /// @since 3.17.0 pub const NotebookDocumentIdentifier = struct { - pub const tres_null_meaning = .{}; - /// The notebook document's uri. uri: URI, }; +/// Provides information about the context in which an inline completion was requested. +/// +/// @since 3.18.0 +/// @proposed +pub const InlineCompletionContext = struct { + /// Describes how the inline completion was triggered. + triggerKind: InlineCompletionTriggerKind, + /// Provides information about the currently selected item in the autocomplete widget if it is visible. + selectedCompletionInfo: ?SelectedCompletionInfo = null, +}; + +/// A string value used as a snippet is a template which allows to insert text +/// and to control the editor cursor when insertion happens. +/// +/// A snippet can define tab stops and placeholders with `$1`, `$2` +/// and `${3:foo}`. `$0` defines the final tab stop, it defaults to +/// the end of the snippet. Variables are defined with `$name` and +/// `${name:default value}`. +/// +/// @since 3.18.0 +/// @proposed +pub const StringValue = struct { + /// The kind of string value. + kind: []const u8 = "snippet", + /// The snippet string. + value: []const u8, +}; + +/// Inline completion options used during static registration. +/// +/// @since 3.18.0 +/// @proposed +pub const InlineCompletionOptions = struct { + + // Uses mixin WorkDoneProgressOptions + workDoneProgress: ?bool = null, +}; + /// General parameters to register for a notification or to register a provider. pub const Registration = struct { - pub const tres_null_meaning = .{ - .registerOptions = .field, - }; - /// The id used to register the request. The id can be used to deregister /// the request again. id: []const u8, @@ -5339,8 +4299,6 @@ pub const Registration = struct { /// General parameters to unregister a request or notification. pub const Unregistration = struct { - pub const tres_null_meaning = .{}; - /// The id used to unregister the request or notification. Usually an id /// provided during the register request. id: []const u8, @@ -5350,19 +4308,6 @@ pub const Unregistration = struct { /// The initialize parameters pub const _InitializeParams = struct { - pub const tres_null_meaning = .{ - .processId = .value, - .clientInfo = .field, - .locale = .field, - .rootPath = .dual, - .rootUri = .value, - .initializationOptions = .field, - .trace = .field, - - // Uses mixin WorkDoneProgressParams - .workDoneToken = .field, - }; - /// The process Id of the parent process that started /// the server. /// @@ -5373,10 +4318,6 @@ pub const _InitializeParams = struct { /// /// @since 3.15.0 clientInfo: ?struct { - pub const tres_null_meaning = .{ - .version = .field, - }; - /// The name of the client as defined by the client. name: []const u8, /// The client's version as defined by the client. @@ -5408,16 +4349,13 @@ pub const _InitializeParams = struct { initializationOptions: ?LSPAny = null, /// The initial trace setting. If omitted trace is disabled ('off'). trace: ?TraceValues = null, + // Uses mixin WorkDoneProgressParams /// An optional token that a server can use to report work done progress. workDoneToken: ?ProgressToken = null, }; pub const WorkspaceFoldersInitializeParams = struct { - pub const tres_null_meaning = .{ - .workspaceFolders = .dual, - }; - /// The workspace folders configured in the client when the server starts. /// /// This property is only available if the client supports workspace folders. @@ -5431,44 +4369,6 @@ pub const WorkspaceFoldersInitializeParams = struct { /// Defines the capabilities provided by a language /// server. pub const ServerCapabilities = struct { - pub const tres_null_meaning = .{ - .positionEncoding = .field, - .textDocumentSync = .field, - .notebookDocumentSync = .field, - .completionProvider = .field, - .hoverProvider = .field, - .signatureHelpProvider = .field, - .declarationProvider = .field, - .definitionProvider = .field, - .typeDefinitionProvider = .field, - .implementationProvider = .field, - .referencesProvider = .field, - .documentHighlightProvider = .field, - .documentSymbolProvider = .field, - .codeActionProvider = .field, - .codeLensProvider = .field, - .documentLinkProvider = .field, - .colorProvider = .field, - .workspaceSymbolProvider = .field, - .documentFormattingProvider = .field, - .documentRangeFormattingProvider = .field, - .documentOnTypeFormattingProvider = .field, - .renameProvider = .field, - .foldingRangeProvider = .field, - .selectionRangeProvider = .field, - .executeCommandProvider = .field, - .callHierarchyProvider = .field, - .linkedEditingRangeProvider = .field, - .semanticTokensProvider = .field, - .monikerProvider = .field, - .typeHierarchyProvider = .field, - .inlineValueProvider = .field, - .inlayHintProvider = .field, - .diagnosticProvider = .field, - .workspace = .field, - .experimental = .field, - }; - /// The position encoding the server picked from the encodings offered /// by the client via the client capability `general.positionEncodings`. /// @@ -5485,6 +4385,7 @@ pub const ServerCapabilities = struct { textDocumentSync: ?union(enum) { TextDocumentSyncOptions: TextDocumentSyncOptions, TextDocumentSyncKind: TextDocumentSyncKind, + pub usingnamespace UnionParser(@This()); } = null, /// Defines how notebook documents are synced. /// @@ -5492,6 +4393,7 @@ pub const ServerCapabilities = struct { notebookDocumentSync: ?union(enum) { NotebookDocumentSyncOptions: NotebookDocumentSyncOptions, NotebookDocumentSyncRegistrationOptions: NotebookDocumentSyncRegistrationOptions, + pub usingnamespace UnionParser(@This()); } = null, /// The server provides completion support. completionProvider: ?CompletionOptions = null, @@ -5499,6 +4401,7 @@ pub const ServerCapabilities = struct { hoverProvider: ?union(enum) { bool: bool, HoverOptions: HoverOptions, + pub usingnamespace UnionParser(@This()); } = null, /// The server provides signature help support. signatureHelpProvider: ?SignatureHelpOptions = null, @@ -5507,38 +4410,45 @@ pub const ServerCapabilities = struct { bool: bool, DeclarationOptions: DeclarationOptions, DeclarationRegistrationOptions: DeclarationRegistrationOptions, + pub usingnamespace UnionParser(@This()); } = null, /// The server provides goto definition support. definitionProvider: ?union(enum) { bool: bool, DefinitionOptions: DefinitionOptions, + pub usingnamespace UnionParser(@This()); } = null, /// The server provides Goto Type Definition support. typeDefinitionProvider: ?union(enum) { bool: bool, TypeDefinitionOptions: TypeDefinitionOptions, TypeDefinitionRegistrationOptions: TypeDefinitionRegistrationOptions, + pub usingnamespace UnionParser(@This()); } = null, /// The server provides Goto Implementation support. implementationProvider: ?union(enum) { bool: bool, ImplementationOptions: ImplementationOptions, ImplementationRegistrationOptions: ImplementationRegistrationOptions, + pub usingnamespace UnionParser(@This()); } = null, /// The server provides find references support. referencesProvider: ?union(enum) { bool: bool, ReferenceOptions: ReferenceOptions, + pub usingnamespace UnionParser(@This()); } = null, /// The server provides document highlight support. documentHighlightProvider: ?union(enum) { bool: bool, DocumentHighlightOptions: DocumentHighlightOptions, + pub usingnamespace UnionParser(@This()); } = null, /// The server provides document symbol support. documentSymbolProvider: ?union(enum) { bool: bool, DocumentSymbolOptions: DocumentSymbolOptions, + pub usingnamespace UnionParser(@This()); } = null, /// The server provides code actions. CodeActionOptions may only be /// specified if the client states that it supports @@ -5546,6 +4456,7 @@ pub const ServerCapabilities = struct { codeActionProvider: ?union(enum) { bool: bool, CodeActionOptions: CodeActionOptions, + pub usingnamespace UnionParser(@This()); } = null, /// The server provides code lens. codeLensProvider: ?CodeLensOptions = null, @@ -5556,21 +4467,25 @@ pub const ServerCapabilities = struct { bool: bool, DocumentColorOptions: DocumentColorOptions, DocumentColorRegistrationOptions: DocumentColorRegistrationOptions, + pub usingnamespace UnionParser(@This()); } = null, /// The server provides workspace symbol support. workspaceSymbolProvider: ?union(enum) { bool: bool, WorkspaceSymbolOptions: WorkspaceSymbolOptions, + pub usingnamespace UnionParser(@This()); } = null, /// The server provides document formatting. documentFormattingProvider: ?union(enum) { bool: bool, DocumentFormattingOptions: DocumentFormattingOptions, + pub usingnamespace UnionParser(@This()); } = null, /// The server provides document range formatting. documentRangeFormattingProvider: ?union(enum) { bool: bool, DocumentRangeFormattingOptions: DocumentRangeFormattingOptions, + pub usingnamespace UnionParser(@This()); } = null, /// The server provides document formatting on typing. documentOnTypeFormattingProvider: ?DocumentOnTypeFormattingOptions = null, @@ -5580,18 +4495,21 @@ pub const ServerCapabilities = struct { renameProvider: ?union(enum) { bool: bool, RenameOptions: RenameOptions, + pub usingnamespace UnionParser(@This()); } = null, /// The server provides folding provider support. foldingRangeProvider: ?union(enum) { bool: bool, FoldingRangeOptions: FoldingRangeOptions, FoldingRangeRegistrationOptions: FoldingRangeRegistrationOptions, + pub usingnamespace UnionParser(@This()); } = null, /// The server provides selection range support. selectionRangeProvider: ?union(enum) { bool: bool, SelectionRangeOptions: SelectionRangeOptions, SelectionRangeRegistrationOptions: SelectionRangeRegistrationOptions, + pub usingnamespace UnionParser(@This()); } = null, /// The server provides execute command support. executeCommandProvider: ?ExecuteCommandOptions = null, @@ -5602,6 +4520,7 @@ pub const ServerCapabilities = struct { bool: bool, CallHierarchyOptions: CallHierarchyOptions, CallHierarchyRegistrationOptions: CallHierarchyRegistrationOptions, + pub usingnamespace UnionParser(@This()); } = null, /// The server provides linked editing range support. /// @@ -5610,6 +4529,7 @@ pub const ServerCapabilities = struct { bool: bool, LinkedEditingRangeOptions: LinkedEditingRangeOptions, LinkedEditingRangeRegistrationOptions: LinkedEditingRangeRegistrationOptions, + pub usingnamespace UnionParser(@This()); } = null, /// The server provides semantic tokens support. /// @@ -5617,6 +4537,7 @@ pub const ServerCapabilities = struct { semanticTokensProvider: ?union(enum) { SemanticTokensOptions: SemanticTokensOptions, SemanticTokensRegistrationOptions: SemanticTokensRegistrationOptions, + pub usingnamespace UnionParser(@This()); } = null, /// The server provides moniker support. /// @@ -5625,6 +4546,7 @@ pub const ServerCapabilities = struct { bool: bool, MonikerOptions: MonikerOptions, MonikerRegistrationOptions: MonikerRegistrationOptions, + pub usingnamespace UnionParser(@This()); } = null, /// The server provides type hierarchy support. /// @@ -5633,6 +4555,7 @@ pub const ServerCapabilities = struct { bool: bool, TypeHierarchyOptions: TypeHierarchyOptions, TypeHierarchyRegistrationOptions: TypeHierarchyRegistrationOptions, + pub usingnamespace UnionParser(@This()); } = null, /// The server provides inline values. /// @@ -5641,6 +4564,7 @@ pub const ServerCapabilities = struct { bool: bool, InlineValueOptions: InlineValueOptions, InlineValueRegistrationOptions: InlineValueRegistrationOptions, + pub usingnamespace UnionParser(@This()); } = null, /// The server provides inlay hints. /// @@ -5649,6 +4573,7 @@ pub const ServerCapabilities = struct { bool: bool, InlayHintOptions: InlayHintOptions, InlayHintRegistrationOptions: InlayHintRegistrationOptions, + pub usingnamespace UnionParser(@This()); } = null, /// The server has support for pull model diagnostics. /// @@ -5656,14 +4581,19 @@ pub const ServerCapabilities = struct { diagnosticProvider: ?union(enum) { DiagnosticOptions: DiagnosticOptions, DiagnosticRegistrationOptions: DiagnosticRegistrationOptions, + pub usingnamespace UnionParser(@This()); + } = null, + /// Inline completion options used during static registration. + /// + /// @since 3.18.0 + /// @proposed + inlineCompletionProvider: ?union(enum) { + bool: bool, + InlineCompletionOptions: InlineCompletionOptions, + pub usingnamespace UnionParser(@This()); } = null, /// Workspace specific server capabilities. workspace: ?struct { - pub const tres_null_meaning = .{ - .workspaceFolders = .field, - .fileOperations = .field, - }; - /// The server supports workspace folder. /// /// @since 3.6.0 @@ -5679,14 +4609,9 @@ pub const ServerCapabilities = struct { /// A text document identifier to denote a specific version of a text document. pub const VersionedTextDocumentIdentifier = struct { - pub const tres_null_meaning = .{ - - // Extends TextDocumentIdentifier - - }; - /// The version number of this document. version: i32, + // Extends TextDocumentIdentifier /// The text document's uri. uri: DocumentUri, @@ -5694,18 +4619,12 @@ pub const VersionedTextDocumentIdentifier = struct { /// Save options. pub const SaveOptions = struct { - pub const tres_null_meaning = .{ - .includeText = .field, - }; - /// The client is supposed to include the content on save. includeText: ?bool = null, }; /// An event describing a file change. pub const FileEvent = struct { - pub const tres_null_meaning = .{}; - /// The file's uri. uri: DocumentUri, /// The change type. @@ -5713,10 +4632,6 @@ pub const FileEvent = struct { }; pub const FileSystemWatcher = struct { - pub const tres_null_meaning = .{ - .kind = .field, - }; - /// The glob pattern to watch. See {@link GlobPattern glob pattern} for more detail. /// /// @since 3.17.0 support for relative patterns. @@ -5730,16 +4645,6 @@ pub const FileSystemWatcher = struct { /// Represents a diagnostic, such as a compiler error or warning. Diagnostic objects /// are only valid in the scope of a resource. pub const Diagnostic = struct { - pub const tres_null_meaning = .{ - .severity = .field, - .code = .field, - .codeDescription = .field, - .source = .field, - .tags = .field, - .relatedInformation = .field, - .data = .field, - }; - /// The range at which the message applies range: Range, /// The diagnostic's severity. Can be omitted. If omitted it is up to the @@ -5749,6 +4654,7 @@ pub const Diagnostic = struct { code: ?union(enum) { integer: i32, string: []const u8, + pub usingnamespace UnionParser(@This()); } = null, /// An optional property to describe the error code. /// Requires the code field (above) to be present/not null. @@ -5777,10 +4683,6 @@ pub const Diagnostic = struct { /// Contains additional information about the context in which a completion request is triggered. pub const CompletionContext = struct { - pub const tres_null_meaning = .{ - .triggerCharacter = .field, - }; - /// How the completion was triggered. triggerKind: CompletionTriggerKind, /// The trigger character (a single character) that has trigger code complete. @@ -5792,11 +4694,6 @@ pub const CompletionContext = struct { /// /// @since 3.17.0 pub const CompletionItemLabelDetails = struct { - pub const tres_null_meaning = .{ - .detail = .field, - .description = .field, - }; - /// An optional string which is rendered less prominently directly after {@link CompletionItem.label label}, /// without any spacing. Should be used for function signatures and type annotations. detail: ?[]const u8 = null, @@ -5809,8 +4706,6 @@ pub const CompletionItemLabelDetails = struct { /// /// @since 3.16.0 pub const InsertReplaceEdit = struct { - pub const tres_null_meaning = .{}; - /// The string to be inserted. newText: []const u8, /// The range if the insert is requested @@ -5821,16 +4716,6 @@ pub const InsertReplaceEdit = struct { /// Completion options. pub const CompletionOptions = struct { - pub const tres_null_meaning = .{ - .triggerCharacters = .field, - .allCommitCharacters = .field, - .resolveProvider = .field, - .completionItem = .field, - - // Uses mixin WorkDoneProgressOptions - .workDoneProgress = .field, - }; - /// Most tools trigger completion request automatically without explicitly requesting /// it using a keyboard shortcut (e.g. Ctrl+Space). Typically they do so when the user /// starts to type an identifier. For example if the user types `c` in a JavaScript file @@ -5857,10 +4742,6 @@ pub const CompletionOptions = struct { /// /// @since 3.17.0 completionItem: ?struct { - pub const tres_null_meaning = .{ - .labelDetailsSupport = .field, - }; - /// The server has support for completion item label /// details (see also `CompletionItemLabelDetails`) when /// receiving a completion item in a resolve call. @@ -5868,17 +4749,13 @@ pub const CompletionOptions = struct { /// @since 3.17.0 labelDetailsSupport: ?bool = null, } = null, + // Uses mixin WorkDoneProgressOptions workDoneProgress: ?bool = null, }; /// Hover options. pub const HoverOptions = struct { - pub const tres_null_meaning = .{ - - // Uses mixin WorkDoneProgressOptions - .workDoneProgress = .field, - }; // Uses mixin WorkDoneProgressOptions workDoneProgress: ?bool = null, @@ -5888,11 +4765,6 @@ pub const HoverOptions = struct { /// /// @since 3.15.0 pub const SignatureHelpContext = struct { - pub const tres_null_meaning = .{ - .triggerCharacter = .field, - .activeSignatureHelp = .field, - }; - /// Action that caused signature help to be triggered. triggerKind: SignatureHelpTriggerKind, /// Character that caused signature help to be triggered. @@ -5915,12 +4787,6 @@ pub const SignatureHelpContext = struct { /// can have a label, like a function-name, a doc-comment, and /// a set of parameters. pub const SignatureInformation = struct { - pub const tres_null_meaning = .{ - .documentation = .field, - .parameters = .field, - .activeParameter = .field, - }; - /// The label of this signature. Will be shown in /// the UI. label: []const u8, @@ -5929,6 +4795,7 @@ pub const SignatureInformation = struct { documentation: ?union(enum) { string: []const u8, MarkupContent: MarkupContent, + pub usingnamespace UnionParser(@This()); } = null, /// The parameters of this signature. parameters: ?[]const ParameterInformation = null, @@ -5942,14 +4809,6 @@ pub const SignatureInformation = struct { /// Server Capabilities for a {@link SignatureHelpRequest}. pub const SignatureHelpOptions = struct { - pub const tres_null_meaning = .{ - .triggerCharacters = .field, - .retriggerCharacters = .field, - - // Uses mixin WorkDoneProgressOptions - .workDoneProgress = .field, - }; - /// List of characters that trigger signature help automatically. triggerCharacters: ?[]const []const u8 = null, /// List of characters that re-trigger signature help. @@ -5959,17 +4818,13 @@ pub const SignatureHelpOptions = struct { /// /// @since 3.15.0 retriggerCharacters: ?[]const []const u8 = null, + // Uses mixin WorkDoneProgressOptions workDoneProgress: ?bool = null, }; /// Server Capabilities for a {@link DefinitionRequest}. pub const DefinitionOptions = struct { - pub const tres_null_meaning = .{ - - // Uses mixin WorkDoneProgressOptions - .workDoneProgress = .field, - }; // Uses mixin WorkDoneProgressOptions workDoneProgress: ?bool = null, @@ -5978,19 +4833,12 @@ pub const DefinitionOptions = struct { /// Value-object that contains additional information when /// requesting references. pub const ReferenceContext = struct { - pub const tres_null_meaning = .{}; - /// Include the declaration of the current symbol. includeDeclaration: bool, }; /// Reference options. pub const ReferenceOptions = struct { - pub const tres_null_meaning = .{ - - // Uses mixin WorkDoneProgressOptions - .workDoneProgress = .field, - }; // Uses mixin WorkDoneProgressOptions workDoneProgress: ?bool = null, @@ -5998,11 +4846,6 @@ pub const ReferenceOptions = struct { /// Provider options for a {@link DocumentHighlightRequest}. pub const DocumentHighlightOptions = struct { - pub const tres_null_meaning = .{ - - // Uses mixin WorkDoneProgressOptions - .workDoneProgress = .field, - }; // Uses mixin WorkDoneProgressOptions workDoneProgress: ?bool = null, @@ -6010,11 +4853,6 @@ pub const DocumentHighlightOptions = struct { /// A base for all symbol information. pub const BaseSymbolInformation = struct { - pub const tres_null_meaning = .{ - .tags = .field, - .containerName = .field, - }; - /// The name of this symbol. name: []const u8, /// The kind of this symbol. @@ -6032,30 +4870,19 @@ pub const BaseSymbolInformation = struct { /// Provider options for a {@link DocumentSymbolRequest}. pub const DocumentSymbolOptions = struct { - pub const tres_null_meaning = .{ - .label = .field, - - // Uses mixin WorkDoneProgressOptions - .workDoneProgress = .field, - }; - /// A human-readable string that is shown when multiple outlines trees /// are shown for the same document. /// /// @since 3.16.0 label: ?[]const u8 = null, + // Uses mixin WorkDoneProgressOptions workDoneProgress: ?bool = null, }; /// Contains additional diagnostic information about the context in which /// a {@link CodeActionProvider.provideCodeActions code action} is run. -pub const CodeActionContext = struct { - pub const tres_null_meaning = .{ - .only = .field, - .triggerKind = .field, - }; - +pub const CodeActionContext = struct { /// An array of diagnostics known on the client side overlapping the range provided to the /// `textDocument/codeAction` request. They are provided so that the server knows which /// errors are currently presented to the user for the given range. There is no guarantee @@ -6075,14 +4902,6 @@ pub const CodeActionContext = struct { /// Provider options for a {@link CodeActionRequest}. pub const CodeActionOptions = struct { - pub const tres_null_meaning = .{ - .codeActionKinds = .field, - .resolveProvider = .field, - - // Uses mixin WorkDoneProgressOptions - .workDoneProgress = .field, - }; - /// CodeActionKinds that this server may return. /// /// The list of kinds may be generic, such as `CodeActionKind.Refactor`, or the server @@ -6093,66 +4912,43 @@ pub const CodeActionOptions = struct { /// /// @since 3.16.0 resolveProvider: ?bool = null, + // Uses mixin WorkDoneProgressOptions workDoneProgress: ?bool = null, }; /// Server capabilities for a {@link WorkspaceSymbolRequest}. pub const WorkspaceSymbolOptions = struct { - pub const tres_null_meaning = .{ - .resolveProvider = .field, - - // Uses mixin WorkDoneProgressOptions - .workDoneProgress = .field, - }; - /// The server provides support to resolve additional /// information for a workspace symbol. /// /// @since 3.17.0 resolveProvider: ?bool = null, + // Uses mixin WorkDoneProgressOptions workDoneProgress: ?bool = null, }; /// Code Lens provider options of a {@link CodeLensRequest}. pub const CodeLensOptions = struct { - pub const tres_null_meaning = .{ - .resolveProvider = .field, - - // Uses mixin WorkDoneProgressOptions - .workDoneProgress = .field, - }; - /// Code lens has a resolve provider as well. resolveProvider: ?bool = null, + // Uses mixin WorkDoneProgressOptions workDoneProgress: ?bool = null, }; /// Provider options for a {@link DocumentLinkRequest}. pub const DocumentLinkOptions = struct { - pub const tres_null_meaning = .{ - .resolveProvider = .field, - - // Uses mixin WorkDoneProgressOptions - .workDoneProgress = .field, - }; - /// Document links have a resolve provider as well. resolveProvider: ?bool = null, + // Uses mixin WorkDoneProgressOptions workDoneProgress: ?bool = null, }; /// Value-object describing what options formatting should use. pub const FormattingOptions = struct { - pub const tres_null_meaning = .{ - .trimTrailingWhitespace = .field, - .insertFinalNewline = .field, - .trimFinalNewlines = .field, - }; - /// Size of a tab in spaces. tabSize: u32, /// Prefer spaces over tabs. @@ -6173,11 +4969,6 @@ pub const FormattingOptions = struct { /// Provider options for a {@link DocumentFormattingRequest}. pub const DocumentFormattingOptions = struct { - pub const tres_null_meaning = .{ - - // Uses mixin WorkDoneProgressOptions - .workDoneProgress = .field, - }; // Uses mixin WorkDoneProgressOptions workDoneProgress: ?bool = null, @@ -6185,11 +4976,11 @@ pub const DocumentFormattingOptions = struct { /// Provider options for a {@link DocumentRangeFormattingRequest}. pub const DocumentRangeFormattingOptions = struct { - pub const tres_null_meaning = .{ - - // Uses mixin WorkDoneProgressOptions - .workDoneProgress = .field, - }; + /// Whether the server supports formatting multiple ranges at once. + /// + /// @since 3.18.0 + /// @proposed + rangesSupport: ?bool = null, // Uses mixin WorkDoneProgressOptions workDoneProgress: ?bool = null, @@ -6197,10 +4988,6 @@ pub const DocumentRangeFormattingOptions = struct { /// Provider options for a {@link DocumentOnTypeFormattingRequest}. pub const DocumentOnTypeFormattingOptions = struct { - pub const tres_null_meaning = .{ - .moreTriggerCharacter = .field, - }; - /// A character on which formatting should be triggered, like `{`. firstTriggerCharacter: []const u8, /// More trigger characters. @@ -6209,39 +4996,26 @@ pub const DocumentOnTypeFormattingOptions = struct { /// Provider options for a {@link RenameRequest}. pub const RenameOptions = struct { - pub const tres_null_meaning = .{ - .prepareProvider = .field, - - // Uses mixin WorkDoneProgressOptions - .workDoneProgress = .field, - }; - /// Renames should be checked and tested before being executed. /// /// @since version 3.12.0 prepareProvider: ?bool = null, + // Uses mixin WorkDoneProgressOptions workDoneProgress: ?bool = null, }; /// The server capabilities of a {@link ExecuteCommandRequest}. pub const ExecuteCommandOptions = struct { - pub const tres_null_meaning = .{ - - // Uses mixin WorkDoneProgressOptions - .workDoneProgress = .field, - }; - /// The commands to be executed on the server commands: []const []const u8, + // Uses mixin WorkDoneProgressOptions workDoneProgress: ?bool = null, }; /// @since 3.16.0 pub const SemanticTokensLegend = struct { - pub const tres_null_meaning = .{}; - /// The token types a server uses. tokenTypes: []const []const u8, /// The token modifiers a server uses. @@ -6250,19 +5024,13 @@ pub const SemanticTokensLegend = struct { /// A text document identifier to optionally denote a specific version of a text document. pub const OptionalVersionedTextDocumentIdentifier = struct { - pub const tres_null_meaning = .{ - .version = .value, - - // Extends TextDocumentIdentifier - - }; - /// The version number of this document. If a versioned text document identifier /// is sent from the server to the client and the file is not open in the editor /// (the server has not received an open notification before) the server can send /// `null` to indicate that the version is unknown and the content on disk is the /// truth (as specified with document content ownership). version: ?i32 = null, + // Extends TextDocumentIdentifier /// The text document's uri. uri: DocumentUri, @@ -6272,14 +5040,9 @@ pub const OptionalVersionedTextDocumentIdentifier = struct { /// /// @since 3.16.0. pub const AnnotatedTextEdit = struct { - pub const tres_null_meaning = .{ - - // Extends TextEdit - - }; - /// The actual identifier of the change annotation annotationId: ChangeAnnotationIdentifier, + // Extends TextEdit /// The range of the text document to be manipulated. To insert /// text into a document create a range where start === end. @@ -6291,10 +5054,6 @@ pub const AnnotatedTextEdit = struct { /// A generic resource operation. pub const ResourceOperation = struct { - pub const tres_null_meaning = .{ - .annotationId = .field, - }; - /// The resource operation kind. kind: []const u8, /// An optional annotation identifier describing the operation. @@ -6305,11 +5064,6 @@ pub const ResourceOperation = struct { /// Options to create a file. pub const CreateFileOptions = struct { - pub const tres_null_meaning = .{ - .overwrite = .field, - .ignoreIfExists = .field, - }; - /// Overwrite existing file. Overwrite wins over `ignoreIfExists` overwrite: ?bool = null, /// Ignore if exists. @@ -6318,11 +5072,6 @@ pub const CreateFileOptions = struct { /// Rename file options pub const RenameFileOptions = struct { - pub const tres_null_meaning = .{ - .overwrite = .field, - .ignoreIfExists = .field, - }; - /// Overwrite target if existing. Overwrite wins over `ignoreIfExists` overwrite: ?bool = null, /// Ignores if target exists. @@ -6331,11 +5080,6 @@ pub const RenameFileOptions = struct { /// Delete file options pub const DeleteFileOptions = struct { - pub const tres_null_meaning = .{ - .recursive = .field, - .ignoreIfNotExists = .field, - }; - /// Delete the content recursively if a folder is denoted. recursive: ?bool = null, /// Ignore the operation if the file doesn't exist. @@ -6347,11 +5091,6 @@ pub const DeleteFileOptions = struct { /// /// @since 3.16.0 pub const FileOperationPattern = struct { - pub const tres_null_meaning = .{ - .matches = .field, - .options = .field, - }; - /// The glob pattern to match. Glob patterns can have the following syntax: /// - `*` to match one or more characters in a path segment /// - `?` to match on one character in a path segment @@ -6372,21 +5111,15 @@ pub const FileOperationPattern = struct { /// /// @since 3.17.0 pub const WorkspaceFullDocumentDiagnosticReport = struct { - pub const tres_null_meaning = .{ - .version = .value, - - // Extends FullDocumentDiagnosticReport - .resultId = .field, - }; - /// The URI for which diagnostic information is reported. uri: DocumentUri, /// The version number for which the diagnostics are reported. /// If the document is not marked as open `null` can be provided. version: ?i32 = null, + // Extends FullDocumentDiagnosticReport /// A full document diagnostic report. - comptime kind: []const u8 = "full", + kind: []const u8 = "full", /// An optional result id. If provided it will /// be sent on the next diagnostic request for the /// same document. @@ -6399,24 +5132,18 @@ pub const WorkspaceFullDocumentDiagnosticReport = struct { /// /// @since 3.17.0 pub const WorkspaceUnchangedDocumentDiagnosticReport = struct { - pub const tres_null_meaning = .{ - .version = .value, - - // Extends UnchangedDocumentDiagnosticReport - - }; - /// The URI for which diagnostic information is reported. uri: DocumentUri, /// The version number for which the diagnostics are reported. /// If the document is not marked as open `null` can be provided. version: ?i32 = null, + // Extends UnchangedDocumentDiagnosticReport /// A document diagnostic report indicating /// no changes to the last result. A server can /// only return `unchanged` if result ids are /// provided. - comptime kind: []const u8 = "unchanged", + kind: []const u8 = "unchanged", /// A result id which will be sent on the next /// diagnostic request for the same document. resultId: []const u8, @@ -6430,11 +5157,6 @@ pub const WorkspaceUnchangedDocumentDiagnosticReport = struct { /// /// @since 3.17.0 pub const NotebookCell = struct { - pub const tres_null_meaning = .{ - .metadata = .field, - .executionSummary = .field, - }; - /// The cell's kind kind: NotebookCellKind, /// The URI of the cell's text document @@ -6454,10 +5176,6 @@ pub const NotebookCell = struct { /// /// @since 3.17.0 pub const NotebookCellArrayChange = struct { - pub const tres_null_meaning = .{ - .cells = .field, - }; - /// The start oftest of the cell that changed. start: u32, /// The deleted cells @@ -6466,17 +5184,19 @@ pub const NotebookCellArrayChange = struct { cells: ?[]const NotebookCell = null, }; +/// Describes the currently selected completion item. +/// +/// @since 3.18.0 +/// @proposed +pub const SelectedCompletionInfo = struct { + /// The range that will be replaced if this completion item is accepted. + range: Range, + /// The text the range will be replaced with if this completion is accepted. + text: []const u8, +}; + /// Defines the capabilities provided by the client. pub const ClientCapabilities = struct { - pub const tres_null_meaning = .{ - .workspace = .field, - .textDocument = .field, - .notebookDocument = .field, - .window = .field, - .general = .field, - .experimental = .field, - }; - /// Workspace specific client capabilities. workspace: ?WorkspaceClientCapabilities = null, /// Text document specific client capabilities. @@ -6496,14 +5216,6 @@ pub const ClientCapabilities = struct { }; pub const TextDocumentSyncOptions = struct { - pub const tres_null_meaning = .{ - .openClose = .field, - .change = .field, - .willSave = .field, - .willSaveWaitUntil = .field, - .save = .field, - }; - /// Open and close notifications are sent to the server. If omitted open close notification should not /// be sent. openClose: ?bool = null, @@ -6521,6 +5233,7 @@ pub const TextDocumentSyncOptions = struct { save: ?union(enum) { bool: bool, SaveOptions: SaveOptions, + pub usingnamespace UnionParser(@This()); } = null, }; @@ -6538,50 +5251,37 @@ pub const TextDocumentSyncOptions = struct { /// /// @since 3.17.0 pub const NotebookDocumentSyncOptions = struct { - pub const tres_null_meaning = .{ - .save = .field, - }; - /// The notebooks to be synced notebookSelector: []const union(enum) { literal_0: struct { - pub const tres_null_meaning = .{ - .cells = .field, - }; - /// The notebook to be synced If a string /// value is provided it matches against the /// notebook type. '*' matches every notebook. notebook: union(enum) { string: []const u8, NotebookDocumentFilter: NotebookDocumentFilter, + pub usingnamespace UnionParser(@This()); }, /// The cells of the matching notebook to be synced. cells: ?[]const struct { - pub const tres_null_meaning = .{}; - language: []const u8, } = null, }, literal_1: struct { - pub const tres_null_meaning = .{ - .notebook = .field, - }; - /// The notebook to be synced If a string /// value is provided it matches against the /// notebook type. '*' matches every notebook. notebook: ?union(enum) { string: []const u8, NotebookDocumentFilter: NotebookDocumentFilter, + pub usingnamespace UnionParser(@This()); } = null, /// The cells of the matching notebook to be synced. cells: []const struct { - pub const tres_null_meaning = .{}; - language: []const u8, }, }, + pub usingnamespace UnionParser(@This()); }, /// Whether save notification should be forwarded to /// the server. Will only be honored if mode === `notebook`. @@ -6592,56 +5292,39 @@ pub const NotebookDocumentSyncOptions = struct { /// /// @since 3.17.0 pub const NotebookDocumentSyncRegistrationOptions = struct { - pub const tres_null_meaning = .{ - - // Extends NotebookDocumentSyncOptions - .save = .field, - - // Uses mixin StaticRegistrationOptions - .id = .field, - }; // Extends NotebookDocumentSyncOptions /// The notebooks to be synced notebookSelector: []const union(enum) { literal_0: struct { - pub const tres_null_meaning = .{ - .cells = .field, - }; - /// The notebook to be synced If a string /// value is provided it matches against the /// notebook type. '*' matches every notebook. notebook: union(enum) { string: []const u8, NotebookDocumentFilter: NotebookDocumentFilter, + pub usingnamespace UnionParser(@This()); }, /// The cells of the matching notebook to be synced. cells: ?[]const struct { - pub const tres_null_meaning = .{}; - language: []const u8, } = null, }, literal_1: struct { - pub const tres_null_meaning = .{ - .notebook = .field, - }; - /// The notebook to be synced If a string /// value is provided it matches against the /// notebook type. '*' matches every notebook. notebook: ?union(enum) { string: []const u8, NotebookDocumentFilter: NotebookDocumentFilter, + pub usingnamespace UnionParser(@This()); } = null, /// The cells of the matching notebook to be synced. cells: []const struct { - pub const tres_null_meaning = .{}; - language: []const u8, }, }, + pub usingnamespace UnionParser(@This()); }, /// Whether save notification should be forwarded to /// the server. Will only be honored if mode === `notebook`. @@ -6654,11 +5337,6 @@ pub const NotebookDocumentSyncRegistrationOptions = struct { }; pub const WorkspaceFoldersServerCapabilities = struct { - pub const tres_null_meaning = .{ - .supported = .field, - .changeNotifications = .field, - }; - /// The server has support for workspace folders supported: ?bool = null, /// Whether the server wants to receive workspace folder @@ -6671,6 +5349,7 @@ pub const WorkspaceFoldersServerCapabilities = struct { changeNotifications: ?union(enum) { string: []const u8, bool: bool, + pub usingnamespace UnionParser(@This()); } = null, }; @@ -6678,15 +5357,6 @@ pub const WorkspaceFoldersServerCapabilities = struct { /// /// @since 3.16.0 pub const FileOperationOptions = struct { - pub const tres_null_meaning = .{ - .didCreate = .field, - .willCreate = .field, - .didRename = .field, - .willRename = .field, - .didDelete = .field, - .willDelete = .field, - }; - /// The server is interested in receiving didCreateFiles notifications. didCreate: ?FileOperationRegistrationOptions = null, /// The server is interested in receiving willCreateFiles requests. @@ -6705,8 +5375,6 @@ pub const FileOperationOptions = struct { /// /// @since 3.16.0 pub const CodeDescription = struct { - pub const tres_null_meaning = .{}; - /// An URI to open with more information about the diagnostic error. href: URI, }; @@ -6715,8 +5383,6 @@ pub const CodeDescription = struct { /// used to point to code locations that cause or related to a diagnostics, e.g when duplicating /// a symbol in a scope. pub const DiagnosticRelatedInformation = struct { - pub const tres_null_meaning = .{}; - /// The location of this related diagnostic information. location: Location, /// The message of this related diagnostic information. @@ -6726,10 +5392,6 @@ pub const DiagnosticRelatedInformation = struct { /// Represents a parameter of a callable-signature. A parameter can /// have a label and a doc-comment. pub const ParameterInformation = struct { - pub const tres_null_meaning = .{ - .documentation = .field, - }; - /// The label of this parameter information. /// /// Either a string or an inclusive start and exclusive end offsets within its containing @@ -6741,12 +5403,14 @@ pub const ParameterInformation = struct { label: union(enum) { string: []const u8, tuple_1: struct { u32, u32 }, + pub usingnamespace UnionParser(@This()); }, /// The human-readable doc-comment of this parameter. Will be shown /// in the UI but can be omitted. documentation: ?union(enum) { string: []const u8, MarkupContent: MarkupContent, + pub usingnamespace UnionParser(@This()); } = null, }; @@ -6755,10 +5419,6 @@ pub const ParameterInformation = struct { /// /// @since 3.17.0 pub const NotebookCellTextDocumentFilter = struct { - pub const tres_null_meaning = .{ - .language = .field, - }; - /// A filter that matches against the notebook /// containing the notebook cell. If a string /// value is provided it matches against the @@ -6766,6 +5426,7 @@ pub const NotebookCellTextDocumentFilter = struct { notebook: union(enum) { string: []const u8, NotebookDocumentFilter: NotebookDocumentFilter, + pub usingnamespace UnionParser(@This()); }, /// A language id like `python`. /// @@ -6778,19 +5439,11 @@ pub const NotebookCellTextDocumentFilter = struct { /// /// @since 3.16.0 pub const FileOperationPatternOptions = struct { - pub const tres_null_meaning = .{ - .ignoreCase = .field, - }; - /// The pattern should be matched ignoring casing. ignoreCase: ?bool = null, }; pub const ExecutionSummary = struct { - pub const tres_null_meaning = .{ - .success = .field, - }; - /// A strict monotonically increasing value /// indicating the execution order of a cell /// inside a notebook. @@ -6802,23 +5455,6 @@ pub const ExecutionSummary = struct { /// Workspace specific client capabilities. pub const WorkspaceClientCapabilities = struct { - pub const tres_null_meaning = .{ - .applyEdit = .field, - .workspaceEdit = .field, - .didChangeConfiguration = .field, - .didChangeWatchedFiles = .field, - .symbol = .field, - .executeCommand = .field, - .workspaceFolders = .field, - .configuration = .field, - .semanticTokens = .field, - .codeLens = .field, - .fileOperations = .field, - .inlineValue = .field, - .inlayHint = .field, - .diagnostics = .field, - }; - /// The client supports applying batch edits /// to the workspace by supporting the request /// 'workspace/applyEdit' @@ -6874,39 +5510,6 @@ pub const WorkspaceClientCapabilities = struct { /// Text document specific client capabilities. pub const TextDocumentClientCapabilities = struct { - pub const tres_null_meaning = .{ - .synchronization = .field, - .completion = .field, - .hover = .field, - .signatureHelp = .field, - .declaration = .field, - .definition = .field, - .typeDefinition = .field, - .implementation = .field, - .references = .field, - .documentHighlight = .field, - .documentSymbol = .field, - .codeAction = .field, - .codeLens = .field, - .documentLink = .field, - .colorProvider = .field, - .formatting = .field, - .rangeFormatting = .field, - .onTypeFormatting = .field, - .rename = .field, - .foldingRange = .field, - .selectionRange = .field, - .publishDiagnostics = .field, - .callHierarchy = .field, - .semanticTokens = .field, - .linkedEditingRange = .field, - .moniker = .field, - .typeHierarchy = .field, - .inlineValue = .field, - .inlayHint = .field, - .diagnostic = .field, - }; - /// Defines which synchronization capabilities the client supports. synchronization: ?TextDocumentSyncClientCapabilities = null, /// Capabilities specific to the `textDocument/completion` request. @@ -6996,14 +5599,17 @@ pub const TextDocumentClientCapabilities = struct { /// /// @since 3.17.0 diagnostic: ?DiagnosticClientCapabilities = null, + /// Client capabilities specific to inline completions. + /// + /// @since 3.18.0 + /// @proposed + inlineCompletion: ?InlineCompletionClientCapabilities = null, }; /// Capabilities specific to the notebook document support. /// /// @since 3.17.0 pub const NotebookDocumentClientCapabilities = struct { - pub const tres_null_meaning = .{}; - /// Capabilities specific to notebook document synchronization /// /// @since 3.17.0 @@ -7011,12 +5617,6 @@ pub const NotebookDocumentClientCapabilities = struct { }; pub const WindowClientCapabilities = struct { - pub const tres_null_meaning = .{ - .workDoneProgress = .field, - .showMessage = .field, - .showDocument = .field, - }; - /// It indicates whether the client supports server initiated /// progress using the `window/workDoneProgress/create` request. /// @@ -7041,13 +5641,6 @@ pub const WindowClientCapabilities = struct { /// /// @since 3.16.0 pub const GeneralClientCapabilities = struct { - pub const tres_null_meaning = .{ - .staleRequestSupport = .field, - .regularExpressions = .field, - .markdown = .field, - .positionEncodings = .field, - }; - /// Client capability that signals how the client /// handles stale requests (e.g. a request /// for which the client will not process the response @@ -7055,8 +5648,6 @@ pub const GeneralClientCapabilities = struct { /// /// @since 3.17.0 staleRequestSupport: ?struct { - pub const tres_null_meaning = .{}; - /// The client will actively cancel the request. cancel: bool, /// The list of requests for which the client @@ -7099,27 +5690,18 @@ pub const GeneralClientCapabilities = struct { /// /// @since 3.17.0 pub const RelativePattern = struct { - pub const tres_null_meaning = .{}; - /// A workspace folder or a base URI to which this pattern will be matched /// against relatively. baseUri: union(enum) { WorkspaceFolder: WorkspaceFolder, uri: URI, + pub usingnamespace UnionParser(@This()); }, /// The actual glob pattern; pattern: Pattern, }; pub const WorkspaceEditClientCapabilities = struct { - pub const tres_null_meaning = .{ - .documentChanges = .field, - .resourceOperations = .field, - .failureHandling = .field, - .normalizesLineEndings = .field, - .changeAnnotationSupport = .field, - }; - /// The client supports versioned document changes in `WorkspaceEdit`s documentChanges: ?bool = null, /// The resource operations the client supports. Clients should at least @@ -7145,10 +5727,6 @@ pub const WorkspaceEditClientCapabilities = struct { /// /// @since 3.16.0 changeAnnotationSupport: ?struct { - pub const tres_null_meaning = .{ - .groupsOnLabel = .field, - }; - /// Whether the client groups edits with equal labels into tree nodes, /// for instance all edits labelled with "Changes in Strings" would /// be a tree node. @@ -7157,20 +5735,11 @@ pub const WorkspaceEditClientCapabilities = struct { }; pub const DidChangeConfigurationClientCapabilities = struct { - pub const tres_null_meaning = .{ - .dynamicRegistration = .field, - }; - /// Did change configuration notification supports dynamic registration. dynamicRegistration: ?bool = null, }; pub const DidChangeWatchedFilesClientCapabilities = struct { - pub const tres_null_meaning = .{ - .dynamicRegistration = .field, - .relativePatternSupport = .field, - }; - /// Did change watched files notification supports dynamic registration. Please note /// that the current protocol doesn't support static configuration for file changes /// from the server side. @@ -7184,21 +5753,10 @@ pub const DidChangeWatchedFilesClientCapabilities = struct { /// Client capabilities for a {@link WorkspaceSymbolRequest}. pub const WorkspaceSymbolClientCapabilities = struct { - pub const tres_null_meaning = .{ - .dynamicRegistration = .field, - .symbolKind = .field, - .tagSupport = .field, - .resolveSupport = .field, - }; - /// Symbol request supports dynamic registration. dynamicRegistration: ?bool = null, /// Specific capabilities for the `SymbolKind` in the `workspace/symbol` request. symbolKind: ?struct { - pub const tres_null_meaning = .{ - .valueSet = .field, - }; - /// The symbol kind values the client supports. When this /// property exists the client also guarantees that it will /// handle values outside its set gracefully and falls back @@ -7214,8 +5772,6 @@ pub const WorkspaceSymbolClientCapabilities = struct { /// /// @since 3.16.0 tagSupport: ?struct { - pub const tres_null_meaning = .{}; - /// The tags supported by the client. valueSet: []const SymbolTag, } = null, @@ -7225,8 +5781,6 @@ pub const WorkspaceSymbolClientCapabilities = struct { /// /// @since 3.17.0 resolveSupport: ?struct { - pub const tres_null_meaning = .{}; - /// The properties that a client can resolve lazily. Usually /// `location.range` properties: []const []const u8, @@ -7235,20 +5789,12 @@ pub const WorkspaceSymbolClientCapabilities = struct { /// The client capabilities of a {@link ExecuteCommandRequest}. pub const ExecuteCommandClientCapabilities = struct { - pub const tres_null_meaning = .{ - .dynamicRegistration = .field, - }; - /// Execute command supports dynamic registration. dynamicRegistration: ?bool = null, }; /// @since 3.16.0 pub const SemanticTokensWorkspaceClientCapabilities = struct { - pub const tres_null_meaning = .{ - .refreshSupport = .field, - }; - /// Whether the client implementation supports a refresh request sent from /// the server to the client. /// @@ -7261,10 +5807,6 @@ pub const SemanticTokensWorkspaceClientCapabilities = struct { /// @since 3.16.0 pub const CodeLensWorkspaceClientCapabilities = struct { - pub const tres_null_meaning = .{ - .refreshSupport = .field, - }; - /// Whether the client implementation supports a refresh request sent from the /// server to the client. /// @@ -7282,16 +5824,6 @@ pub const CodeLensWorkspaceClientCapabilities = struct { /// /// @since 3.16.0 pub const FileOperationClientCapabilities = struct { - pub const tres_null_meaning = .{ - .dynamicRegistration = .field, - .didCreate = .field, - .willCreate = .field, - .didRename = .field, - .willRename = .field, - .didDelete = .field, - .willDelete = .field, - }; - /// Whether the client supports dynamic registration for file requests/notifications. dynamicRegistration: ?bool = null, /// The client has support for sending didCreateFiles notifications. @@ -7312,10 +5844,6 @@ pub const FileOperationClientCapabilities = struct { /// /// @since 3.17.0 pub const InlineValueWorkspaceClientCapabilities = struct { - pub const tres_null_meaning = .{ - .refreshSupport = .field, - }; - /// Whether the client implementation supports a refresh request sent from the /// server to the client. /// @@ -7330,10 +5858,6 @@ pub const InlineValueWorkspaceClientCapabilities = struct { /// /// @since 3.17.0 pub const InlayHintWorkspaceClientCapabilities = struct { - pub const tres_null_meaning = .{ - .refreshSupport = .field, - }; - /// Whether the client implementation supports a refresh request sent from /// the server to the client. /// @@ -7348,10 +5872,6 @@ pub const InlayHintWorkspaceClientCapabilities = struct { /// /// @since 3.17.0 pub const DiagnosticWorkspaceClientCapabilities = struct { - pub const tres_null_meaning = .{ - .refreshSupport = .field, - }; - /// Whether the client implementation supports a refresh request sent from /// the server to the client. /// @@ -7363,13 +5883,6 @@ pub const DiagnosticWorkspaceClientCapabilities = struct { }; pub const TextDocumentSyncClientCapabilities = struct { - pub const tres_null_meaning = .{ - .dynamicRegistration = .field, - .willSave = .field, - .willSaveWaitUntil = .field, - .didSave = .field, - }; - /// Whether text document synchronization supports dynamic registration. dynamicRegistration: ?bool = null, /// The client supports sending will save notifications. @@ -7384,33 +5897,11 @@ pub const TextDocumentSyncClientCapabilities = struct { /// Completion client capabilities pub const CompletionClientCapabilities = struct { - pub const tres_null_meaning = .{ - .dynamicRegistration = .field, - .completionItem = .field, - .completionItemKind = .field, - .insertTextMode = .field, - .contextSupport = .field, - .completionList = .field, - }; - /// Whether completion supports dynamic registration. dynamicRegistration: ?bool = null, /// The client supports the following `CompletionItem` specific /// capabilities. completionItem: ?struct { - pub const tres_null_meaning = .{ - .snippetSupport = .field, - .commitCharactersSupport = .field, - .documentationFormat = .field, - .deprecatedSupport = .field, - .preselectSupport = .field, - .tagSupport = .field, - .insertReplaceSupport = .field, - .resolveSupport = .field, - .insertTextModeSupport = .field, - .labelDetailsSupport = .field, - }; - /// Client supports snippets as insert text. /// /// A snippet can define tab stops and placeholders with `$1`, `$2` @@ -7434,8 +5925,6 @@ pub const CompletionClientCapabilities = struct { /// /// @since 3.15.0 tagSupport: ?struct { - pub const tres_null_meaning = .{}; - /// The tags supported by the client. valueSet: []const CompletionItemTag, } = null, @@ -7450,8 +5939,6 @@ pub const CompletionClientCapabilities = struct { /// /// @since 3.16.0 resolveSupport: ?struct { - pub const tres_null_meaning = .{}; - /// The properties that a client can resolve lazily. properties: []const []const u8, } = null, @@ -7461,8 +5948,6 @@ pub const CompletionClientCapabilities = struct { /// /// @since 3.16.0 insertTextModeSupport: ?struct { - pub const tres_null_meaning = .{}; - valueSet: []const InsertTextMode, } = null, /// The client has support for completion item label @@ -7472,10 +5957,6 @@ pub const CompletionClientCapabilities = struct { labelDetailsSupport: ?bool = null, } = null, completionItemKind: ?struct { - pub const tres_null_meaning = .{ - .valueSet = .field, - }; - /// The completion item kind values the client supports. When this /// property exists the client also guarantees that it will /// handle values outside its set gracefully and falls back @@ -7500,10 +5981,6 @@ pub const CompletionClientCapabilities = struct { /// /// @since 3.17.0 completionList: ?struct { - pub const tres_null_meaning = .{ - .itemDefaults = .field, - }; - /// The client supports the following itemDefaults on /// a completion list. /// @@ -7517,11 +5994,6 @@ pub const CompletionClientCapabilities = struct { }; pub const HoverClientCapabilities = struct { - pub const tres_null_meaning = .{ - .dynamicRegistration = .field, - .contentFormat = .field, - }; - /// Whether hover supports dynamic registration. dynamicRegistration: ?bool = null, /// Client supports the following content formats for the content @@ -7531,32 +6003,16 @@ pub const HoverClientCapabilities = struct { /// Client Capabilities for a {@link SignatureHelpRequest}. pub const SignatureHelpClientCapabilities = struct { - pub const tres_null_meaning = .{ - .dynamicRegistration = .field, - .signatureInformation = .field, - .contextSupport = .field, - }; - /// Whether signature help supports dynamic registration. dynamicRegistration: ?bool = null, /// The client supports the following `SignatureInformation` /// specific properties. signatureInformation: ?struct { - pub const tres_null_meaning = .{ - .documentationFormat = .field, - .parameterInformation = .field, - .activeParameterSupport = .field, - }; - /// Client supports the following content formats for the documentation /// property. The order describes the preferred format of the client. documentationFormat: ?[]const MarkupKind = null, /// Client capabilities specific to parameter information. parameterInformation: ?struct { - pub const tres_null_meaning = .{ - .labelOffsetSupport = .field, - }; - /// The client supports processing label offsets instead of a /// simple label string. /// @@ -7580,11 +6036,6 @@ pub const SignatureHelpClientCapabilities = struct { /// @since 3.14.0 pub const DeclarationClientCapabilities = struct { - pub const tres_null_meaning = .{ - .dynamicRegistration = .field, - .linkSupport = .field, - }; - /// Whether declaration supports dynamic registration. If this is set to `true` /// the client supports the new `DeclarationRegistrationOptions` return value /// for the corresponding server capability as well. @@ -7595,11 +6046,6 @@ pub const DeclarationClientCapabilities = struct { /// Client Capabilities for a {@link DefinitionRequest}. pub const DefinitionClientCapabilities = struct { - pub const tres_null_meaning = .{ - .dynamicRegistration = .field, - .linkSupport = .field, - }; - /// Whether definition supports dynamic registration. dynamicRegistration: ?bool = null, /// The client supports additional metadata in the form of definition links. @@ -7610,11 +6056,6 @@ pub const DefinitionClientCapabilities = struct { /// Since 3.6.0 pub const TypeDefinitionClientCapabilities = struct { - pub const tres_null_meaning = .{ - .dynamicRegistration = .field, - .linkSupport = .field, - }; - /// Whether implementation supports dynamic registration. If this is set to `true` /// the client supports the new `TypeDefinitionRegistrationOptions` return value /// for the corresponding server capability as well. @@ -7627,11 +6068,6 @@ pub const TypeDefinitionClientCapabilities = struct { /// @since 3.6.0 pub const ImplementationClientCapabilities = struct { - pub const tres_null_meaning = .{ - .dynamicRegistration = .field, - .linkSupport = .field, - }; - /// Whether implementation supports dynamic registration. If this is set to `true` /// the client supports the new `ImplementationRegistrationOptions` return value /// for the corresponding server capability as well. @@ -7644,43 +6080,23 @@ pub const ImplementationClientCapabilities = struct { /// Client Capabilities for a {@link ReferencesRequest}. pub const ReferenceClientCapabilities = struct { - pub const tres_null_meaning = .{ - .dynamicRegistration = .field, - }; - /// Whether references supports dynamic registration. dynamicRegistration: ?bool = null, }; /// Client Capabilities for a {@link DocumentHighlightRequest}. pub const DocumentHighlightClientCapabilities = struct { - pub const tres_null_meaning = .{ - .dynamicRegistration = .field, - }; - /// Whether document highlight supports dynamic registration. dynamicRegistration: ?bool = null, }; /// Client Capabilities for a {@link DocumentSymbolRequest}. pub const DocumentSymbolClientCapabilities = struct { - pub const tres_null_meaning = .{ - .dynamicRegistration = .field, - .symbolKind = .field, - .hierarchicalDocumentSymbolSupport = .field, - .tagSupport = .field, - .labelSupport = .field, - }; - /// Whether document symbol supports dynamic registration. dynamicRegistration: ?bool = null, /// Specific capabilities for the `SymbolKind` in the /// `textDocument/documentSymbol` request. symbolKind: ?struct { - pub const tres_null_meaning = .{ - .valueSet = .field, - }; - /// The symbol kind values the client supports. When this /// property exists the client also guarantees that it will /// handle values outside its set gracefully and falls back @@ -7699,8 +6115,6 @@ pub const DocumentSymbolClientCapabilities = struct { /// /// @since 3.16.0 tagSupport: ?struct { - pub const tres_null_meaning = .{}; - /// The tags supported by the client. valueSet: []const SymbolTag, } = null, @@ -7713,16 +6127,6 @@ pub const DocumentSymbolClientCapabilities = struct { /// The Client Capabilities of a {@link CodeActionRequest}. pub const CodeActionClientCapabilities = struct { - pub const tres_null_meaning = .{ - .dynamicRegistration = .field, - .codeActionLiteralSupport = .field, - .isPreferredSupport = .field, - .disabledSupport = .field, - .dataSupport = .field, - .resolveSupport = .field, - .honorsChangeAnnotations = .field, - }; - /// Whether code action supports dynamic registration. dynamicRegistration: ?bool = null, /// The client support code action literals of type `CodeAction` as a valid @@ -7731,13 +6135,9 @@ pub const CodeActionClientCapabilities = struct { /// /// @since 3.8.0 codeActionLiteralSupport: ?struct { - pub const tres_null_meaning = .{}; - /// The code action kind is support with the following value /// set. codeActionKind: struct { - pub const tres_null_meaning = .{}; - /// The code action kind values the client supports. When this /// property exists the client also guarantees that it will /// handle values outside its set gracefully and falls back @@ -7764,8 +6164,6 @@ pub const CodeActionClientCapabilities = struct { /// /// @since 3.16.0 resolveSupport: ?struct { - pub const tres_null_meaning = .{}; - /// The properties that a client can resolve lazily. properties: []const []const u8, } = null, @@ -7781,21 +6179,12 @@ pub const CodeActionClientCapabilities = struct { /// The client capabilities of a {@link CodeLensRequest}. pub const CodeLensClientCapabilities = struct { - pub const tres_null_meaning = .{ - .dynamicRegistration = .field, - }; - /// Whether code lens supports dynamic registration. dynamicRegistration: ?bool = null, }; /// The client capabilities of a {@link DocumentLinkRequest}. pub const DocumentLinkClientCapabilities = struct { - pub const tres_null_meaning = .{ - .dynamicRegistration = .field, - .tooltipSupport = .field, - }; - /// Whether document link supports dynamic registration. dynamicRegistration: ?bool = null, /// Whether the client supports the `tooltip` property on `DocumentLink`. @@ -7805,10 +6194,6 @@ pub const DocumentLinkClientCapabilities = struct { }; pub const DocumentColorClientCapabilities = struct { - pub const tres_null_meaning = .{ - .dynamicRegistration = .field, - }; - /// Whether implementation supports dynamic registration. If this is set to `true` /// the client supports the new `DocumentColorRegistrationOptions` return value /// for the corresponding server capability as well. @@ -7817,42 +6202,28 @@ pub const DocumentColorClientCapabilities = struct { /// Client capabilities of a {@link DocumentFormattingRequest}. pub const DocumentFormattingClientCapabilities = struct { - pub const tres_null_meaning = .{ - .dynamicRegistration = .field, - }; - /// Whether formatting supports dynamic registration. dynamicRegistration: ?bool = null, }; /// Client capabilities of a {@link DocumentRangeFormattingRequest}. pub const DocumentRangeFormattingClientCapabilities = struct { - pub const tres_null_meaning = .{ - .dynamicRegistration = .field, - }; - /// Whether range formatting supports dynamic registration. dynamicRegistration: ?bool = null, + /// Whether the client supports formatting multiple ranges at once. + /// + /// @since 3.18.0 + /// @proposed + rangesSupport: ?bool = null, }; /// Client capabilities of a {@link DocumentOnTypeFormattingRequest}. pub const DocumentOnTypeFormattingClientCapabilities = struct { - pub const tres_null_meaning = .{ - .dynamicRegistration = .field, - }; - /// Whether on type formatting supports dynamic registration. dynamicRegistration: ?bool = null, }; pub const RenameClientCapabilities = struct { - pub const tres_null_meaning = .{ - .dynamicRegistration = .field, - .prepareSupport = .field, - .prepareSupportDefaultBehavior = .field, - .honorsChangeAnnotations = .field, - }; - /// Whether rename supports dynamic registration. dynamicRegistration: ?bool = null, /// Client supports testing for validity of rename operations @@ -7878,14 +6249,6 @@ pub const RenameClientCapabilities = struct { }; pub const FoldingRangeClientCapabilities = struct { - pub const tres_null_meaning = .{ - .dynamicRegistration = .field, - .rangeLimit = .field, - .lineFoldingOnly = .field, - .foldingRangeKind = .field, - .foldingRange = .field, - }; - /// Whether implementation supports dynamic registration for folding range /// providers. If this is set to `true` the client supports the new /// `FoldingRangeRegistrationOptions` return value for the corresponding @@ -7903,10 +6266,6 @@ pub const FoldingRangeClientCapabilities = struct { /// /// @since 3.17.0 foldingRangeKind: ?struct { - pub const tres_null_meaning = .{ - .valueSet = .field, - }; - /// The folding range kind values the client supports. When this /// property exists the client also guarantees that it will /// handle values outside its set gracefully and falls back @@ -7917,10 +6276,6 @@ pub const FoldingRangeClientCapabilities = struct { /// /// @since 3.17.0 foldingRange: ?struct { - pub const tres_null_meaning = .{ - .collapsedText = .field, - }; - /// If set, the client signals that it supports setting collapsedText on /// folding ranges to display custom labels instead of the default text. /// @@ -7930,10 +6285,6 @@ pub const FoldingRangeClientCapabilities = struct { }; pub const SelectionRangeClientCapabilities = struct { - pub const tres_null_meaning = .{ - .dynamicRegistration = .field, - }; - /// Whether implementation supports dynamic registration for selection range providers. If this is set to `true` /// the client supports the new `SelectionRangeRegistrationOptions` return value for the corresponding server /// capability as well. @@ -7942,14 +6293,6 @@ pub const SelectionRangeClientCapabilities = struct { /// The publish diagnostic client capabilities. pub const PublishDiagnosticsClientCapabilities = struct { - pub const tres_null_meaning = .{ - .relatedInformation = .field, - .tagSupport = .field, - .versionSupport = .field, - .codeDescriptionSupport = .field, - .dataSupport = .field, - }; - /// Whether the clients accepts diagnostics with related information. relatedInformation: ?bool = null, /// Client supports the tag property to provide meta data about a diagnostic. @@ -7957,8 +6300,6 @@ pub const PublishDiagnosticsClientCapabilities = struct { /// /// @since 3.15.0 tagSupport: ?struct { - pub const tres_null_meaning = .{}; - /// The tags supported by the client. valueSet: []const DiagnosticTag, } = null, @@ -7981,10 +6322,6 @@ pub const PublishDiagnosticsClientCapabilities = struct { /// @since 3.16.0 pub const CallHierarchyClientCapabilities = struct { - pub const tres_null_meaning = .{ - .dynamicRegistration = .field, - }; - /// Whether implementation supports dynamic registration. If this is set to `true` /// the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)` /// return value for the corresponding server capability as well. @@ -7993,14 +6330,6 @@ pub const CallHierarchyClientCapabilities = struct { /// @since 3.16.0 pub const SemanticTokensClientCapabilities = struct { - pub const tres_null_meaning = .{ - .dynamicRegistration = .field, - .overlappingTokenSupport = .field, - .multilineTokenSupport = .field, - .serverCancelSupport = .field, - .augmentsSyntaxTokens = .field, - }; - /// Whether implementation supports dynamic registration. If this is set to `true` /// the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)` /// return value for the corresponding server capability as well. @@ -8014,32 +6343,23 @@ pub const SemanticTokensClientCapabilities = struct { /// range provider the client might not render a minimap correctly or might /// even decide to not show any semantic tokens at all. requests: struct { - pub const tres_null_meaning = .{ - .range = .field, - .full = .field, - }; - /// The client will send the `textDocument/semanticTokens/range` request if /// the server provides a corresponding handler. range: ?union(enum) { bool: bool, - literal_1: struct { - pub const tres_null_meaning = .{}; - }, + literal_1: struct {}, + pub usingnamespace UnionParser(@This()); } = null, /// The client will send the `textDocument/semanticTokens/full` request if /// the server provides a corresponding handler. full: ?union(enum) { bool: bool, literal_1: struct { - pub const tres_null_meaning = .{ - .delta = .field, - }; - /// The client will send the `textDocument/semanticTokens/full/delta` request if /// the server provides a corresponding handler. delta: ?bool = null, }, + pub usingnamespace UnionParser(@This()); } = null, }, /// The token types that the client supports. @@ -8076,10 +6396,6 @@ pub const SemanticTokensClientCapabilities = struct { /// /// @since 3.16.0 pub const LinkedEditingRangeClientCapabilities = struct { - pub const tres_null_meaning = .{ - .dynamicRegistration = .field, - }; - /// Whether implementation supports dynamic registration. If this is set to `true` /// the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)` /// return value for the corresponding server capability as well. @@ -8090,10 +6406,6 @@ pub const LinkedEditingRangeClientCapabilities = struct { /// /// @since 3.16.0 pub const MonikerClientCapabilities = struct { - pub const tres_null_meaning = .{ - .dynamicRegistration = .field, - }; - /// Whether moniker supports dynamic registration. If this is set to `true` /// the client supports the new `MonikerRegistrationOptions` return value /// for the corresponding server capability as well. @@ -8102,10 +6414,6 @@ pub const MonikerClientCapabilities = struct { /// @since 3.17.0 pub const TypeHierarchyClientCapabilities = struct { - pub const tres_null_meaning = .{ - .dynamicRegistration = .field, - }; - /// Whether implementation supports dynamic registration. If this is set to `true` /// the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)` /// return value for the corresponding server capability as well. @@ -8116,10 +6424,6 @@ pub const TypeHierarchyClientCapabilities = struct { /// /// @since 3.17.0 pub const InlineValueClientCapabilities = struct { - pub const tres_null_meaning = .{ - .dynamicRegistration = .field, - }; - /// Whether implementation supports dynamic registration for inline value providers. dynamicRegistration: ?bool = null, }; @@ -8128,18 +6432,11 @@ pub const InlineValueClientCapabilities = struct { /// /// @since 3.17.0 pub const InlayHintClientCapabilities = struct { - pub const tres_null_meaning = .{ - .dynamicRegistration = .field, - .resolveSupport = .field, - }; - /// Whether inlay hints support dynamic registration. dynamicRegistration: ?bool = null, /// Indicates which properties a client can resolve lazily on an inlay /// hint. resolveSupport: ?struct { - pub const tres_null_meaning = .{}; - /// The properties that a client can resolve lazily. properties: []const []const u8, } = null, @@ -8149,11 +6446,6 @@ pub const InlayHintClientCapabilities = struct { /// /// @since 3.17.0 pub const DiagnosticClientCapabilities = struct { - pub const tres_null_meaning = .{ - .dynamicRegistration = .field, - .relatedDocumentSupport = .field, - }; - /// Whether implementation supports dynamic registration. If this is set to `true` /// the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)` /// return value for the corresponding server capability as well. @@ -8162,15 +6454,19 @@ pub const DiagnosticClientCapabilities = struct { relatedDocumentSupport: ?bool = null, }; +/// Client capabilities specific to inline completions. +/// +/// @since 3.18.0 +/// @proposed +pub const InlineCompletionClientCapabilities = struct { + /// Whether implementation supports dynamic registration for inline completion providers. + dynamicRegistration: ?bool = null, +}; + /// Notebook specific client capabilities. /// /// @since 3.17.0 pub const NotebookDocumentSyncClientCapabilities = struct { - pub const tres_null_meaning = .{ - .dynamicRegistration = .field, - .executionSummarySupport = .field, - }; - /// Whether implementation supports dynamic registration. If this is /// set to `true` the client supports the new /// `(TextDocumentRegistrationOptions & StaticRegistrationOptions)` @@ -8182,16 +6478,8 @@ pub const NotebookDocumentSyncClientCapabilities = struct { /// Show message request client capabilities pub const ShowMessageRequestClientCapabilities = struct { - pub const tres_null_meaning = .{ - .messageActionItem = .field, - }; - /// Capabilities specific to the `MessageActionItem` type. messageActionItem: ?struct { - pub const tres_null_meaning = .{ - .additionalPropertiesSupport = .field, - }; - /// Whether the client supports additional attributes which /// are preserved and send back to the server in the /// request's response. @@ -8203,8 +6491,6 @@ pub const ShowMessageRequestClientCapabilities = struct { /// /// @since 3.16.0 pub const ShowDocumentClientCapabilities = struct { - pub const tres_null_meaning = .{}; - /// The client has support for the showDocument /// request. support: bool, @@ -8214,10 +6500,6 @@ pub const ShowDocumentClientCapabilities = struct { /// /// @since 3.16.0 pub const RegularExpressionsClientCapabilities = struct { - pub const tres_null_meaning = .{ - .version = .field, - }; - /// The engine's name. engine: []const u8, /// The engine's version. @@ -8228,11 +6510,6 @@ pub const RegularExpressionsClientCapabilities = struct { /// /// @since 3.16.0 pub const MarkdownClientCapabilities = struct { - pub const tres_null_meaning = .{ - .version = .field, - .allowedTags = .field, - }; - /// The name of the parser. parser: []const u8, /// The version of the parser. @@ -8250,7 +6527,7 @@ pub const notification_metadata = [_]NotificationMetadata{ .{ .method = "workspace/didChangeWorkspaceFolders", .documentation = "The `workspace/didChangeWorkspaceFolders` notification is sent from the client to the server when the workspace\nfolder configuration changes.", - .direction = .client_to_server, + .direction = .clientToServer, .Params = DidChangeWorkspaceFoldersParams, .registration = .{ .method = null, .Options = null }, }, @@ -8259,7 +6536,7 @@ pub const notification_metadata = [_]NotificationMetadata{ .{ .method = "window/workDoneProgress/cancel", .documentation = "The `window/workDoneProgress/cancel` notification is sent from the client to the server to cancel a progress\ninitiated on the server side.", - .direction = .client_to_server, + .direction = .clientToServer, .Params = WorkDoneProgressCancelParams, .registration = .{ .method = null, .Options = null }, }, @@ -8270,7 +6547,7 @@ pub const notification_metadata = [_]NotificationMetadata{ .{ .method = "workspace/didCreateFiles", .documentation = "The did create files notification is sent from the client to the server when\nfiles were created from within the client.\n\n@since 3.16.0", - .direction = .client_to_server, + .direction = .clientToServer, .Params = CreateFilesParams, .registration = .{ .method = null, .Options = FileOperationRegistrationOptions }, }, @@ -8281,7 +6558,7 @@ pub const notification_metadata = [_]NotificationMetadata{ .{ .method = "workspace/didRenameFiles", .documentation = "The did rename files notification is sent from the client to the server when\nfiles were renamed from within the client.\n\n@since 3.16.0", - .direction = .client_to_server, + .direction = .clientToServer, .Params = RenameFilesParams, .registration = .{ .method = null, .Options = FileOperationRegistrationOptions }, }, @@ -8292,7 +6569,7 @@ pub const notification_metadata = [_]NotificationMetadata{ .{ .method = "workspace/didDeleteFiles", .documentation = "The will delete files request is sent from the client to the server before files are actually\ndeleted as long as the deletion is triggered from within the client.\n\n@since 3.16.0", - .direction = .client_to_server, + .direction = .clientToServer, .Params = DeleteFilesParams, .registration = .{ .method = null, .Options = FileOperationRegistrationOptions }, }, @@ -8302,14 +6579,14 @@ pub const notification_metadata = [_]NotificationMetadata{ .{ .method = "notebookDocument/didOpen", .documentation = "A notification sent when a notebook opens.\n\n@since 3.17.0", - .direction = .client_to_server, + .direction = .clientToServer, .Params = DidOpenNotebookDocumentParams, .registration = .{ .method = "notebookDocument/sync", .Options = null }, }, .{ .method = "notebookDocument/didChange", .documentation = null, - .direction = .client_to_server, + .direction = .clientToServer, .Params = DidChangeNotebookDocumentParams, .registration = .{ .method = "notebookDocument/sync", .Options = null }, }, @@ -8319,7 +6596,7 @@ pub const notification_metadata = [_]NotificationMetadata{ .{ .method = "notebookDocument/didSave", .documentation = "A notification sent when a notebook document is saved.\n\n@since 3.17.0", - .direction = .client_to_server, + .direction = .clientToServer, .Params = DidSaveNotebookDocumentParams, .registration = .{ .method = "notebookDocument/sync", .Options = null }, }, @@ -8329,7 +6606,7 @@ pub const notification_metadata = [_]NotificationMetadata{ .{ .method = "notebookDocument/didClose", .documentation = "A notification sent when a notebook closes.\n\n@since 3.17.0", - .direction = .client_to_server, + .direction = .clientToServer, .Params = DidCloseNotebookDocumentParams, .registration = .{ .method = "notebookDocument/sync", .Options = null }, }, @@ -8339,7 +6616,7 @@ pub const notification_metadata = [_]NotificationMetadata{ .{ .method = "initialized", .documentation = "The initialized notification is sent from the client to the\nserver after the client is fully initialized and the server\nis allowed to send requests from the server to the client.", - .direction = .client_to_server, + .direction = .clientToServer, .Params = InitializedParams, .registration = .{ .method = null, .Options = null }, }, @@ -8348,7 +6625,7 @@ pub const notification_metadata = [_]NotificationMetadata{ .{ .method = "exit", .documentation = "The exit event is sent from the client to the server to\nask the server to exit its process.", - .direction = .client_to_server, + .direction = .clientToServer, .Params = null, .registration = .{ .method = null, .Options = null }, }, @@ -8358,7 +6635,7 @@ pub const notification_metadata = [_]NotificationMetadata{ .{ .method = "workspace/didChangeConfiguration", .documentation = "The configuration change notification is sent from the client to the server\nwhen the client's configuration has changed. The notification contains\nthe changed configuration as defined by the language client.", - .direction = .client_to_server, + .direction = .clientToServer, .Params = DidChangeConfigurationParams, .registration = .{ .method = null, .Options = DidChangeConfigurationRegistrationOptions }, }, @@ -8367,7 +6644,7 @@ pub const notification_metadata = [_]NotificationMetadata{ .{ .method = "window/showMessage", .documentation = "The show message notification is sent from a server to a client to ask\nthe client to display a particular message in the user interface.", - .direction = .server_to_client, + .direction = .serverToClient, .Params = ShowMessageParams, .registration = .{ .method = null, .Options = null }, }, @@ -8376,7 +6653,7 @@ pub const notification_metadata = [_]NotificationMetadata{ .{ .method = "window/logMessage", .documentation = "The log message notification is sent from the server to the client to ask\nthe client to log a particular message.", - .direction = .server_to_client, + .direction = .serverToClient, .Params = LogMessageParams, .registration = .{ .method = null, .Options = null }, }, @@ -8385,7 +6662,7 @@ pub const notification_metadata = [_]NotificationMetadata{ .{ .method = "telemetry/event", .documentation = "The telemetry event notification is sent from the server to the client to ask\nthe client to log telemetry data.", - .direction = .server_to_client, + .direction = .serverToClient, .Params = LSPAny, .registration = .{ .method = null, .Options = null }, }, @@ -8400,7 +6677,7 @@ pub const notification_metadata = [_]NotificationMetadata{ .{ .method = "textDocument/didOpen", .documentation = "The document open notification is sent from the client to the server to signal\nnewly opened text documents. The document's truth is now managed by the client\nand the server must not try to read the document's truth using the document's\nuri. Open in this sense means it is managed by the client. It doesn't necessarily\nmean that its content is presented in an editor. An open notification must not\nbe sent more than once without a corresponding close notification send before.\nThis means open and close notification must be balanced and the max open count\nis one.", - .direction = .client_to_server, + .direction = .clientToServer, .Params = DidOpenTextDocumentParams, .registration = .{ .method = null, .Options = TextDocumentRegistrationOptions }, }, @@ -8409,7 +6686,7 @@ pub const notification_metadata = [_]NotificationMetadata{ .{ .method = "textDocument/didChange", .documentation = "The document change notification is sent from the client to the server to signal\nchanges to a text document.", - .direction = .client_to_server, + .direction = .clientToServer, .Params = DidChangeTextDocumentParams, .registration = .{ .method = null, .Options = TextDocumentChangeRegistrationOptions }, }, @@ -8423,7 +6700,7 @@ pub const notification_metadata = [_]NotificationMetadata{ .{ .method = "textDocument/didClose", .documentation = "The document close notification is sent from the client to the server when\nthe document got closed in the client. The document's truth now exists where\nthe document's uri points to (e.g. if the document's uri is a file uri the\ntruth now exists on disk). As with the open notification the close notification\nis about managing the document's content. Receiving a close notification\ndoesn't mean that the document was open in an editor before. A close\nnotification requires a previous open notification to be sent.", - .direction = .client_to_server, + .direction = .clientToServer, .Params = DidCloseTextDocumentParams, .registration = .{ .method = null, .Options = TextDocumentRegistrationOptions }, }, @@ -8432,7 +6709,7 @@ pub const notification_metadata = [_]NotificationMetadata{ .{ .method = "textDocument/didSave", .documentation = "The document save notification is sent from the client to the server when\nthe document got saved in the client.", - .direction = .client_to_server, + .direction = .clientToServer, .Params = DidSaveTextDocumentParams, .registration = .{ .method = null, .Options = TextDocumentSaveRegistrationOptions }, }, @@ -8441,7 +6718,7 @@ pub const notification_metadata = [_]NotificationMetadata{ .{ .method = "textDocument/willSave", .documentation = "A document will save notification is sent from the client to the server before\nthe document is actually saved.", - .direction = .client_to_server, + .direction = .clientToServer, .Params = WillSaveTextDocumentParams, .registration = .{ .method = null, .Options = TextDocumentRegistrationOptions }, }, @@ -8450,7 +6727,7 @@ pub const notification_metadata = [_]NotificationMetadata{ .{ .method = "workspace/didChangeWatchedFiles", .documentation = "The watched files notification is sent from the client to the server when\nthe client detects changes to file watched by the language client.", - .direction = .client_to_server, + .direction = .clientToServer, .Params = DidChangeWatchedFilesParams, .registration = .{ .method = null, .Options = DidChangeWatchedFilesRegistrationOptions }, }, @@ -8459,35 +6736,35 @@ pub const notification_metadata = [_]NotificationMetadata{ .{ .method = "textDocument/publishDiagnostics", .documentation = "Diagnostics notification are sent from the server to the client to signal\nresults of validation runs.", - .direction = .server_to_client, + .direction = .serverToClient, .Params = PublishDiagnosticsParams, .registration = .{ .method = null, .Options = null }, }, .{ .method = "$/setTrace", .documentation = null, - .direction = .client_to_server, + .direction = .clientToServer, .Params = SetTraceParams, .registration = .{ .method = null, .Options = null }, }, .{ .method = "$/logTrace", .documentation = null, - .direction = .server_to_client, + .direction = .serverToClient, .Params = LogTraceParams, .registration = .{ .method = null, .Options = null }, }, .{ .method = "$/cancelRequest", .documentation = null, - .direction = .bidirectional, + .direction = .both, .Params = CancelParams, .registration = .{ .method = null, .Options = null }, }, .{ .method = "$/progress", .documentation = null, - .direction = .bidirectional, + .direction = .both, .Params = ProgressParams, .registration = .{ .method = null, .Options = null }, }, @@ -8500,15 +6777,17 @@ pub const request_metadata = [_]RequestMetadata{ .{ .method = "textDocument/implementation", .documentation = "A request to resolve the implementation locations of a symbol at a given text\ndocument position. The request's parameter is of type [TextDocumentPositionParams]\n(#TextDocumentPositionParams) the response is of type {@link Definition} or a\nThenable that resolves to such.", - .direction = .client_to_server, + .direction = .clientToServer, .Params = ImplementationParams, .Result = ?union(enum) { Definition: Definition, array_of_DefinitionLink: []const DefinitionLink, + pub usingnamespace UnionParser(@This()); }, .PartialResult = union(enum) { array_of_Location: []const Location, array_of_DefinitionLink: []const DefinitionLink, + pub usingnamespace UnionParser(@This()); }, .ErrorData = null, .registration = .{ .method = null, .Options = ImplementationRegistrationOptions }, @@ -8520,15 +6799,17 @@ pub const request_metadata = [_]RequestMetadata{ .{ .method = "textDocument/typeDefinition", .documentation = "A request to resolve the type definition locations of a symbol at a given text\ndocument position. The request's parameter is of type [TextDocumentPositionParams]\n(#TextDocumentPositionParams) the response is of type {@link Definition} or a\nThenable that resolves to such.", - .direction = .client_to_server, + .direction = .clientToServer, .Params = TypeDefinitionParams, .Result = ?union(enum) { Definition: Definition, array_of_DefinitionLink: []const DefinitionLink, + pub usingnamespace UnionParser(@This()); }, .PartialResult = union(enum) { array_of_Location: []const Location, array_of_DefinitionLink: []const DefinitionLink, + pub usingnamespace UnionParser(@This()); }, .ErrorData = null, .registration = .{ .method = null, .Options = TypeDefinitionRegistrationOptions }, @@ -8537,7 +6818,7 @@ pub const request_metadata = [_]RequestMetadata{ .{ .method = "workspace/workspaceFolders", .documentation = "The `workspace/workspaceFolders` is sent from the server to the client to fetch the open workspace folders.", - .direction = .server_to_client, + .direction = .serverToClient, .Params = null, .Result = ?[]const WorkspaceFolder, .PartialResult = null, @@ -8554,7 +6835,7 @@ pub const request_metadata = [_]RequestMetadata{ .{ .method = "workspace/configuration", .documentation = "The 'workspace/configuration' request is sent from the server to the client to fetch a certain\nconfiguration setting.\n\nThis pull model replaces the old push model were the client signaled configuration change via an\nevent. If the server still needs to react to configuration changes (since the server caches the\nresult of `workspace/configuration` requests) the server should register for an empty configuration\nchange event and empty the cache if such an event is received.", - .direction = .server_to_client, + .direction = .serverToClient, .Params = ConfigurationParams, .Result = []const LSPAny, .PartialResult = null, @@ -8568,7 +6849,7 @@ pub const request_metadata = [_]RequestMetadata{ .{ .method = "textDocument/documentColor", .documentation = "A request to list all color symbols found in a given text document. The request's\nparameter is of type {@link DocumentColorParams} the\nresponse is of type {@link ColorInformation ColorInformation[]} or a Thenable\nthat resolves to such.", - .direction = .client_to_server, + .direction = .clientToServer, .Params = DocumentColorParams, .Result = []const ColorInformation, .PartialResult = []const ColorInformation, @@ -8582,7 +6863,7 @@ pub const request_metadata = [_]RequestMetadata{ .{ .method = "textDocument/colorPresentation", .documentation = "A request to list all presentation for a color. The request's\nparameter is of type {@link ColorPresentationParams} the\nresponse is of type {@link ColorInformation ColorInformation[]} or a Thenable\nthat resolves to such.", - .direction = .client_to_server, + .direction = .clientToServer, .Params = ColorPresentationParams, .Result = []const ColorPresentation, .PartialResult = []const ColorPresentation, @@ -8606,7 +6887,7 @@ pub const request_metadata = [_]RequestMetadata{ .{ .method = "textDocument/foldingRange", .documentation = "A request to provide folding ranges in a document. The request's\nparameter is of type {@link FoldingRangeParams}, the\nresponse is of type {@link FoldingRangeList} or a Thenable\nthat resolves to such.", - .direction = .client_to_server, + .direction = .clientToServer, .Params = FoldingRangeParams, .Result = ?[]const FoldingRange, .PartialResult = []const FoldingRange, @@ -8621,15 +6902,17 @@ pub const request_metadata = [_]RequestMetadata{ .{ .method = "textDocument/declaration", .documentation = "A request to resolve the type definition locations of a symbol at a given text\ndocument position. The request's parameter is of type [TextDocumentPositionParams]\n(#TextDocumentPositionParams) the response is of type {@link Declaration}\nor a typed array of {@link DeclarationLink} or a Thenable that resolves\nto such.", - .direction = .client_to_server, + .direction = .clientToServer, .Params = DeclarationParams, .Result = ?union(enum) { Declaration: Declaration, array_of_DeclarationLink: []const DeclarationLink, + pub usingnamespace UnionParser(@This()); }, .PartialResult = union(enum) { array_of_Location: []const Location, array_of_DeclarationLink: []const DeclarationLink, + pub usingnamespace UnionParser(@This()); }, .ErrorData = null, .registration = .{ .method = null, .Options = DeclarationRegistrationOptions }, @@ -8641,7 +6924,7 @@ pub const request_metadata = [_]RequestMetadata{ .{ .method = "textDocument/selectionRange", .documentation = "A request to provide selection ranges in a document. The request's\nparameter is of type {@link SelectionRangeParams}, the\nresponse is of type {@link SelectionRange SelectionRange[]} or a Thenable\nthat resolves to such.", - .direction = .client_to_server, + .direction = .clientToServer, .Params = SelectionRangeParams, .Result = ?[]const SelectionRange, .PartialResult = []const SelectionRange, @@ -8653,7 +6936,7 @@ pub const request_metadata = [_]RequestMetadata{ .{ .method = "window/workDoneProgress/create", .documentation = "The `window/workDoneProgress/create` request is sent from the server to the client to initiate progress\nreporting from the server.", - .direction = .server_to_client, + .direction = .serverToClient, .Params = WorkDoneProgressCreateParams, .Result = ?void, .PartialResult = null, @@ -8667,7 +6950,7 @@ pub const request_metadata = [_]RequestMetadata{ .{ .method = "textDocument/prepareCallHierarchy", .documentation = "A request to result a `CallHierarchyItem` in a document at a given position.\nCan be used as an input to an incoming or outgoing call hierarchy.\n\n@since 3.16.0", - .direction = .client_to_server, + .direction = .clientToServer, .Params = CallHierarchyPrepareParams, .Result = ?[]const CallHierarchyItem, .PartialResult = null, @@ -8680,7 +6963,7 @@ pub const request_metadata = [_]RequestMetadata{ .{ .method = "callHierarchy/incomingCalls", .documentation = "A request to resolve the incoming calls for a given `CallHierarchyItem`.\n\n@since 3.16.0", - .direction = .client_to_server, + .direction = .clientToServer, .Params = CallHierarchyIncomingCallsParams, .Result = ?[]const CallHierarchyIncomingCall, .PartialResult = []const CallHierarchyIncomingCall, @@ -8693,7 +6976,7 @@ pub const request_metadata = [_]RequestMetadata{ .{ .method = "callHierarchy/outgoingCalls", .documentation = "A request to resolve the outgoing calls for a given `CallHierarchyItem`.\n\n@since 3.16.0", - .direction = .client_to_server, + .direction = .clientToServer, .Params = CallHierarchyOutgoingCallsParams, .Result = ?[]const CallHierarchyOutgoingCall, .PartialResult = []const CallHierarchyOutgoingCall, @@ -8704,7 +6987,7 @@ pub const request_metadata = [_]RequestMetadata{ .{ .method = "textDocument/semanticTokens/full", .documentation = "@since 3.16.0", - .direction = .client_to_server, + .direction = .clientToServer, .Params = SemanticTokensParams, .Result = ?SemanticTokens, .PartialResult = SemanticTokensPartialResult, @@ -8715,15 +6998,17 @@ pub const request_metadata = [_]RequestMetadata{ .{ .method = "textDocument/semanticTokens/full/delta", .documentation = "@since 3.16.0", - .direction = .client_to_server, + .direction = .clientToServer, .Params = SemanticTokensDeltaParams, .Result = ?union(enum) { SemanticTokens: SemanticTokens, SemanticTokensDelta: SemanticTokensDelta, + pub usingnamespace UnionParser(@This()); }, .PartialResult = union(enum) { SemanticTokensPartialResult: SemanticTokensPartialResult, SemanticTokensDeltaPartialResult: SemanticTokensDeltaPartialResult, + pub usingnamespace UnionParser(@This()); }, .ErrorData = null, .registration = .{ .method = "textDocument/semanticTokens", .Options = SemanticTokensRegistrationOptions }, @@ -8732,7 +7017,7 @@ pub const request_metadata = [_]RequestMetadata{ .{ .method = "textDocument/semanticTokens/range", .documentation = "@since 3.16.0", - .direction = .client_to_server, + .direction = .clientToServer, .Params = SemanticTokensRangeParams, .Result = ?SemanticTokens, .PartialResult = SemanticTokensPartialResult, @@ -8743,7 +7028,7 @@ pub const request_metadata = [_]RequestMetadata{ .{ .method = "workspace/semanticTokens/refresh", .documentation = "@since 3.16.0", - .direction = .server_to_client, + .direction = .serverToClient, .Params = null, .Result = ?void, .PartialResult = null, @@ -8759,7 +7044,7 @@ pub const request_metadata = [_]RequestMetadata{ .{ .method = "window/showDocument", .documentation = "A request to show a document. This request might open an\nexternal program depending on the value of the URI to open.\nFor example a request to open `https://code.visualstudio.com/`\nwill very likely open the URI in a WEB browser.\n\n@since 3.16.0", - .direction = .server_to_client, + .direction = .serverToClient, .Params = ShowDocumentParams, .Result = ShowDocumentResult, .PartialResult = null, @@ -8772,7 +7057,7 @@ pub const request_metadata = [_]RequestMetadata{ .{ .method = "textDocument/linkedEditingRange", .documentation = "A request to provide ranges that can be edited together.\n\n@since 3.16.0", - .direction = .client_to_server, + .direction = .clientToServer, .Params = LinkedEditingRangeParams, .Result = ?LinkedEditingRanges, .PartialResult = null, @@ -8790,7 +7075,7 @@ pub const request_metadata = [_]RequestMetadata{ .{ .method = "workspace/willCreateFiles", .documentation = "The will create files request is sent from the client to the server before files are actually\ncreated as long as the creation is triggered from within the client.\n\nThe request can return a `WorkspaceEdit` which will be applied to workspace before the\nfiles are created. Hence the `WorkspaceEdit` can not manipulate the content of the file\nto be created.\n\n@since 3.16.0", - .direction = .client_to_server, + .direction = .clientToServer, .Params = CreateFilesParams, .Result = ?WorkspaceEdit, .PartialResult = null, @@ -8804,7 +7089,7 @@ pub const request_metadata = [_]RequestMetadata{ .{ .method = "workspace/willRenameFiles", .documentation = "The will rename files request is sent from the client to the server before files are actually\nrenamed as long as the rename is triggered from within the client.\n\n@since 3.16.0", - .direction = .client_to_server, + .direction = .clientToServer, .Params = RenameFilesParams, .Result = ?WorkspaceEdit, .PartialResult = null, @@ -8818,7 +7103,7 @@ pub const request_metadata = [_]RequestMetadata{ .{ .method = "workspace/willDeleteFiles", .documentation = "The did delete files notification is sent from the client to the server when\nfiles were deleted from within the client.\n\n@since 3.16.0", - .direction = .client_to_server, + .direction = .clientToServer, .Params = DeleteFilesParams, .Result = ?WorkspaceEdit, .PartialResult = null, @@ -8831,7 +7116,7 @@ pub const request_metadata = [_]RequestMetadata{ .{ .method = "textDocument/moniker", .documentation = "A request to get the moniker of a symbol at a given text document position.\nThe request parameter is of type {@link TextDocumentPositionParams}.\nThe response is of type {@link Moniker Moniker[]} or `null`.", - .direction = .client_to_server, + .direction = .clientToServer, .Params = MonikerParams, .Result = ?[]const Moniker, .PartialResult = []const Moniker, @@ -8845,7 +7130,7 @@ pub const request_metadata = [_]RequestMetadata{ .{ .method = "textDocument/prepareTypeHierarchy", .documentation = "A request to result a `TypeHierarchyItem` in a document at a given position.\nCan be used as an input to a subtypes or supertypes type hierarchy.\n\n@since 3.17.0", - .direction = .client_to_server, + .direction = .clientToServer, .Params = TypeHierarchyPrepareParams, .Result = ?[]const TypeHierarchyItem, .PartialResult = null, @@ -8858,7 +7143,7 @@ pub const request_metadata = [_]RequestMetadata{ .{ .method = "typeHierarchy/supertypes", .documentation = "A request to resolve the supertypes for a given `TypeHierarchyItem`.\n\n@since 3.17.0", - .direction = .client_to_server, + .direction = .clientToServer, .Params = TypeHierarchySupertypesParams, .Result = ?[]const TypeHierarchyItem, .PartialResult = []const TypeHierarchyItem, @@ -8871,7 +7156,7 @@ pub const request_metadata = [_]RequestMetadata{ .{ .method = "typeHierarchy/subtypes", .documentation = "A request to resolve the subtypes for a given `TypeHierarchyItem`.\n\n@since 3.17.0", - .direction = .client_to_server, + .direction = .clientToServer, .Params = TypeHierarchySubtypesParams, .Result = ?[]const TypeHierarchyItem, .PartialResult = []const TypeHierarchyItem, @@ -8886,7 +7171,7 @@ pub const request_metadata = [_]RequestMetadata{ .{ .method = "textDocument/inlineValue", .documentation = "A request to provide inline values in a document. The request's parameter is of\ntype {@link InlineValueParams}, the response is of type\n{@link InlineValue InlineValue[]} or a Thenable that resolves to such.\n\n@since 3.17.0", - .direction = .client_to_server, + .direction = .clientToServer, .Params = InlineValueParams, .Result = ?[]const InlineValue, .PartialResult = []const InlineValue, @@ -8897,7 +7182,7 @@ pub const request_metadata = [_]RequestMetadata{ .{ .method = "workspace/inlineValue/refresh", .documentation = "@since 3.17.0", - .direction = .server_to_client, + .direction = .serverToClient, .Params = null, .Result = ?void, .PartialResult = null, @@ -8912,7 +7197,7 @@ pub const request_metadata = [_]RequestMetadata{ .{ .method = "textDocument/inlayHint", .documentation = "A request to provide inlay hints in a document. The request's parameter is of\ntype {@link InlayHintsParams}, the response is of type\n{@link InlayHint InlayHint[]} or a Thenable that resolves to such.\n\n@since 3.17.0", - .direction = .client_to_server, + .direction = .clientToServer, .Params = InlayHintParams, .Result = ?[]const InlayHint, .PartialResult = []const InlayHint, @@ -8927,7 +7212,7 @@ pub const request_metadata = [_]RequestMetadata{ .{ .method = "inlayHint/resolve", .documentation = "A request to resolve additional properties for an inlay hint.\nThe request's parameter is of type {@link InlayHint}, the response is\nof type {@link InlayHint} or a Thenable that resolves to such.\n\n@since 3.17.0", - .direction = .client_to_server, + .direction = .clientToServer, .Params = InlayHint, .Result = InlayHint, .PartialResult = null, @@ -8938,7 +7223,7 @@ pub const request_metadata = [_]RequestMetadata{ .{ .method = "workspace/inlayHint/refresh", .documentation = "@since 3.17.0", - .direction = .server_to_client, + .direction = .serverToClient, .Params = null, .Result = ?void, .PartialResult = null, @@ -8951,7 +7236,7 @@ pub const request_metadata = [_]RequestMetadata{ .{ .method = "textDocument/diagnostic", .documentation = "The document diagnostic request definition.\n\n@since 3.17.0", - .direction = .client_to_server, + .direction = .clientToServer, .Params = DocumentDiagnosticParams, .Result = DocumentDiagnosticReport, .PartialResult = DocumentDiagnosticReportPartialResult, @@ -8964,7 +7249,7 @@ pub const request_metadata = [_]RequestMetadata{ .{ .method = "workspace/diagnostic", .documentation = "The workspace diagnostic request definition.\n\n@since 3.17.0", - .direction = .client_to_server, + .direction = .clientToServer, .Params = WorkspaceDiagnosticParams, .Result = WorkspaceDiagnosticReport, .PartialResult = WorkspaceDiagnosticReportPartialResult, @@ -8977,19 +7262,39 @@ pub const request_metadata = [_]RequestMetadata{ .{ .method = "workspace/diagnostic/refresh", .documentation = "The diagnostic refresh request definition.\n\n@since 3.17.0", - .direction = .server_to_client, + .direction = .serverToClient, .Params = null, .Result = ?void, .PartialResult = null, .ErrorData = null, .registration = .{ .method = null, .Options = null }, }, + // A request to provide inline completions in a document. The request's parameter is of + // type {@link InlineCompletionParams}, the response is of type + // {@link InlineCompletion InlineCompletion[]} or a Thenable that resolves to such. + // + // @since 3.18.0 + // @proposed + .{ + .method = "textDocument/inlineCompletion", + .documentation = "A request to provide inline completions in a document. The request's parameter is of\ntype {@link InlineCompletionParams}, the response is of type\n{@link InlineCompletion InlineCompletion[]} or a Thenable that resolves to such.\n\n@since 3.18.0\n@proposed", + .direction = .clientToServer, + .Params = InlineCompletionParams, + .Result = ?union(enum) { + InlineCompletionList: InlineCompletionList, + array_of_InlineCompletionItem: []const InlineCompletionItem, + pub usingnamespace UnionParser(@This()); + }, + .PartialResult = []const InlineCompletionItem, + .ErrorData = null, + .registration = .{ .method = null, .Options = InlineCompletionRegistrationOptions }, + }, // The `client/registerCapability` request is sent from the server to the client to register a new capability // handler on the client side. .{ .method = "client/registerCapability", .documentation = "The `client/registerCapability` request is sent from the server to the client to register a new capability\nhandler on the client side.", - .direction = .server_to_client, + .direction = .serverToClient, .Params = RegistrationParams, .Result = ?void, .PartialResult = null, @@ -9001,7 +7306,7 @@ pub const request_metadata = [_]RequestMetadata{ .{ .method = "client/unregisterCapability", .documentation = "The `client/unregisterCapability` request is sent from the server to the client to unregister a previously registered capability\nhandler on the client side.", - .direction = .server_to_client, + .direction = .serverToClient, .Params = UnregistrationParams, .Result = ?void, .PartialResult = null, @@ -9016,7 +7321,7 @@ pub const request_metadata = [_]RequestMetadata{ .{ .method = "initialize", .documentation = "The initialize request is sent from the client to the server.\nIt is sent once as the request after starting up the server.\nThe requests parameter is of type {@link InitializeParams}\nthe response if of type {@link InitializeResult} of a Thenable that\nresolves to such.", - .direction = .client_to_server, + .direction = .clientToServer, .Params = InitializeParams, .Result = InitializeResult, .PartialResult = null, @@ -9030,7 +7335,7 @@ pub const request_metadata = [_]RequestMetadata{ .{ .method = "shutdown", .documentation = "A shutdown request is sent from the client to the server.\nIt is sent once when the client decides to shutdown the\nserver. The only notification that is sent after a shutdown request\nis the exit event.", - .direction = .client_to_server, + .direction = .clientToServer, .Params = null, .Result = ?void, .PartialResult = null, @@ -9042,7 +7347,7 @@ pub const request_metadata = [_]RequestMetadata{ .{ .method = "window/showMessageRequest", .documentation = "The show message request is sent from the server to the client to show a message\nand a set of options actions to the user.", - .direction = .server_to_client, + .direction = .serverToClient, .Params = ShowMessageRequestParams, .Result = ?MessageActionItem, .PartialResult = null, @@ -9058,7 +7363,7 @@ pub const request_metadata = [_]RequestMetadata{ .{ .method = "textDocument/willSaveWaitUntil", .documentation = "A document will save request is sent from the client to the server before\nthe document is actually saved. The request can return an array of TextEdits\nwhich will be applied to the text document before it is saved. Please note that\nclients might drop results if computing the text edits took too long or if a\nserver constantly fails on this request. This is done to keep the save fast and\nreliable.", - .direction = .client_to_server, + .direction = .clientToServer, .Params = WillSaveTextDocumentParams, .Result = ?[]const TextEdit, .PartialResult = null, @@ -9077,11 +7382,12 @@ pub const request_metadata = [_]RequestMetadata{ .{ .method = "textDocument/completion", .documentation = "Request to request completion at a given text document position. The request's\nparameter is of type {@link TextDocumentPosition} the response\nis of type {@link CompletionItem CompletionItem[]} or {@link CompletionList}\nor a Thenable that resolves to such.\n\nThe request can delay the computation of the {@link CompletionItem.detail `detail`}\nand {@link CompletionItem.documentation `documentation`} properties to the `completionItem/resolve`\nrequest. However, properties that are needed for the initial sorting and filtering, like `sortText`,\n`filterText`, `insertText`, and `textEdit`, must not be changed during resolve.", - .direction = .client_to_server, + .direction = .clientToServer, .Params = CompletionParams, .Result = ?union(enum) { array_of_CompletionItem: []const CompletionItem, CompletionList: CompletionList, + pub usingnamespace UnionParser(@This()); }, .PartialResult = []const CompletionItem, .ErrorData = null, @@ -9093,7 +7399,7 @@ pub const request_metadata = [_]RequestMetadata{ .{ .method = "completionItem/resolve", .documentation = "Request to resolve additional information for a given completion item.The request's\nparameter is of type {@link CompletionItem} the response\nis of type {@link CompletionItem} or a Thenable that resolves to such.", - .direction = .client_to_server, + .direction = .clientToServer, .Params = CompletionItem, .Result = CompletionItem, .PartialResult = null, @@ -9106,7 +7412,7 @@ pub const request_metadata = [_]RequestMetadata{ .{ .method = "textDocument/hover", .documentation = "Request to request hover information at a given text document position. The request's\nparameter is of type {@link TextDocumentPosition} the response is of\ntype {@link Hover} or a Thenable that resolves to such.", - .direction = .client_to_server, + .direction = .clientToServer, .Params = HoverParams, .Result = ?Hover, .PartialResult = null, @@ -9116,7 +7422,7 @@ pub const request_metadata = [_]RequestMetadata{ .{ .method = "textDocument/signatureHelp", .documentation = null, - .direction = .client_to_server, + .direction = .clientToServer, .Params = SignatureHelpParams, .Result = ?SignatureHelp, .PartialResult = null, @@ -9131,15 +7437,17 @@ pub const request_metadata = [_]RequestMetadata{ .{ .method = "textDocument/definition", .documentation = "A request to resolve the definition location of a symbol at a given text\ndocument position. The request's parameter is of type [TextDocumentPosition]\n(#TextDocumentPosition) the response is of either type {@link Definition}\nor a typed array of {@link DefinitionLink} or a Thenable that resolves\nto such.", - .direction = .client_to_server, + .direction = .clientToServer, .Params = DefinitionParams, .Result = ?union(enum) { Definition: Definition, array_of_DefinitionLink: []const DefinitionLink, + pub usingnamespace UnionParser(@This()); }, .PartialResult = union(enum) { array_of_Location: []const Location, array_of_DefinitionLink: []const DefinitionLink, + pub usingnamespace UnionParser(@This()); }, .ErrorData = null, .registration = .{ .method = null, .Options = DefinitionRegistrationOptions }, @@ -9151,7 +7459,7 @@ pub const request_metadata = [_]RequestMetadata{ .{ .method = "textDocument/references", .documentation = "A request to resolve project-wide references for the symbol denoted\nby the given text document position. The request's parameter is of\ntype {@link ReferenceParams} the response is of type\n{@link Location Location[]} or a Thenable that resolves to such.", - .direction = .client_to_server, + .direction = .clientToServer, .Params = ReferenceParams, .Result = ?[]const Location, .PartialResult = []const Location, @@ -9165,7 +7473,7 @@ pub const request_metadata = [_]RequestMetadata{ .{ .method = "textDocument/documentHighlight", .documentation = "Request to resolve a {@link DocumentHighlight} for a given\ntext document position. The request's parameter is of type [TextDocumentPosition]\n(#TextDocumentPosition) the request response is of type [DocumentHighlight[]]\n(#DocumentHighlight) or a Thenable that resolves to such.", - .direction = .client_to_server, + .direction = .clientToServer, .Params = DocumentHighlightParams, .Result = ?[]const DocumentHighlight, .PartialResult = []const DocumentHighlight, @@ -9179,15 +7487,17 @@ pub const request_metadata = [_]RequestMetadata{ .{ .method = "textDocument/documentSymbol", .documentation = "A request to list all symbols found in a given text document. The request's\nparameter is of type {@link TextDocumentIdentifier} the\nresponse is of type {@link SymbolInformation SymbolInformation[]} or a Thenable\nthat resolves to such.", - .direction = .client_to_server, + .direction = .clientToServer, .Params = DocumentSymbolParams, .Result = ?union(enum) { array_of_SymbolInformation: []const SymbolInformation, array_of_DocumentSymbol: []const DocumentSymbol, + pub usingnamespace UnionParser(@This()); }, .PartialResult = union(enum) { array_of_SymbolInformation: []const SymbolInformation, array_of_DocumentSymbol: []const DocumentSymbol, + pub usingnamespace UnionParser(@This()); }, .ErrorData = null, .registration = .{ .method = null, .Options = DocumentSymbolRegistrationOptions }, @@ -9196,15 +7506,17 @@ pub const request_metadata = [_]RequestMetadata{ .{ .method = "textDocument/codeAction", .documentation = "A request to provide commands for the given text document and range.", - .direction = .client_to_server, + .direction = .clientToServer, .Params = CodeActionParams, .Result = ?[]const union(enum) { Command: Command, CodeAction: CodeAction, + pub usingnamespace UnionParser(@This()); }, .PartialResult = []const union(enum) { Command: Command, CodeAction: CodeAction, + pub usingnamespace UnionParser(@This()); }, .ErrorData = null, .registration = .{ .method = null, .Options = CodeActionRegistrationOptions }, @@ -9215,7 +7527,7 @@ pub const request_metadata = [_]RequestMetadata{ .{ .method = "codeAction/resolve", .documentation = "Request to resolve additional information for a given code action.The request's\nparameter is of type {@link CodeAction} the response\nis of type {@link CodeAction} or a Thenable that resolves to such.", - .direction = .client_to_server, + .direction = .clientToServer, .Params = CodeAction, .Result = CodeAction, .PartialResult = null, @@ -9234,15 +7546,17 @@ pub const request_metadata = [_]RequestMetadata{ .{ .method = "workspace/symbol", .documentation = "A request to list project-wide symbols matching the query string given\nby the {@link WorkspaceSymbolParams}. The response is\nof type {@link SymbolInformation SymbolInformation[]} or a Thenable that\nresolves to such.\n\n@since 3.17.0 - support for WorkspaceSymbol in the returned data. Clients\n need to advertise support for WorkspaceSymbols via the client capability\n `workspace.symbol.resolveSupport`.\n", - .direction = .client_to_server, + .direction = .clientToServer, .Params = WorkspaceSymbolParams, .Result = ?union(enum) { array_of_SymbolInformation: []const SymbolInformation, array_of_WorkspaceSymbol: []const WorkspaceSymbol, + pub usingnamespace UnionParser(@This()); }, .PartialResult = union(enum) { array_of_SymbolInformation: []const SymbolInformation, array_of_WorkspaceSymbol: []const WorkspaceSymbol, + pub usingnamespace UnionParser(@This()); }, .ErrorData = null, .registration = .{ .method = null, .Options = WorkspaceSymbolRegistrationOptions }, @@ -9254,7 +7568,7 @@ pub const request_metadata = [_]RequestMetadata{ .{ .method = "workspaceSymbol/resolve", .documentation = "A request to resolve the range inside the workspace\nsymbol's location.\n\n@since 3.17.0", - .direction = .client_to_server, + .direction = .clientToServer, .Params = WorkspaceSymbol, .Result = WorkspaceSymbol, .PartialResult = null, @@ -9265,7 +7579,7 @@ pub const request_metadata = [_]RequestMetadata{ .{ .method = "textDocument/codeLens", .documentation = "A request to provide code lens for the given text document.", - .direction = .client_to_server, + .direction = .clientToServer, .Params = CodeLensParams, .Result = ?[]const CodeLens, .PartialResult = []const CodeLens, @@ -9276,7 +7590,7 @@ pub const request_metadata = [_]RequestMetadata{ .{ .method = "codeLens/resolve", .documentation = "A request to resolve a command for a given code lens.", - .direction = .client_to_server, + .direction = .clientToServer, .Params = CodeLens, .Result = CodeLens, .PartialResult = null, @@ -9289,7 +7603,7 @@ pub const request_metadata = [_]RequestMetadata{ .{ .method = "workspace/codeLens/refresh", .documentation = "A request to refresh all code actions\n\n@since 3.16.0", - .direction = .server_to_client, + .direction = .serverToClient, .Params = null, .Result = ?void, .PartialResult = null, @@ -9300,7 +7614,7 @@ pub const request_metadata = [_]RequestMetadata{ .{ .method = "textDocument/documentLink", .documentation = "A request to provide document links", - .direction = .client_to_server, + .direction = .clientToServer, .Params = DocumentLinkParams, .Result = ?[]const DocumentLink, .PartialResult = []const DocumentLink, @@ -9313,7 +7627,7 @@ pub const request_metadata = [_]RequestMetadata{ .{ .method = "documentLink/resolve", .documentation = "Request to resolve additional information for a given document link. The request's\nparameter is of type {@link DocumentLink} the response\nis of type {@link DocumentLink} or a Thenable that resolves to such.", - .direction = .client_to_server, + .direction = .clientToServer, .Params = DocumentLink, .Result = DocumentLink, .PartialResult = null, @@ -9324,7 +7638,7 @@ pub const request_metadata = [_]RequestMetadata{ .{ .method = "textDocument/formatting", .documentation = "A request to format a whole document.", - .direction = .client_to_server, + .direction = .clientToServer, .Params = DocumentFormattingParams, .Result = ?[]const TextEdit, .PartialResult = null, @@ -9335,18 +7649,32 @@ pub const request_metadata = [_]RequestMetadata{ .{ .method = "textDocument/rangeFormatting", .documentation = "A request to format a range in a document.", - .direction = .client_to_server, + .direction = .clientToServer, .Params = DocumentRangeFormattingParams, .Result = ?[]const TextEdit, .PartialResult = null, .ErrorData = null, .registration = .{ .method = null, .Options = DocumentRangeFormattingRegistrationOptions }, }, + // A request to format ranges in a document. + // + // @since 3.18.0 + // @proposed + .{ + .method = "textDocument/rangesFormatting", + .documentation = "A request to format ranges in a document.\n\n@since 3.18.0\n@proposed", + .direction = .clientToServer, + .Params = DocumentRangesFormattingParams, + .Result = ?[]const TextEdit, + .PartialResult = null, + .ErrorData = null, + .registration = .{ .method = null, .Options = DocumentRangeFormattingRegistrationOptions }, + }, // A request to format a document on type. .{ .method = "textDocument/onTypeFormatting", .documentation = "A request to format a document on type.", - .direction = .client_to_server, + .direction = .clientToServer, .Params = DocumentOnTypeFormattingParams, .Result = ?[]const TextEdit, .PartialResult = null, @@ -9357,7 +7685,7 @@ pub const request_metadata = [_]RequestMetadata{ .{ .method = "textDocument/rename", .documentation = "A request to rename a symbol.", - .direction = .client_to_server, + .direction = .clientToServer, .Params = RenameParams, .Result = ?WorkspaceEdit, .PartialResult = null, @@ -9370,7 +7698,7 @@ pub const request_metadata = [_]RequestMetadata{ .{ .method = "textDocument/prepareRename", .documentation = "A request to test and perform the setup necessary for a rename.\n\n@since 3.16 - support for default behavior", - .direction = .client_to_server, + .direction = .clientToServer, .Params = PrepareRenameParams, .Result = ?PrepareRenameResult, .PartialResult = null, @@ -9382,7 +7710,7 @@ pub const request_metadata = [_]RequestMetadata{ .{ .method = "workspace/executeCommand", .documentation = "A request send from the client to the server to execute a command. The request might return\na workspace edit which the client will apply to the workspace.", - .direction = .client_to_server, + .direction = .clientToServer, .Params = ExecuteCommandParams, .Result = ?LSPAny, .PartialResult = null, @@ -9393,7 +7721,7 @@ pub const request_metadata = [_]RequestMetadata{ .{ .method = "workspace/applyEdit", .documentation = "A request sent from the server to the client to modified certain resources.", - .direction = .server_to_client, + .direction = .serverToClient, .Params = ApplyWorkspaceEditParams, .Result = ApplyWorkspaceEditResult, .PartialResult = null, diff --git a/src/main.zig b/src/main.zig index a94eb55b1..261be8209 100644 --- a/src/main.zig +++ b/src/main.zig @@ -3,7 +3,6 @@ const zig_builtin = @import("builtin"); const build_options = @import("build_options"); const tracy = @import("tracy.zig"); const known_folders = @import("known-folders"); -const tres = @import("tres"); const Config = @import("Config.zig"); const configuration = @import("configuration.zig"); const Server = @import("Server.zig"); @@ -135,7 +134,7 @@ fn updateConfig( var buffer = std.ArrayListUnmanaged(u8){}; defer buffer.deinit(allocator); - try tres.stringify(cfg, .{}, buffer.writer(allocator)); + try std.json.stringify(cfg, .{}, buffer.writer(allocator)); const header = Header{ .content_length = buffer.items.len }; try header.write(false, file.writer()); try file.writeAll(buffer.items); diff --git a/tests/context.zig b/tests/context.zig index fd8a0d647..a0ecdba2b 100644 --- a/tests/context.zig +++ b/tests/context.zig @@ -2,8 +2,6 @@ const std = @import("std"); const zls = @import("zls"); const builtin = @import("builtin"); -const tres = @import("tres"); - const Header = zls.Header; const Config = zls.Config; const Server = zls.Server; @@ -38,6 +36,7 @@ pub const Context = struct { pub fn init() !Context { var config = try allocator.create(Config); errdefer allocator.destroy(config); + errdefer zls.legacy_json.parseFree(Config, allocator, config.*); config.* = default_config; @@ -176,9 +175,9 @@ pub const Context = struct { pub fn Response(comptime Result: type) type { return struct { - jsonrpc: []const u8, + jsonrpc: []const u8 = "2.0", id: types.RequestId, - result: Result, + result: Result = null, }; } @@ -186,15 +185,15 @@ pub const Context = struct { var buffer = std.ArrayListUnmanaged(u8){}; defer buffer.deinit(allocator); - try tres.stringify(params, .{}, buffer.writer(allocator)); + try std.json.stringify(params, .{ .emit_null_optional_fields = false }, buffer.writer(allocator)); const response_bytes = try self.requestAlloc(method, buffer.items); defer self.server.allocator.free(response_bytes); - var tree = try std.json.parseFromSlice(std.json.Value, self.arena.allocator(), try self.arena.allocator().dupe(u8, response_bytes), .{}); + const tree = try std.json.parseFromSliceLeaky(std.json.Value, self.arena.allocator(), try self.arena.allocator().dupe(u8, response_bytes), .{}); // TODO validate jsonrpc and id - return tres.parse(Response(Result), tree.value, self.arena.allocator()); + return try std.json.parseFromValueLeaky(Response(Result), self.arena.allocator(), tree, .{}); } }; diff --git a/tests/lsp_features/code_actions.zig b/tests/lsp_features/code_actions.zig index a83f0451e..8c102daff 100644 --- a/tests/lsp_features/code_actions.zig +++ b/tests/lsp_features/code_actions.zig @@ -150,15 +150,20 @@ fn testAutofix(before: []const u8, after: []const u8) !void { }; @setEvalBranchQuota(5000); - const response = try ctx.requestGetResponse([]types.CodeAction, "textDocument/codeAction", params); + const response = try ctx.requestGetResponse(?[]types.CodeAction, "textDocument/codeAction", params); + + const code_action_list: []types.CodeAction = response.result orelse { + std.debug.print("Server returned `null` as the result\n", .{}); + return error.InvalidResponse; + }; var text_edits: std.ArrayListUnmanaged(types.TextEdit) = .{}; defer text_edits.deinit(allocator); - for (response.result) |code_action| { + for (code_action_list) |code_action| { if (code_action.kind.? != .@"source.fixAll") continue; const workspace_edit = code_action.edit.?; - const changes = workspace_edit.changes.?; + const changes = workspace_edit.changes.?.map; try std.testing.expectEqual(@as(usize, 1), changes.count()); try std.testing.expect(changes.contains(uri)); diff --git a/tests/lsp_features/document_symbol.zig b/tests/lsp_features/document_symbol.zig index 5410dba75..792efcdb3 100644 --- a/tests/lsp_features/document_symbol.zig +++ b/tests/lsp_features/document_symbol.zig @@ -2,8 +2,6 @@ const std = @import("std"); const zls = @import("zls"); const builtin = @import("builtin"); -const tres = @import("tres"); - const Context = @import("../context.zig").Context; const types = zls.types; @@ -70,7 +68,12 @@ fn testDocumentSymbol(source: []const u8, want: []const u8) !void { .textDocument = .{ .uri = test_uri }, }; - const response = try ctx.requestGetResponse([]types.DocumentSymbol, "textDocument/documentSymbol", params); + const response = try ctx.requestGetResponse(?[]types.DocumentSymbol, "textDocument/documentSymbol", params); + + const document_symbol_list: []types.DocumentSymbol = response.result orelse { + std.debug.print("Server returned `null` as the result\n", .{}); + return error.InvalidResponse; + }; var got = std.ArrayListUnmanaged(u8){}; defer got.deinit(allocator); @@ -78,7 +81,7 @@ fn testDocumentSymbol(source: []const u8, want: []const u8) !void { var stack: [16][]const types.DocumentSymbol = undefined; var stack_len: usize = 0; - stack[stack_len] = response.result; + stack[stack_len] = document_symbol_list; stack_len += 1; var writer = got.writer(allocator); diff --git a/tests/lsp_features/folding_range.zig b/tests/lsp_features/folding_range.zig index 12c18cc5e..bc23e0955 100644 --- a/tests/lsp_features/folding_range.zig +++ b/tests/lsp_features/folding_range.zig @@ -2,8 +2,6 @@ const std = @import("std"); const zls = @import("zls"); const builtin = @import("builtin"); -const tres = @import("tres"); - const Context = @import("../context.zig").Context; const types = zls.types; @@ -230,8 +228,8 @@ fn testFoldingRange(source: []const u8, expect: []const types.FoldingRange) !voi defer expected.deinit(allocator); const options = std.json.StringifyOptions{ .emit_null_optional_fields = false }; - try tres.stringify(response.result, options, actual.writer(allocator)); - try tres.stringify(expect, options, expected.writer(allocator)); + try std.json.stringify(response.result, options, actual.writer(allocator)); + try std.json.stringify(expect, options, expected.writer(allocator)); // TODO: Actually compare strings as JSON values. try std.testing.expectEqualStrings(expected.items, actual.items); diff --git a/tests/lsp_features/inlay_hints.zig b/tests/lsp_features/inlay_hints.zig index f7fcc3bac..c76ab52ed 100644 --- a/tests/lsp_features/inlay_hints.zig +++ b/tests/lsp_features/inlay_hints.zig @@ -102,20 +102,14 @@ fn testInlayHints(source: []const u8) !void { .end = offsets.indexToPosition(phr.new_source, phr.new_source.len, .@"utf-16"), }; - const InlayHint = struct { - position: types.Position, - label: []const u8, - kind: types.InlayHintKind, - }; - const params = types.InlayHintParams{ .textDocument = .{ .uri = test_uri }, .range = range, }; - const response = try ctx.requestGetResponse(?[]InlayHint, "textDocument/inlayHint", params); + const response = try ctx.requestGetResponse(?[]types.InlayHint, "textDocument/inlayHint", params); - const hints: []InlayHint = response.result orelse { + const hints: []types.InlayHint = response.result orelse { std.debug.print("Server returned `null` as the result\n", .{}); return error.InvalidResponse; }; @@ -139,16 +133,16 @@ fn testInlayHints(source: []const u8) !void { for (hints) |hint| { if (position.line != hint.position.line or position.character != hint.position.character) continue; - if (!std.mem.endsWith(u8, hint.label, ":")) { - try error_builder.msgAtLoc("label `{s}` must end with a colon!", test_uri, new_loc, .err, .{hint.label}); + if (!std.mem.endsWith(u8, hint.label.string, ":")) { + try error_builder.msgAtLoc("label `{s}` must end with a colon!", test_uri, new_loc, .err, .{hint.label.string}); } - const actual_label = hint.label[0 .. hint.label.len - 1]; + const actual_label = hint.label.string[0 .. hint.label.string.len - 1]; if (!std.mem.eql(u8, expected_label, actual_label)) { try error_builder.msgAtLoc("expected label `{s}` here but got `{s}`!", test_uri, new_loc, .err, .{ expected_label, actual_label }); } if (hint.kind != types.InlayHintKind.Parameter) { - try error_builder.msgAtLoc("hint kind should be `{s}` but got `{s}`!", test_uri, new_loc, .err, .{ @tagName(types.InlayHintKind.Parameter), @tagName(hint.kind) }); + try error_builder.msgAtLoc("hint kind should be `{s}` but got `{s}`!", test_uri, new_loc, .err, .{ @tagName(types.InlayHintKind.Parameter), @tagName(hint.kind.?) }); } continue :outer; diff --git a/tests/lsp_features/semantic_tokens.zig b/tests/lsp_features/semantic_tokens.zig index 261cece0c..a3a1c5936 100644 --- a/tests/lsp_features/semantic_tokens.zig +++ b/tests/lsp_features/semantic_tokens.zig @@ -1021,12 +1021,17 @@ fn testSemanticTokens(source: [:0]const u8, expected_tokens: []const TokenData) const uri = try ctx.addDocument(source); const response = try ctx.requestGetResponse( - types.SemanticTokens, + ?types.SemanticTokens, "textDocument/semanticTokens/full", types.SemanticTokensParams{ .textDocument = .{ .uri = uri } }, ); - const actual = response.result.data; + const semantic_tokens: types.SemanticTokens = response.result orelse { + std.debug.print("Server returned `null` as the result\n", .{}); + return error.InvalidResponse; + }; + + const actual = semantic_tokens.data; try std.testing.expect(actual.len % 5 == 0); // every token is represented by 5 integers var error_builder = ErrorBuilder.init(allocator); From ba74e05f93fea2625efd3ad9bd72bb7c2425d71e Mon Sep 17 00:00:00 2001 From: techatrix <19954306+Techatrix@users.noreply.github.com> Date: Thu, 13 Jul 2023 02:38:55 +0200 Subject: [PATCH 2/2] work around zig bug https://github.com/ziglang/zig/issues/16392 --- src/Server.zig | 115 ++++++++++++++++++++----------------------------- 1 file changed, 46 insertions(+), 69 deletions(-) diff --git a/src/Server.zig b/src/Server.zig index 24ff03c39..aa0ee1542 100644 --- a/src/Server.zig +++ b/src/Server.zig @@ -1262,48 +1262,19 @@ fn notificationMethodExists(method: []const u8) bool { } else false; } -const Message = union(enum) { - RequestMessage: struct { - id: types.RequestId, - method: []const u8, - /// may be null - params: types.LSPAny, +const Message = struct { + kind: enum { + RequestMessage, + NotificationMessage, + ResponseMessage, }, - NotificationMessage: struct { - method: []const u8, - /// may be null - params: types.LSPAny, - }, - ResponseMessage: struct { - id: types.RequestId, - /// non null on success - result: types.LSPAny, - @"error": ?types.ResponseError, - }, - - pub fn id(self: Message) ?types.RequestId { - return switch (self) { - .RequestMessage => |request| request.id, - .NotificationMessage => null, - .ResponseMessage => |response| response.id, - }; - } - - pub fn method(self: Message) ?[]const u8 { - return switch (self) { - .RequestMessage => |request| request.method, - .NotificationMessage => |notification| notification.method, - .ResponseMessage => null, - }; - } - pub fn params(self: Message) ?types.LSPAny { - return switch (self) { - .RequestMessage => |request| request.params, - .NotificationMessage => |notification| notification.params, - .ResponseMessage => null, - }; - } + id: ?types.RequestId = null, + method: ?[]const u8 = null, + params: ?types.LSPAny = null, + /// non null on success + result: ?types.LSPAny = null, + @"error": ?types.ResponseError = null, pub fn jsonParseFromValue( allocator: std.mem.Allocator, @@ -1327,11 +1298,12 @@ const Message = union(enum) { const msg_params = object.get("params") orelse .null; - return .{ .RequestMessage = .{ + return .{ + .kind = .RequestMessage, .id = msg_id, .method = msg_method, .params = msg_params, - } }; + }; } else { const result = object.get("result") orelse .null; const error_obj = object.get("error") orelse .null; @@ -1340,11 +1312,12 @@ const Message = union(enum) { if (result != .null and err != null) return error.UnexpectedToken; - return .{ .ResponseMessage = .{ + return .{ + .kind = .ResponseMessage, .id = msg_id, .result = result, .@"error" = err, - } }; + }; } } else { const msg_method = switch (object.get("method") orelse return error.UnexpectedToken) { @@ -1354,10 +1327,11 @@ const Message = union(enum) { const msg_params = object.get("params") orelse .null; - return .{ .NotificationMessage = .{ + return .{ + .kind = .NotificationMessage, .method = msg_method, .params = msg_params, - } }; + }; } } }; @@ -1379,8 +1353,8 @@ pub fn processJsonRpc( return; // maybe panic? }; - server.processMessage(message) catch |err| switch (message) { - .RequestMessage => |request| server.sendResponseError(request.id, .{ + server.processMessage(message) catch |err| switch (message.kind) { + .RequestMessage => server.sendResponseError(message.id.?, .{ .code = @intFromError(err), .message = @errorName(err), }), @@ -1401,35 +1375,38 @@ pub fn processMessage(server: *Server, message: Message) Error!void { const tracy_zone = tracy.trace(@src()); defer tracy_zone.end(); - switch (message) { - .RequestMessage => |request| { - if (!requestMethodExists(request.method)) return error.MethodNotFound; + switch (message.kind) { + .RequestMessage => { + if (!requestMethodExists(message.method.?)) return error.MethodNotFound; }, - .NotificationMessage => |notification| { - if (!notificationMethodExists(notification.method)) return error.MethodNotFound; + .NotificationMessage => { + if (!notificationMethodExists(message.method.?)) return error.MethodNotFound; }, - .ResponseMessage => |response| { - if (response.id != .string) return; - if (std.mem.startsWith(u8, response.id.string, "register")) { - if (response.@"error") |err| { - log.err("Error response for '{s}': {}, {s}", .{ response.id.string, err.code, err.message }); + .ResponseMessage => { + const id = switch (message.id.?) { + .string => |str| str, + .integer => return, + }; + if (std.mem.startsWith(u8, id, "register")) { + if (message.@"error") |err| { + log.err("Error response for '{s}': {}, {s}", .{ id, err.code, err.message }); } return; } - if (std.mem.eql(u8, response.id.string, "apply_edit")) return; + if (std.mem.eql(u8, id, "apply_edit")) return; - if (std.mem.eql(u8, response.id.string, "i_haz_configuration")) { - if (response.@"error" != null) return; - try server.handleConfiguration(response.result); + if (std.mem.eql(u8, id, "i_haz_configuration")) { + if (message.@"error" != null) return; + try server.handleConfiguration(message.result.?); return; } - log.warn("received response from client with id '{s}' that has no handler!", .{response.id.string}); + log.warn("received response from client with id '{s}' that has no handler!", .{id}); return; }, } - const method = message.method().?; // message cannot be a ResponseMessage + const method = message.method.?; // message cannot be a ResponseMessage switch (server.status) { .uninitialized => blk: { @@ -1519,7 +1496,7 @@ pub fn processMessage(server: *Server, message: Message) Error!void { const params: ParamsType = if (ParamsType == void) void{} else - std.json.parseFromValueLeaky(ParamsType, server.arena.allocator(), message.params().?, .{}) catch |err| { + std.json.parseFromValueLeaky(ParamsType, server.arena.allocator(), message.params.?, .{}) catch |err| { log.err("failed to parse params from {s}: {}", .{ method, err }); if (@errorReturnTrace()) |trace| { std.debug.dumpStackTrace(trace.*); @@ -1543,16 +1520,16 @@ pub fn processMessage(server: *Server, message: Message) Error!void { if (@TypeOf(response) == void) return; - if (message == .RequestMessage) { - server.sendResponse(message.RequestMessage.id, response); + if (message.kind == .RequestMessage) { + server.sendResponse(message.id.?, response); } return; } } - switch (message) { - .RequestMessage => |request| server.sendResponse(request.id, null), + switch (message.kind) { + .RequestMessage => server.sendResponse(message.id.?, null), .NotificationMessage => return, .ResponseMessage => unreachable, }