hotfix
This commit is contained in:
parent
738a9be0cc
commit
b0e21bf82c
@ -38,8 +38,8 @@ pub fn getFunctionDocComments(allocator: *std.mem.Allocator, tree: *std.zig.ast.
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Gets a function definition (keywords, name, return value)
|
/// Gets a function signature (keywords, name, return value)
|
||||||
pub fn getFunctionDefinition(tree: *std.zig.ast.Tree, func: *std.zig.ast.Node.FnProto) []const u8 {
|
pub fn getFunctionSignature(tree: *std.zig.ast.Tree, func: *std.zig.ast.Node.FnProto) []const u8 {
|
||||||
var start = tree.tokens.at(func.firstToken()).start;
|
var start = tree.tokens.at(func.firstToken()).start;
|
||||||
var end =
|
var end =
|
||||||
if (func.body_node) |body| tree.tokens.at(body.firstToken()).start
|
if (func.body_node) |body| tree.tokens.at(body.firstToken()).start
|
||||||
|
@ -141,7 +141,7 @@ pub fn completeGlobal(id: i64, document: types.TextDocument) !void {
|
|||||||
.FnProto => {
|
.FnProto => {
|
||||||
const func = decl.cast(std.zig.ast.Node.FnProto).?;
|
const func = decl.cast(std.zig.ast.Node.FnProto).?;
|
||||||
var doc_comments = try analysis.getFunctionDocComments(allocator, tree, func);
|
var doc_comments = try analysis.getFunctionDocComments(allocator, tree, func);
|
||||||
defer if (doc_comments) |dc| allocator.free(dc);
|
// defer if (doc_comments) |dc| allocator.free(dc);
|
||||||
// var abc = "abc";
|
// var abc = "abc";
|
||||||
// try log("{}", .{abc});
|
// try log("{}", .{abc});
|
||||||
// if (std.mem.eql(u8, tree.tokenSlice(func.name_token.?), name)) return func;
|
// if (std.mem.eql(u8, tree.tokenSlice(func.name_token.?), name)) return func;
|
||||||
@ -153,7 +153,7 @@ pub fn completeGlobal(id: i64, document: types.TextDocument) !void {
|
|||||||
.label = tree.tokenSlice(func.name_token.?),
|
.label = tree.tokenSlice(func.name_token.?),
|
||||||
.kind = types.CompletionItemKind.Function,
|
.kind = types.CompletionItemKind.Function,
|
||||||
.documentation = doc,
|
.documentation = doc,
|
||||||
.detail = analysis.getFunctionDefinition(tree, func)
|
.detail = analysis.getFunctionSignature(tree, func)
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
.VarDecl => {
|
.VarDecl => {
|
||||||
|
Loading…
Reference in New Issue
Block a user