scalameta / metals

Scala language server with rich IDE features 🚀
https://scalameta.org/metals/
Apache License 2.0
2.1k stars 332 forks source link

Completions showing private members #4206

Open vzmerr opened 2 years ago

vzmerr commented 2 years ago

Describe the bug

Metals sometimes shows private members as completions for Scala 2, such as

ProcessBuilderImpl - scala.sys.process in this test:

https://github.com/scalameta/metals/blob/main/tests/cross/src/test/scala/tests/pc/CompletionSuite.scala#L356

Expected behavior

Private members that are not in scope should not be suggested as completion.

Operating system

No response

Editor/Extension

No response

Version of Metals

0.11.7+71-ae60fa38-SNAPSHOT

Extra context or search terms

This problem currently does not seem to exist for the suggested Scala 3 completions.

vzmerr commented 2 years ago

It seems that after allowing objects in type and new positions as in https://github.com/scalameta/metals/pull/4224, the issue appeared also for Scala 3. So the main problem is to filter out the private members. both for Scala 2 and 3.