Skip to content
This repository has been archived by the owner on Nov 7, 2022. It is now read-only.

Create new symbol code action not working #134

Closed
ckipp01 opened this issue Mar 25, 2020 · 1 comment · Fixed by scalameta/metals#1540
Closed

Create new symbol code action not working #134

ckipp01 opened this issue Mar 25, 2020 · 1 comment · Fixed by scalameta/metals#1540
Labels
bug Something isn't working

Comments

@ckipp01
Copy link
Member

ckipp01 commented Mar 25, 2020

Describe the bug

When you try to use the new create new symbol code action in the latest metals snapshot, you correctly get the code action, but for some reason the quick pick isn't being shown to the user and we are just responding with nothing.

To Reproduce Steps to reproduce the behavior:

  1. Create something that doesn't exist like val x = new Test(3)
  2. Trigger the code action on Test which doesn't exist to create the new symbol.
  3. Click 1 to say that's the code action you'd like.
  4. Nothing happens.

Expected behavior

I'd expect the quickpick to appear.

Additional context

lsp trace

[Trace - 10:35:35 AM] Sending response 'textDocument/codeAction - (29)'. Processing request took 8ms
Result: [
  {
    "title": "Create new symbol \u0027Test\u0027...",
    "kind": "quickfix",
    "diagnostics": [
      {
        "range": {
          "start": {
            "line": 5,
            "character": 11
          },
          "end": {
            "line": 5,
            "character": 15
          }
        },
        "severity": 1,
        "source": "bloop",
        "message": "not found: value Test"
      }
    ],
    "command": {
      "title": "Create new scala file",
      "command": "new-scala-file",
      "arguments": [
        null,
        "Test"
      ]
    }
  }
]


[Trace - 10:35:36 AM] Received request 'workspace/executeCommand - (30)'
Params: {
  "command": "new-scala-file",
  "arguments": [
    null,
    "Test"
  ]
}


[Trace - 10:35:36 AM] Sending request 'metals/quickPick - (6)'
Params: {
  "items": [
    {
      "id": "class",
      "label": "Class"
    },
    {
      "id": "case-class",
      "label": "Case class"
    },
    {
      "id": "object",
      "label": "Object"
    },
    {
      "id": "trait",
      "label": "Trait"
    },
    {
      "id": "package-object",
      "label": "Package Object"
    },
    {
      "id": "worksheet",
      "label": "Worksheet"
    }
  ],
  "placeHolder": "Select the kind of file to create"
}


[Trace - 10:35:36 AM] Received response 'metals/quickPick - (6)' in 0ms
Result: null

Search terms

code action, quickpick

@ckipp01 ckipp01 added the bug Something isn't working label Mar 25, 2020
@gabro
Copy link
Member

gabro commented Mar 25, 2020

Ah, this is the same old issue with the way vim uses code action ranges that I’ve forgotten once again.

Now that we use the symbol name in the action label I think we can allow the full range.

This is a matter of changing enclosed with overlapsWith in the server implementation

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants