Skip to content

Commit

Permalink
补全单词的时候,id的形式是ID而不是Id
Browse files Browse the repository at this point in the history
  • Loading branch information
shuying2244 committed Oct 24, 2024
1 parent 54e334d commit cd74780
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion apps/els_lsp/src/els_completion_provider.erl
Original file line number Diff line number Diff line change
Expand Up @@ -948,7 +948,14 @@ record_fields_with_var(Document, RecordName) ->
format_record_field_with_var(Name, true) ->
Label = atom_to_label(Name),
Var = els_utils:camel_case(Label),
<<Label/binary, " = ${1:", Var/binary, "}">>;
Size = bit_size(Var) - 16,
Var2 =
case Size >= 0 andalso Var of
<<H:Size, "id">> -> <<H:Size, "ID">>;
<<H:Size, "Id">> -> <<H:Size, "ID">>;
_ -> Var
end,
<<Label/binary, " = ${1:", Var2/binary, "}">>;
format_record_field_with_var(Name, false) ->
atom_to_label(Name).

Expand Down

0 comments on commit cd74780

Please sign in to comment.