Posted by: idefix2 | Date: 2021-01-30 08:26 | IP: IP Logged
Thank you for improving the autocomplete function!
The new handling of parentheses in autocomplete is already a big improvement, because it doesn't just save typing, it's also a valuable reminder that a word is a function name which needs a parameter list (which can be easily forgotten when the function needs an empty parameter list like "myarray.maxindex()"). However, it is not yet optimal:
1. When a bracket opens, it normally will be closed. So when a word (= function name) is followed by an opening bracket, the closing bracket always should also belong to the autocomplete word - There may be parameters between, but the closing bracket will come. Your "completion of chars" feature follows the same logic. So when AHK finds the word "myfunction(" somewhere in the text, it should add to the autocompletion list the word "myfunction()". Ideally, after autocomplete, the cursor should stay between the two brackets for entering the parameter list.
2. On the other side, closing brackets dont really connect to the word before them. The last parameter of a function call may be in that position by chance, and will be used without closing bracket behind it in most of the cases. I think it does not make much sense to add "abc)" to the autocomplete list just because PSPad finds sin(abc) somewhere in the text.
3. Not sure of this, maybe should be parametrized in some way, depending on the type of the file edited, or just according to a parameter in editor configuration: In most programming languages, round brackets are used for function parameters. If a word is a function name it will nearly always be followed by an opening and after that by a closing bracket, so it inflates the list of autocomplete words unnecessarily if both entries (with and without brackets) are added to the list. If the word "myfunction(" is encountered, I think only "myfunction()" should be added to the list, "Myfunction(" and "myfunction" in nearly all cases won't be used, at least in the programming languages that I know.
Btw, as there is already an option "completion of chars..." in the editor configuration - maybe this option could also be used for activating/deactivatiing this special autocompletion feature.
Edited 2 time(s). Last edit at 2021-01-30 08:35 by idefix2.