Skip to content
This repository was archived by the owner on Mar 19, 2024. It is now read-only.

[Rust-analyzer] Some Magic Completions not working as expected #161

Closed
GrayJack opened this issue May 11, 2020 · 4 comments
Closed

[Rust-analyzer] Some Magic Completions not working as expected #161

GrayJack opened this issue May 11, 2020 · 4 comments

Comments

@GrayJack
Copy link

This is another issue that I noticed before RA became official
It has a feature that is called Magic Completions, but some of them doesn't work as expected on Atom

For example:

expr.not<TAB|ENTER> => !expr

But as right now on 74dba4c the following will happen:

expr.not<TAB|ENTER> => expr.!expr

@alexheretic
Copy link
Member

This looks like a rust-analyzer issue to me.

Steps to reproduce

Rust code:

fn main() {
    let foo = true;

    foo.n
}

ctrl-space after .n. The server providers this completion:

{
  "additionalTextEdits": [{
    "newText": "",
    "range": {
      "end": {
        "character": 8,
        "line": 3
      },
      "start": {
        "character": 4,
        "line": 3
      }
    }
  }],
  "deprecated": false,
  "detail": "!expr",
  "filterText": "not",
  "insertTextFormat": 2,
  "label": "not",
  "textEdit": {
    "newText": "!foo",
    "range": {
      "end": {
        "character": 9,
        "line": 3
      },
      "start": {
        "character": 8,
        "line": 3
      }
    }
  }
}

So it's asking the replace character 8-9 with !foo that character is n (note lsp is 0-based).

@GrayJack
Copy link
Author

GrayJack commented May 11, 2020

Do you know how can I get this json from VSCode, I opened the issue cause it's working fine with VSCode

Also, the VSCode package have a option that sets this posfix Magic Completions, maybe it's passing something extra for the RA?

@alexheretic
Copy link
Member

It'll be either the server sending something wrong, or the client not dealing with it properly.

Looking again, maybe it's the additionalTextEdits section which atom-languageclient doesn't recognise?

@alexheretic
Copy link
Member

Looking again, maybe it's the additionalTextEdits section which atom-languageclient doesn't recognise?

It was. Fixed by #165. Upstream: atom/atom-languageclient#284

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants