Skip to content

Commit 8ddd735

Browse files
committed
fix inlay hints with lambda expressions
when the type cannot be determined for a lambda expression the InlayHint will be generated with a null `label` which is not valid per spec and is causing an error in neovim
1 parent 31cb511 commit 8ddd735

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/server.vala

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2201,12 +2201,14 @@ class Vls.Server : Jsonrpc.Server {
22012201
var lambda = (Vala.LambdaExpression)item;
22022202
foreach (var param in lambda.get_parameters ()) {
22032203
var range = new Range.from_sourceref (param.source_reference);
2204-
hints += new InlayHint () {
2205-
position = range.start,
2206-
label = CodeHelp.get_data_type_representation (param.variable_type, null),
2207-
kind = InlayHintKind.PARAMETER,
2208-
paddingRight = true
2209-
};
2204+
if (param.variable_type != null) {
2205+
hints += new InlayHint () {
2206+
position = range.start,
2207+
label = CodeHelp.get_data_type_representation (param.variable_type, null),
2208+
kind = InlayHintKind.PARAMETER,
2209+
paddingRight = true
2210+
};
2211+
}
22102212
}
22112213
} else if ((item is Vala.MethodCall || item is Vala.ObjectCreationExpression) && compilation.method_calls.has_key (item)) {
22122214
Vala.List<Vala.Parameter>? parameters = null;

0 commit comments

Comments
 (0)