Hello,
I have an idea for a new feature, but I don't know where to start/what to modify, can you help me?
Here is the idea:
When I type a very long function definition/declaration/call, I hit enter to make the line shorter an more readable.
The current behavior on this action is to send the cursor at the beginning of the next line + 1 tab (I think).
I want to make it to go to the first opening bracket '(', so I can type:
void mylongfunc(int param1, 'hit enter here and directly go to the bracket and type the second param'
int param2, ' ... and so on so forth'
The MS VC has that feature for function definitions, I want to expand it to definitions and callings.
Where do I need to hack :lol: :P?
Best regards,
Teodor
Here is the patch,
It only one major problem:
a = 5 + my_func(long_arg1, long_arg2, --> hit enter it works
long_arg3, long_arg4); --> hit enter and the cursor goes to
| --> here :(
a = 5 + my_func(long_arg1, long_arg2); --> here it works
| --> cursor is here after enter is hit
Is there a way to get the indent level of the previous statement or something similar.
It can stay that way, it is not mega annoying, but I prefer to make it better?
Feedback is welcome :)
p.p. Patch is attached to the post
[attachment deleted by admin]
a = 5 + my_func(long_arg1, long_arg2, --> hit First enter it works
long_arg3, long_arg4); --> hit Second enter and the cursor goes to
| --> here :(
Great!
I'm not quite understand your idea.
Where should the cursor be after the second enter? :D
It should be like this below?:
a = 5 + my_func(long_arg1, long_arg2, --> hit First enter it works
long_arg3, long_arg4); --> hit Second enter and the cursor goes to
| --> here :(
Thanks.
but won't your patch do this?
cout<<"(";<-- press enter
|<-- cursor position
also, why not indent for other types of braces
slightly off-topic, but one reason I despise this feature is that it encourages coders to do this:
void my_func(
int arg1, // random gibberish comment
char *arg2,
myclass arg3, // random gibberish comment
)
instead of
// comment
void my_func(int arg1, char *arg2, myclass arg3);
even worse when they then do similar crap with the call, reducing the number of effective loc that I can fit on screen without really enhancing readability of the code.
but won't your patch do this?
cout<<"(";<-- press enter
|<-- cursor position
no, but
will break it :(
Any ideas what I can do to fix it?
also, why not indent for other types of braces
The '{' are handled by the indenter, '[' are not used on multiple lines (if there are no strange overloads :) ),
< require some more parsing (to distinguish if it is used in template or as operation).
slightly off-topic, but one reason I despise this feature is that it encourages coders to do this:
void my_func(
int arg1, // random gibberish comment
char *arg2,
myclass arg3, // random gibberish comment
)
instead of
// comment
void my_func(int arg1, char *arg2, myclass arg3);
Isn't that a problem of the coding standard/programmer? C::B is just a tool.
And if it is such a problem a config option could be added that is off by default.
even worse when they then do similar crap with the call, reducing the number of effective loc that I can fit on screen without really enhancing readability of the code.
Do you talk about this:
api_with_many_params(param1, // here we set something
param2, // here we set something else
param3, // here we set something else
param4, // here we set something else
);