Skip to content

Commit

Permalink
Remove leading underscore from inlay hint (#1564)
Browse files Browse the repository at this point in the history
  • Loading branch information
plux authored Oct 11, 2024
1 parent 5bde640 commit 5959282
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
6 changes: 3 additions & 3 deletions apps/els_lsp/priv/code_navigation/src/inlay_hint.erl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ test() ->
d(1, 2),
e(1, 2),
f(1, 2),
g(1, 2),
g(1, 2, 3),
lists:append([], []).

a(A1, A2) ->
Expand All @@ -36,6 +36,6 @@ e(_, _) ->
f(_, _) ->
ok.

-spec g(G1, any()) -> ok when G1 :: any().
g(_, G2) ->
-spec g(G1, any(), _) -> ok when G1 :: any().
g(_, G2, _G3) ->
ok.
4 changes: 3 additions & 1 deletion apps/els_lsp/src/els_inlay_hint_provider.erl
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ arg_hints(_Uri, _POI) ->
arg_hint(#{from := {FromL, FromC}}, ArgName) ->
#{
position => #{line => FromL - 1, character => FromC - 1},
label => unicode:characters_to_binary(ArgName ++ ":"),
label => unicode:characters_to_binary(
remove_leading_underscore(ArgName) ++ ":"
),
paddingRight => true,
kind => ?INLAY_HINT_KIND_PARAMETER
}.
Expand Down
7 changes: 7 additions & 0 deletions apps/els_lsp/test/els_inlay_hint_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,13 @@ basic(Config) ->
paddingRight => true
},

#{
label => <<"G3:">>,
position => #{line => 12, character => 12},
kind => ?INLAY_HINT_KIND_PARAMETER,
paddingRight => true
},

#{
label => <<"F1:">>,
position => #{line => 11, character => 6},
Expand Down

0 comments on commit 5959282

Please sign in to comment.