fix: avoid "error invalid JSON in LSP initialization options" messge when there are no options
This commit is contained in:
parent
0143a7148a
commit
5fd499d141
1 changed files with 4 additions and 0 deletions
|
|
@ -2027,6 +2027,10 @@ fn send_lsp_init_request(self: *Self, lsp: *const LSP, project_path: []const u8,
|
||||||
const version = if (root.version.len > 0 and root.version[0] == 'v') root.version[1..] else root.version;
|
const version = if (root.version.len > 0 and root.version[0] == 'v') root.version[1..] else root.version;
|
||||||
const initializationOptions: struct {
|
const initializationOptions: struct {
|
||||||
pub fn cborEncode(ctx: @This(), writer: *std.Io.Writer) std.io.Writer.Error!void {
|
pub fn cborEncode(ctx: @This(), writer: *std.Io.Writer) std.io.Writer.Error!void {
|
||||||
|
if (ctx.language_server_options.len == 0) {
|
||||||
|
try cbor.writeValue(writer, null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
const toCbor = cbor.fromJsonAlloc(ctx.self.allocator, ctx.language_server_options) catch {
|
const toCbor = cbor.fromJsonAlloc(ctx.self.allocator, ctx.language_server_options) catch {
|
||||||
try cbor.writeValue(writer, null);
|
try cbor.writeValue(writer, null);
|
||||||
ctx.self.logger_lsp.print_err("init", "ignored invalid JSON in LSP initialization options", .{});
|
ctx.self.logger_lsp.print_err("init", "ignored invalid JSON in LSP initialization options", .{});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue