File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -109,6 +109,7 @@ pub const Handler = struct {
109109 },
110110 },
111111 .hoverProvider = .{ .bool = true },
112+ .completionProvider = .{ .triggerCharacters = &.{"." } },
112113 };
113114
114115 // Tries to validate that our server capabilities are actually implemented.
@@ -256,6 +257,33 @@ pub const Handler = struct {
256257 };
257258 }
258259
260+ pub fn @"textDocument/completion" (
261+ _ : * Handler ,
262+ arena : std.mem.Allocator ,
263+ params : lsp.types.CompletionParams ,
264+ ) error {OutOfMemory }! lsp .ResultType ("textDocument/completion" ) {
265+ std .log .debug ("Received 'textDocument/completion' notification" , .{});
266+
267+ if (params .context ) | context | {
268+ std .log .info ("completion triggered by {?s} {t}" , .{
269+ context .triggerCharacter ,
270+ context .triggerKind ,
271+ });
272+ }
273+
274+ const completions = try arena .dupe (lsp .types .CompletionItem , &.{
275+ .{
276+ .label = "get" ,
277+ .detail = "get the value" ,
278+ },
279+ .{
280+ .label = "set" ,
281+ .detail = "set the value" ,
282+ },
283+ });
284+ return .{ .array_of_CompletionItem = completions };
285+ }
286+
259287 /// We received a response message from the client/editor.
260288 pub fn onResponse (
261289 _ : * Handler ,
You can’t perform that action at this time.
0 commit comments