Skip to content

Commit

Permalink
Fix garbled output when formatting unicode characters
Browse files Browse the repository at this point in the history
  • Loading branch information
plux committed Feb 7, 2024
1 parent 63b1839 commit 43f3cb9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions apps/els_lsp/src/els_text_edit.erl
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ make_text_edits([{del, Del}, {ins, Ins} | T], Line, Acc) ->
Pos2 = #{line => Line + Len, character => 0},
Edit = #{
range => #{start => Pos1, 'end' => Pos2},
newText => els_utils:to_binary(lists:concat(Ins))
newText => list_to_binary(Ins)
},
make_text_edits(T, Line + Len, [Edit | Acc]);
make_text_edits([{ins, Data} | T], Line, Acc) ->
Pos = #{line => Line, character => 0},
Edit = #{
range => #{start => Pos, 'end' => Pos},
newText => els_utils:to_binary(lists:concat(Data))
newText => list_to_binary(Data)
},
make_text_edits(T, Line, [Edit | Acc]);
make_text_edits([{del, Data} | T], Line, Acc) ->
Expand All @@ -77,7 +77,7 @@ edit_insert_text(Uri, Data, Line) ->
Pos = #{line => Line, character => 0},
Edit = #{
range => #{start => Pos, 'end' => Pos},
newText => els_utils:to_binary(Data)
newText => Data
},
#{changes => #{Uri => [Edit]}}.

Expand All @@ -87,6 +87,6 @@ edit_replace_text(Uri, Data, LineFrom, LineTo) ->
Pos2 = #{line => LineTo, character => 0},
Edit = #{
range => #{start => Pos1, 'end' => Pos2},
newText => els_utils:to_binary(Data)
newText => Data
},
#{changes => #{Uri => [Edit]}}.

0 comments on commit 43f3cb9

Please sign in to comment.