From 33f03d36a54f2e65561b4d826c3b8914800b7a24 Mon Sep 17 00:00:00 2001 From: Benjamin Tan Date: Mon, 5 Apr 2021 22:25:11 +0800 Subject: [PATCH 1/2] completion: Add `insertText` field for enum completions Another bug with the older version of lsp-mode on Emacs prevents the label from being inserted when there is an empty `insertText`. This commit adds an `insertText` property to enum completions for consistency with the rest of the completion items. --- src/analysis.zig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/analysis.zig b/src/analysis.zig index 13b00af..cb5dbf8 100644 --- a/src/analysis.zig +++ b/src/analysis.zig @@ -2672,6 +2672,8 @@ fn makeScopeInternal( try enum_completions.put(allocator, .{ .label = name, .kind = .Constant, + .insertText = name, + .insertTextFormat = .PlainText, .documentation = if (try getDocComments(allocator, tree, decl, .Markdown)) |docs| .{ .kind = .Markdown, .value = docs, From 36ea1975bd5070dc2f2e208d1d25d055e2df0306 Mon Sep 17 00:00:00 2001 From: Benjamin Tan Date: Mon, 5 Apr 2021 22:27:38 +0800 Subject: [PATCH 2/2] Standardize `insertText` to be above `insertTextFormat` --- src/analysis.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/analysis.zig b/src/analysis.zig index cb5dbf8..5156721 100644 --- a/src/analysis.zig +++ b/src/analysis.zig @@ -2602,8 +2602,8 @@ fn makeScopeInternal( try error_completions.put(allocator, .{ .label = tree.tokenSlice(i), .kind = .Constant, - .insertTextFormat = .PlainText, .insertText = tree.tokenSlice(i), + .insertTextFormat = .PlainText, }, {}); } }