From f3889cfe8dc821cf5465a35d7ed926b2dfdf6319 Mon Sep 17 00:00:00 2001 From: Techatrix <19954306+Techatrix@users.noreply.github.com> Date: Wed, 28 Sep 2022 18:07:24 +0200 Subject: [PATCH] explicit request didSave notification from client (#676) --- src/Server.zig | 6 +++++- src/types.zig | 22 ++++++++++++++-------- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/src/Server.zig b/src/Server.zig index c10ba73..a1c304e 100644 --- a/src/Server.zig +++ b/src/Server.zig @@ -1532,7 +1532,11 @@ fn initializeHandler(server: *Server, writer: anytype, id: types.RequestId, req: .triggerCharacters = &.{"("}, .retriggerCharacters = &.{","}, }, - .textDocumentSync = .Full, + .textDocumentSync = .{ + .openClose = true, + .change = .Full, + .save = true, + }, .renameProvider = true, .completionProvider = .{ .resolveProvider = false, .triggerCharacters = &[_][]const u8{ ".", ":", "@", "]" }, .completionItem = .{ .labelDetailsSupport = true } }, .documentHighlightProvider = true, diff --git a/src/types.zig b/src/types.zig index 1ce356a..72faf5b 100644 --- a/src/types.zig +++ b/src/types.zig @@ -429,6 +429,16 @@ pub const PositionEncodingKind = enum { } }; +const TextDocumentSyncKind = enum(u32) { + None = 0, + Full = 1, + Incremental = 2, + + pub fn jsonStringify(value: @This(), options: std.json.StringifyOptions, out_stream: anytype) !void { + try std.json.stringify(@enumToInt(value), options, out_stream); + } +}; + // Only includes options we set in our initialize result. const InitializeResult = struct { offsetEncoding: PositionEncodingKind, @@ -437,14 +447,10 @@ const InitializeResult = struct { triggerCharacters: []const string, retriggerCharacters: []const string, }, - textDocumentSync: enum(u32) { - None = 0, - Full = 1, - Incremental = 2, - - pub fn jsonStringify(value: @This(), options: std.json.StringifyOptions, out_stream: anytype) !void { - try std.json.stringify(@enumToInt(value), options, out_stream); - } + textDocumentSync: struct { + openClose: bool, + change: TextDocumentSyncKind, + save: bool, }, renameProvider: bool, completionProvider: struct {