fix bug with latest pr
This commit is contained in:
parent
b939b9cefa
commit
01b2c2e328
@ -168,11 +168,11 @@ fn publishDiagnostics(document: *types.TextDocument) !void {
|
|||||||
while (decls.next()) |decl_ptr| {
|
while (decls.next()) |decl_ptr| {
|
||||||
var decl = decl_ptr.*;
|
var decl = decl_ptr.*;
|
||||||
switch (decl.id) {
|
switch (decl.id) {
|
||||||
.FnProto => {
|
.FnProto => blk: {
|
||||||
const func = decl.cast(std.zig.ast.Node.FnProto).?;
|
const func = decl.cast(std.zig.ast.Node.FnProto).?;
|
||||||
const is_extern = func.extern_export_inline_token != null;
|
const is_extern = func.extern_export_inline_token != null;
|
||||||
if (is_extern)
|
if (is_extern)
|
||||||
break;
|
break :blk;
|
||||||
|
|
||||||
if (func.name_token) |name_token| {
|
if (func.name_token) |name_token| {
|
||||||
const loc = tree.tokenLocation(0, name_token);
|
const loc = tree.tokenLocation(0, name_token);
|
||||||
@ -249,17 +249,19 @@ fn completeGlobal(id: i64, document: *types.TextDocument) !void {
|
|||||||
switch (decl.id) {
|
switch (decl.id) {
|
||||||
.FnProto => {
|
.FnProto => {
|
||||||
const func = decl.cast(std.zig.ast.Node.FnProto).?;
|
const func = decl.cast(std.zig.ast.Node.FnProto).?;
|
||||||
|
if (func.name_token) |name_token| {
|
||||||
var doc_comments = try analysis.getDocComments(&arena.allocator, tree, decl);
|
var doc_comments = try analysis.getDocComments(&arena.allocator, tree, decl);
|
||||||
var doc = types.MarkupContent{
|
var doc = types.MarkupContent{
|
||||||
.kind = .Markdown,
|
.kind = .Markdown,
|
||||||
.value = doc_comments orelse "",
|
.value = doc_comments orelse "",
|
||||||
};
|
};
|
||||||
try completions.append(.{
|
try completions.append(.{
|
||||||
.label = tree.tokenSlice(func.name_token.?),
|
.label = tree.tokenSlice(name_token),
|
||||||
.kind = .Function,
|
.kind = .Function,
|
||||||
.documentation = doc,
|
.documentation = doc,
|
||||||
.detail = analysis.getFunctionSignature(tree, func),
|
.detail = analysis.getFunctionSignature(tree, func),
|
||||||
});
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
.VarDecl => {
|
.VarDecl => {
|
||||||
const var_decl = decl.cast(std.zig.ast.Node.VarDecl).?;
|
const var_decl = decl.cast(std.zig.ast.Node.VarDecl).?;
|
||||||
|
Loading…
Reference in New Issue
Block a user