Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[LSP] Newlines in textEdits not handled correctly #12195

Closed
ckipp01 opened this issue Apr 27, 2020 · 3 comments
Closed

[LSP] Newlines in textEdits not handled correctly #12195

ckipp01 opened this issue Apr 27, 2020 · 3 comments
Labels
bug issues reporting wrong behavior lsp
Milestone

Comments

@ckipp01
Copy link
Contributor

ckipp01 commented Apr 27, 2020

  • nvim --version: NVIM v0.5.0-fc98f2d
  • Operating system/version: MacOS
  • Terminal name/version: iTermw
  • $TERM: fish

Steps to reproduce

With any current setup, trigger a completion that contains a textEdit that contains a newline in it. For example, this is what the completion option coming in would look like:

    {
      "label": "match (exhaustive)",
      "kind": 8,
      "detail": " Foo (2 cases)",
      "sortText": "00001",
      "filterText": "match (exhaustive)",
      "insertTextFormat": 1,
      "textEdit": {
        "range": {
          "start": {
            "line": 14,
            "character": 7
          },
          "end": {
            "line": 14,
            "character": 11
          }
        },
        "newText": "match {\n\tcase Bar() \u003d\u003e\n\tcase Car() \u003d\u003e\n}"
      },

Notice that the newText has multiple \n in it.

Actual behaviour

This newText ends up being inserted like below:

test match {^@  case Bar() =>^@ case Car() =>^@}

Expected behaviour

I would expect the newlines to be taken into account and to see the following:

test match {
  case Bar() =>
  case Car() =>
}
@ckipp01 ckipp01 added the bug issues reporting wrong behavior label Apr 27, 2020
@teto teto added the lsp label Apr 28, 2020
@justinmk justinmk added this to the todo milestone Apr 28, 2020
@mjlbach
Copy link
Contributor

mjlbach commented Sep 27, 2021

@ckipp01 is this still an issue? We fixed some things around new text insertion. I can't repro your original example as I don't know the snippet/lsp completion that would generate this.

@ckipp01
Copy link
Contributor Author

ckipp01 commented Sep 27, 2021

Just removed my snippet plugin to see and yea, it looks like this is fixed. This is the completion listed up above that had issues in the past:

2021-09-27 10 35 22

And it seems to handle the newlines fine new.

👍🏼

@ckipp01 ckipp01 closed this as completed Sep 27, 2021
@mjlbach
Copy link
Contributor

mjlbach commented Sep 27, 2021

Awesome! Glad its fixed :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug issues reporting wrong behavior lsp
Projects
None yet
Development

No branches or pull requests

4 participants