scalameta / metals

Scala language server with rich IDE features 🚀

Home Page:https://scalameta.org/metals/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"Quick fix" for Import on VSCode seems to modify random code

tanin47 opened this issue · comments

Describe the bug

To Reproduce Steps to reproduce the behavior:

image

Then, if we choose the second quickfix, the previewed change looks like this:

image

Expected behavior

It shouldn't modify the line: sealed abstract class Value extends EnumValue at all.

I'm using Vim. I don't know it that matters. But there could be a conflict in shortcut if modifying the code uses a shortcut?

Thanks for reporting! We need to confirm a reproduction, if possible could you paste a self contained example?

Which Scala and Metals versions do you use?

VSCode: 1.87.2, Metal: v1.29.0, Scala: 2.13.12

I'll make a small self-contained example!

Thank you for acknowledging the issue promptly!

Here's the POC: https://github.com/tanin47/poc-metals-6232

  1. We can see that Queue is not imported correctly:
image
  1. We hover over Queue and click Quick fix...:
image
  1. We choose Import 'Queue' from package 'java.util. Then, we'll see the below:
image

I've confirmed that, even without the vim extension, the problem still occurs.