Describe the bug
When using the "Quick Fix" option to import java.util.UUID, the actual import that occurs is:
import java.{util => ju}
And only the one reference that your cursor was under when you invoked the Quick Fix gets updated to:
ju.UUID
To Reproduce Steps to reproduce the behavior:
Expected behavior
Either java.util.UUID should be imported, or otherwise all instances of UUID should be deferenced as ju.UUID
Screenshots
See above.
Installation:
Version: 1.43.0 (system setup)
Commit: 78a4c91400152c0f27ba4d363eb56d2835f9903a
Date: 2020-03-09T19:47:57.235Z
Electron: 7.1.11
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Windows_NT x64 10.0.18363
0.8.1
Additional context
I think this might have happened after the most recent update?
Thanks for reporting, that might be a bug, bu most likely affecting the Metals server, transfering it there.
Thank you for reporting! I agree the current solution is not ideae but I'm not sure what the expected behavior would be. Either Metals should not use the util => ju prefix or Metals should insert the ju. prefix for all "symbol not found" errors in the same document with the same name 馃
My personal preference is for import java.util.UUID. But perhaps giving the user the option to choose either solution from within the Quick Fix menu would be best (at least when talking from the perspective of VSode)
I'm also surprised (and a bit annoyed) whenever Metals adds the import java.{util => ju} thing, and just manually add the full import. Maybe it could only follow that convention when the that import already exists and just insert the full import otherwise. Or make this configurable somehow?
I think the best solution is to limit the util => ju convention for symbols that have conflicting symbols in scope (Map, Set, List, ..). That would mean UUID would not trigger the renamed import similar to how most other auto-imports work.
I think the best solution is to limit the
util => juconvention for symbols that have conflicting symbols in scope (Map,Set,List, ..). That would meanUUIDwould not trigger the renamed import similar to how most other auto-imports work.
Just dropping in here to show some support for this option. I'm working in a code base that doesn't follow the util => ju convention and working with UUIDs. So using the auto imports causes me to have to manually change this every time. I think this would be a great change to not do this all the time, but only when there is a conflicting symbol in scope. 馃憤