Skip to content

Commit

Permalink
fix inlay hints with lambda expressions
Browse files Browse the repository at this point in the history
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
  • Loading branch information
nyz93 committed Dec 27, 2024
1 parent 31cb511 commit 8ddd735
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/server.vala
Original file line number Diff line number Diff line change
Expand Up @@ -2201,12 +2201,14 @@ class Vls.Server : Jsonrpc.Server {
var lambda = (Vala.LambdaExpression)item;
foreach (var param in lambda.get_parameters ()) {
var range = new Range.from_sourceref (param.source_reference);
hints += new InlayHint () {
position = range.start,
label = CodeHelp.get_data_type_representation (param.variable_type, null),
kind = InlayHintKind.PARAMETER,
paddingRight = true
};
if (param.variable_type != null) {
hints += new InlayHint () {
position = range.start,
label = CodeHelp.get_data_type_representation (param.variable_type, null),
kind = InlayHintKind.PARAMETER,
paddingRight = true
};
}
}
} else if ((item is Vala.MethodCall || item is Vala.ObjectCreationExpression) && compilation.method_calls.has_key (item)) {
Vala.List<Vala.Parameter>? parameters = null;
Expand Down

0 comments on commit 8ddd735

Please sign in to comment.