niosus / EasyClangComplete

:boom: Robust C/C++ code completion for Sublime Text 3/4
https://niosus.github.io/EasyClangComplete/
MIT License
575 stars 78 forks source link

Autocompletion of function arguments with Tab key not working as expected #727

Closed cschreib closed 3 years ago

cschreib commented 3 years ago

System info:

What happens:

When I autocomplete a function, EasyClangComplete autocompletes the arguments based on the function signature, and highlights the first argument for me to overwrite. Usually I want to start typing the name of a local object and have it autocomplete too, like so:

void foo(int argument1, int argument2) { /*...*/ }

void main() {
    int cats_number = 6;
    int dogs_number = 2;
    foo(cats_|, argument2);
}

Here I typed cats_ and want it to autocomplete to cats_number. Normally I would just type this, select cats_number from the drop down list, and hit "Tab". However, EasyClangComplete takes this as a command to go to the next function argument. It doesn't autocomplete cats_, just leaves it there. I can get it to work by hitting "Enter" instead of "Tab", but that's going against my usual workflow :)

Could you make it so that "Tab" and "Enter" have the same behavior in this situation? NB, this issue is a duplicate of #371, which was unfortunately closed by its author without explanation.

(FYI: opening this issue here after your message on Package Control. I only use your plug-in at home on my spare time, after being corrupted at work by Visual Studio and its Intellisense that I didn't know I needed before I used it...)

niosus commented 3 years ago

@cschreib as far as I know this is not an issue with ECC but with the config of sublime text.

Here is a link to a relevant discussion and the solution seems to be:

Setting auto_complete_with_fields to true in preferences should do it.

auto_complete_commit_on_tab must be true too

Does this help?

cschreib commented 3 years ago

It does, thank you! I had to set both auto_complete_commit_on_tab and auto_complete_with_fields to true.

Sorry, I thought this was an ECC issue because this is the only context where I had the problem happen, I didn't realize this was a core Sublimetext issue! Weird how the documentations of the settings say that setting this to true is a superior solution, yet this is not the default.

niosus commented 3 years ago

Awesome! Glad it is resolved. I might want to add this info to the docs though...