tabnine-intellij icon indicating copy to clipboard operation
tabnine-intellij copied to clipboard

Tabnine doesn't import class on the auto suggestion

Open handhikadj opened this issue 3 years ago • 14 comments

It somewhat bothers me when I select one of the result of Tabnine's auto suggestion and the related class is not imported

gz#2930

handhikadj avatar Jul 05 '21 06:07 handhikadj

What IDE do you use?

maya-tabnine avatar Jul 06 '21 14:07 maya-tabnine

IntelliJ IDEA 2021.1.3

handhikadj avatar Jul 07 '21 11:07 handhikadj

We recently added an improved auto-import completions, make sure you are on the latest version of Tabnine and check it out. If you still have an issue, let us know and we will check!

maya-tabnine avatar Jul 13 '21 07:07 maya-tabnine

which (IntelliJ plugin) version is it? I'm using the 0.4.3 still doesn't work

handhikadj avatar Jul 14 '21 04:07 handhikadj

I am using the plugin (0.4.3) in Rider and also have to manually import classes in suggestions. If there is any way I can help debug the issue, please let me know!

mvarendorff avatar Jul 14 '21 06:07 mvarendorff

We just launched a new plugin version 0.4.4, that contains fixes for the auto-import issues. Please update your plugin, check and let me know it works for you! @geisterfurz007 @handhikadj

maya-tabnine avatar Jul 19 '21 08:07 maya-tabnine

It works on class instantiation, doesn't work when calling static class Thank you anyway

handhikadj avatar Jul 19 '21 16:07 handhikadj

Hi @handhikadj, which programming language are you using? Can you provide a code example where it is not working for you?

Eransho avatar Jul 21 '21 10:07 Eransho

Hi @geisterfurz007, can you provide a code example where the auto import doesn't work for you?

Eransho avatar Jul 21 '21 10:07 Eransho

PHP

handhikadj avatar Jul 21 '21 11:07 handhikadj

Hey @Eransho, I can indeed (on 0.4.4 of the plugin) in C# in Rider:

R09JRPXcec

As you can see, Tabnine suggests HttpClient which I select but the import isn't created. Only when I manually press Alt + Enter towards the end of the video, System.Http is imported. HttpClient is immediately imported without a popup box so it's not an ambiguous import (where I can understand that TabNine might not auto import because of multiple options).

namespace TabNineDemo {
    public class Demo {
        public Ht/* accept TabNine suggestion */

    }
}

Expected:

using System.Net.Http;

namespace TabNineDemo {
    public class Demo {
        public HttpClient

    }
}

Actual:

namespace TabNineDemo {
    public class Demo {
        public HttpClient

    }
}

I hope this helps, if you need anything else, let me know!

For some good news: Auto imports work quite nicely in a React (TS) project in WebStorm which feels really good!

mvarendorff avatar Jul 21 '21 11:07 mvarendorff

Thanks @geisterfurz007, that helps. It's a bug and we will add it to our backlog

Eransho avatar Jul 27 '21 05:07 Eransho

Awesome, thanks!

I don't know if this is a similar or the same case, but while I was fiddling around with Flutter, I also found this case (Android Studio Arctic Fox 2020.3.1, TabNine 0.4.4, Dart 2.13.3):

BBMRjqMz3O

I accept two completions from TabNine in the gif shared: SortFilter.of(context) which does not automatically import the SortFilter class and then a second one SortFilter. in which case the import works (visible by the shift in lines). If that is a different issue, I will be happy to open another GitHub issue for easier organisation. And if there is anything I can do to help debug or fix this, I would be more than happy to look into it!

mvarendorff avatar Jul 29 '21 07:07 mvarendorff

When will this bug be fixed?

lujianzhao avatar Jun 22 '22 02:06 lujianzhao