question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Missing autocompletion for instances of Selectable

See original GitHub issue

Compiler version

3.1.1

Minimized code

class Structural(map: Map[String, Any]) extends Selectable:
  def selectDynamic(name: String) = map(name)

type Person = Structural { val: name; val age: Int }

val p = new Structural(Map("name" -> "jacob", "age" -> 5)).asInstanceOf[Person]

p.name //I should see name + age in autocomplete

Output

There is no autocomplete for name or age.

Expectation

It would be great if there were autocomplete for name and age 😄

Notes

I’ve copied this issue from a metals issue after being informed that it may make more sense here (https://github.com/scalameta/metals-feature-requests/issues/238).

My hopes are that autocomplete for Selectable types can help provide a suitable replacement for annotation macros. I’m imagining a Macro that would generate a refined Selectable type. This Selectable instance would be a bag of autocompleteable methods based upon the structure of the given case class. Generating Lenses, for instance, could look like this:

case class Person(name: String, age: Int)

object Person {
  val lenses = Lenses.gen[Person]
}

Person.lenses.name // For this to be tenable, this would need to autocomplete with the type Lens[Person, String] 

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:4
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

11reactions
oderskycommented, Apr 10, 2022

OK, I note that there are important use cases. Thanks for pointing them out!

3reactions
jdegoescommented, Apr 20, 2022

As a user, I would hope and expect that auto-complete is supported for all static types, including structural types, and I can think of many applications for this: for example, adding typing information to Spark workflows via metaprogramming (which can easily be done, but will be of limited use without auto-complete).

Separately, I do believe that export should work uniformly across nominal and structural types. One of the most tangible and practical perks of working with Scala 3 is the enhanced uniformity it brings to the language, and it would be a shame (in my view) to pass up the opportunity to make export work uniformly.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Xcode 9 Autocomplete Not Working 100% - Partially Working
Try: Go to Xcode > Preferences > Text Editing; Under Code completion - Uncheck 'Suggest completions while typing'; Quit out of Xcode and ......
Read more >
Automatic completion | JetBrains Rider Documentation
JetBrains Rider's automatic completion suggests names of classes, methods, variables, keywords, and any other symbols that are available ...
Read more >
Guidelines for the accessibility of an autocompletion component
Close the listbox and reposition focus in the input; No item is selected; If a selection is already made, the focus is repositioned...
Read more >
MySQL Shell 8.0 :: 5.3 Code Autocompletion
If you connect to a MySQL instance but do not select a schema, autocompletion is available for global objects, charsets, engines, schemas and...
Read more >
Editable Combobox without Autocomplete Example | APG - W3C
About This Example · Select-Only Combobox: A single-select combobox with no text input that is functionally similar to an HTML select element.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found