Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IntelliJ toggle TabNine result order to be before or after native autocomplete #18

Closed
MichaelHindley opened this issue Sep 17, 2019 · 26 comments

Comments

@MichaelHindley
Copy link

Been beta testing TabNine for a while and this is the summary of my experience so far.
The codebase is GraphQL server, a React Frontend, a AWS CDK application and some MD and SQL.

In cases where there are no "native" suggestions, TabNine adds tremendous value.
But to me there is a big difference in how positive and accurate TabNine completions over native IntelliJ symbol suggestions from the indexed-based autocompletion engine they have. The IntelliJ symbol is in a very large majority of cases more relevant when working directly on Types with symbols. So much so that TabNine feels like a nuisance since it's never more accurate, and often fills the result list with suggestions that are redundant.

So my feature request as such is:
Add a setting to keep IntelliJ native symbol suggestions, if they exist, above the TabNine suggestions, as an alternative to having TabNine always on top. This way, you can have the best of both worlds.

Disable TabNine suggestions from "Smart Type" completions. Intellij has two completion modes, "Basic" and "Smart Type", which can be triggered with different key combinations:
image

As a developer, if I trigger the context-based SmartType completion, I want that context-based Type completion over anything else.

Here it's suggesting strings that dont exist on the type at all.
image

Here I want to access secret but the TabNine completion is in the way, disallowing me from completing automatically and forcing list navigation.
image

@yahave yahave transferred this issue from codota/TabNine Mar 14, 2020
@Sushisource
Copy link

Huge +1. Came here searching for this feature as I think it's probably the only thing that's stopping me from recommending TabNine to more people.

Specifically though, I'd like the behavior here to be a bit more configurable. It would be nice to choose the order of completion sources generically, though that's maybe more a JetBrains thing.

In terms of what TabNine can control, I would love to at least have a "show before/after other completions" option, and a keybinding that I can set/press when the completion popup is open to hide all TabNine suggestions for as long as that specific completion is open.

@fedorl
Copy link

fedorl commented Nov 17, 2020

Without fixing this it is just not usable. Tried it for the day on Typescript/WebStorm, there was barely a single first suggestion that made sense and they come on top of default (which is already very accurate for statically typed languages in IntelliJ).

Not talking about 14 trial is ridiculous (even IntelliJ Ultimate itself has a 30 day trial) and the price is exorbitant even if it worked correctly (25% of the whole IntelliJ Ultimate price just for autocompletion which already works reasonable built-in, really?!) .

For a new, not-there-yet service trying to acquire the market which is already filled with good IDE native implementations, it seems making too much barriers for itself. IMHO at the bare minimum it should fix issues like this instantly.

@elovin
Copy link

elovin commented Nov 19, 2020

I found a workaround that forces tab nine to come after the build in suggestions if you explicitly selected the build-in suggestion earlier.
To for this behavior you have to activate the Machine Learning-Assisted Completion built-in into JetBrains IDEs.

Editor > General > Code Completion > Machine Learning-Assisted Completion > Rank completion suggestions based on Machine learning

Screenshot_20201119_170451

The TabNine suggestions are still on top or preselected most of the time

Screenshot_20201119_171134

@boaz-codota
Copy link
Contributor

Without fixing this it is just not usable. Tried it for the day on Typescript/WebStorm, there was barely a single first suggestion that made sense and they come on top of default (which is already very accurate for statically typed languages in IntelliJ).

Not talking about 14 trial is ridiculous (even IntelliJ Ultimate itself has a 30 day trial) and the price is exorbitant even if it worked correctly (25% of the whole IntelliJ Ultimate price just for autocompletion which already works reasonable built-in, really?!) .

For a new, not-there-yet service trying to acquire the market which is already filled with good IDE native implementations, it seems making too much barriers for itself. IMHO at the bare minimum it should fix issues like this instantly.

“I hate and love. And why, perhaps you’ll ask.
I don’t know: but I feel, and I’m tormented.”
― Catullus

Thanks for trying out Tabnine @fedorl , we highly appreciate any feedback coming from the community and value you taking the time to deliver it to us. Hopefully we will improve in the future.

I found a workaround that forces tab nine to come after the build in suggestions if you explicitly selected the build-in suggestion earlier.
To for this behavior you have to activate the Machine Learning-Assisted Completion built-in into JetBrains IDEs.

Editor > General > Code Completion > Machine Learning-Assisted Completion > Rank completion suggestions based on Machine learning

Screenshot_20201119_170451

The TabNine suggestions are still on top or preselected most of the time

Screenshot_20201119_171134

Awesome hack @elovin ! We would love to hear back from you after you've accumulated some milage with the setup, to know whether this is a direction worth pointing other users to.

@MichaelHindley
Copy link
Author

@boaz-codota ancient roman poetry aside, by closing this, are you saying that toggling suggestion orders from TabNine as suggested in the original post will not be implemented ?

@fedorl
Copy link

fedorl commented Nov 20, 2020

"And enterprises of great pith and moment
With this regard their currents turn awry,
And lose the name of action"

@boaz-codota with the above workaround, suggestions are still on top or native most of the time, so it is not clear what is awesome and why the ticket was closed.

@dvdvdmt
Copy link

dvdvdmt commented Dec 9, 2020

Yes, I would like to place TabNine's suggestions after those that were inferred from TypeScript. @boaz-codota Could you please reopen the issue?

@dertilo
Copy link

dertilo commented Jan 6, 2021

plugin-dev.com says You can use CompletionResultSet.runRemainingContributors(...) to filter the completions of the remaining contributors.
so what about a FilteringCompletionContributor like this?

public class FilteringCompletionContributor extends CompletionContributor {

    @Override
    public void fillCompletionVariants(@NotNull CompletionParameters parameters, @NotNull final CompletionResultSet resultSet) {
        ArrayList<CompletionResult> elements = new ArrayList<>();

        // collect the other completion-contributors results
        resultSet.runRemainingContributors(parameters, elements::add);

        List<Integer> filteredsordedResults = IntStream.range(0, elements.size())
                .filter(i -> {
                    LookupElement tabnine_element = elements.get(i).getLookupElement();
                    if (tabnine_element.getObject() instanceof TabNineCompletion) {
                        String tabnine_autocompl = tabnine_element.getLookupString();

                        boolean already_in_other_contributers_results = elements.stream()
                                .filter(e -> !(e.getLookupElement().getObject() instanceof TabNineCompletion))
                                .anyMatch(e -> {
                                    String another_autocompl = e.getLookupElement().getLookupString();
                                    return another_autocompl.equals(tabnine_autocompl);
                                });
                        return !already_in_other_contributers_results;
                    } else {
                        return true;
                    }
                })
                .mapToObj(i -> (Integer) i) //WTF? I don't know how java works!
                .sorted(Comparator.comparing(i -> {
                    boolean is_tabnine = elements.get(i).getLookupElement().getObject() instanceof TabNineCompletion;
                    return is_tabnine? i + 10000 :i; // if is tabnine should go to the very back! behind all others!
                }))
                .collect(Collectors.toList());

        // add to resultSet
        filteredsordedResults.forEach(i -> resultSet.passResult(elements.get(i)));;

    }
}

to make this work one actually needs to:

  1. add <completion.contributor language="any" implementationClass="com.tabnine.FilteringCompletionContributor" order="first"/> to plugin.xml and remove the order="first" from the TabNineCompletionContributor line
  2. ./gradlew buildPlugin -> produces a TabNine zip-file in distributions folder
  3. intellij-plugin settings: Install Plugin from Disk ... (select TabNine zip-file)

@fcFn
Copy link

fcFn commented Apr 4, 2021

@dertilo Nice one! That should probably be togglable in the options because most users have probably got used to the current behaviour, and I bet @boaz-codota will merge that as soon as you open a PR! 😉

@elovin's suggestion is unfortunately not an adequate solution as it doesn't guarantee the order of the suggestions.

@TesseractLaboratories
Copy link

Trying out TabNine on a recommendation. +1 to this thread - the extra autocompletion is great when IntelliJ doesn't have a suggestion, but actively makes the existing code-completion worse the rest of the time.

Implementing the ability to have TabNine suggestions show after native ones would make this a much more useful tool. Disappointed that this got closed out based on a partial workaround - do we have any hope of seeing movement?

@gochev
Copy link

gochev commented Jul 21, 2021

Currently tabnine is useless it shows fields that doesnt exists variables that are not defined...
Codata was so much better for intellij IDEA and I cant find settings... and this improves productivity? cmon .

@JoshMoreno
Copy link

@boaz-codota Can you please reopen this issue? If you're not going to, can you give us an explanation why?
I think you can see from the comments, that this is a pain point for a lot of people, including myself.
Thanks

@andychute
Copy link

omg. I'm so happy this thread exists. It's so painful that Tabnine's ego is so overwhelming that it has determined that its suggestions should always be at the top of the list.

The time I'm saving with Tabnine is completely wasted by having to cursor down through the code completion hints so that I can get to the natively suggested recommendations, which I prefer because:

  1. I know that these are valid methods or variables
  2. Static type hinting information is included

image

@dimacodota
Copy link
Contributor

Hi @andychute, we have released an experimental "inline Completions" feature 🎉

Please share your experience with this feature here 🙏

In order to enable it:

  • open the Tabnine Home, go to "Preferences" and check the "inline Completions" option
  • restart your IDE

Screen Shot 2022-01-05 at 23 47 41

@fcFn
Copy link

fcFn commented Jan 9, 2022

@dimacodota That's good, but having an option to prioritize IDE autocomplete over TabNine without using inline completions would be better.

@mhdhamzashammout
Copy link

Actually I stopped using tabnine today because of it

@normidar
Copy link

normidar commented Mar 5, 2022

实际上我今天因为它而停止使用 tabnine

me too. until this issue is fixed.

@vegerot
Copy link

vegerot commented Apr 28, 2022

I really like TabNine. I listened to your episode on The Changelog Podcast and am a big fan of your philosophy.

Unfortunately, not being able to put TabNine suggestions after language-based completions is a deal-breaker for me :(

@joshuataylor
Copy link

This is also painful for languages like Elixir where tabnine is pretty great with it. I am trying tabnine as a paid member for a month, which I won't be renewing due to this issue. The cost would be worth it for me when this is fixed.

@fcFn
Copy link

fcFn commented Jun 23, 2022

FIY, another code completion product that was released just recently by a popular Git hosting service doesn't have this problem.

@michaelwills
Copy link

michaelwills commented Oct 1, 2022

It's two years later and I have the same issue which led me here :).

@elovin's suggestion helps, but as noted, it's only partial. @dimacodota is there any chance of an update on this? Is it somehow different for Pro users? Do Jetbrain users really prefer Tabnine completions before Jetbrain's?

@tayambamwanza
Copy link

@dimacodota This is the single biggest issue stopping me from sticking with tabnine, I test ran it for a month now and would keep it, but it's interfering with the DX of standard typescript autocomplete, inline suggestions can also be a bit distracting.

Please if you can do something about this, I would be so grateful.

@normidar
Copy link

why this issue closed?

@kfchou
Copy link

kfchou commented Apr 21, 2023

Having the same issue. Working on VS code and TabNine suggests dictionary key that don't exist; the native suggestions are sometimes more accurate. Would be great to be able to toggle between the two.

@alcarraz
Copy link

I'm also disabling tabnine because of this

@alcarraz
Copy link

Hi @elovin, please, can you elaborate on what you mean by this?

if you explicitly selected the build-in suggestion earlier.

I enabled machine learning order, and it seems to work for java code, but not in xml files. Perhaps that workaround doesn't wokr for xml?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests