metals icon indicating copy to clipboard operation
metals copied to clipboard

Provide extension method code completions when typing `xxx.@@`

Open tanishiking opened this issue 1 year ago • 3 comments

Describe the bug

Define an extension method like

package a
extension (num: Int)
  def increment: Int = ???

Try to use the extension method in another package

package b
1.i@@

if we type 1.i we will have an auto-completion for increment extension method. However, if we type 1.@@ we don't get the completion for increment

Expected behavior

It would be ideal if it were allowed to search even with an empty query. Then, the user will be able to discover extension method by autocompleting

https://github.com/scalameta/metals/pull/4183#discussion_r934249157

Operating system

No response

Editor/Extension

VS Code

Version of Metals

0.11.7+79-d2ab7248-SNAPSHOT

Extra context or search terms

Follow up from https://github.com/scalameta/metals/pull/4183

extension method

tanishiking avatar Aug 02 '22 06:08 tanishiking

  • It doesn't work because we guard for an empty query here, we have to remove this guard
  • However, just removing if query.nonEmpty doesn't work

tanishiking avatar Aug 02 '22 06:08 tanishiking

I'll give this one a go

robmwalsh avatar Sep 04 '22 11:09 robmwalsh

Great to hear! Let us know if you encounter any difficulties!

tgodzik avatar Sep 04 '22 13:09 tgodzik