Skip to content

lsp-format insert unknown character #26

@wingyplus

Description

@wingyplus

I use sourcer with emacs lsp-mode and replacing elixir_ls that come from elixir-ls organization with sourcer. After I write this source:

% hello_module.erl
-module(hello_module).
-export([hello/0]).

hello() ->
    X = "hello",
    io:format("~s~n", [X]).

And then I invoke lsp-format-buffer to format source. Sourcer edit my source with extra character:

�����������������������������������������% hello_module.erl
-module(hello_module).
-export([hello/0]).

hello() ->
    io:format("~s~n", ["Hello, World"]).

The trace log is here:

[Trace - 11:37:53 PM] Sending request 'textDocument/formatting - (235)'.
Params: {
  "textDocument": {
    "uri": "file:///Users/wingyplus/workspace/erlang-playground/hello_module.erl"
  },
  "options": {
    "tabSize": 8,
    "insertSpaces": false
  }
}


[Trace - 11:37:53 PM] Received response 'textDocument/formatting - (235)' in 20ms.
Result: [
  {
    "range": {
      "start": {
        "line": 0,
        "character": 0
      },
      "end": {
        "line": 9991,
        "character": 0
      }
    },
    "newText": "\u0006\u0006\u0006\u0006\u0006\u0006\u0006\u0006\u0006\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000% hello_module.erl\n-module(hello_module).\n-export([hello/0]).\n\nhello() ->\n    io:format(\"~s~n\", [\"Hello, World\"]).\n"
  }
]

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions