Does anyone know if there is a shortcut to impleme...
# intellij
c
Does anyone know if there is a shortcut to implement an abstract function from its parent? For example,
Copy code
// File 1

interface Foo {
    fun foo()
    fun bar() // I just typed this, my cursor is here
}

// File 2, far away

class FooImpl : Foo {
    override fun foo() {}
}
With my cursor somewhere in
Foo.bar
, I would like to press a shortcut which would navigate me to
FooImpl
automatically and generate the usual
override fun bar() { TODO() }
stuff there. For any other function in the interface, I can do
Navigate → Go to implementation(s)
, but that doesn't work for the
bar
function since it doesn't exist in the implementation yet.
s
Looks like there's an intention for "implement abstract function", that should do the trick. It'll be in the menu if you hit Alt + Enter when the cursor is on
bar()
, and from there you could also assign it its own keyboard shortcut if you like
Screenshot 2024-06-03 at 13.53.20.png
c
🤔
🤔 1
In which category is it in File | Settings | Editor | Inspections? I can't find it
s
It'll be under intentions, not inspections
c
I don't have it 🤔 IntelliJ IDEA 2024.2 EAP
Which version are you on? If you're on stable, I'll create an issue for the EAP
s
2024.1.2, and when I do that search, I get this:
c
Thanks, I'll create an issue