Author Topic: Modify Parameter list not wholly intuitive  (Read 757 times)

b

  • Senior Community Member
  • Posts: 280
  • Hero Points: 25
Modify Parameter list not wholly intuitive
« on: August 24, 2018, 07:52:16 pm »
A feature I haven't used terribly frequently was Quick Refactoring>Modify Parameter List...

I wanted to change the data type of an existing parameter, thinking that this would update the declaration and definition.  It does not.  That is, I get a "You cannot edit this value" if I attempt to double click either type or argument.

I can remove and add the same parameter, but intuitively I double clicked the type of the parameter I wanted to change.    It just seems extra work to remove, add and then shuffle it around to get it back to where I want it in the list.

Dennis

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 2706
  • Hero Points: 413
Re: Modify Parameter list not wholly intuitive
« Reply #1 on: August 24, 2018, 07:57:30 pm »
Modify parameter list is targetted toward adding, removing, or re-ordering parameters.  It will also try to update the call sites.  While it could be improved, I think you would be better served using edit-associated-symbol (Alt+`) to pop from the function definition to the prototype and back if you are just making a simple adjustment to the parameter list.

b

  • Senior Community Member
  • Posts: 280
  • Hero Points: 25
Re: Modify Parameter list not wholly intuitive
« Reply #2 on: August 24, 2018, 08:00:58 pm »
I'll add that keystroke to my list.  I had been using ^. and doing virtually the same, but I thought I'd try the refactor feature.

Thanks.

Dennis

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 2706
  • Hero Points: 413
Re: Modify Parameter list not wholly intuitive
« Reply #3 on: August 24, 2018, 08:18:57 pm »
Alt+` (edit-associated-symbol) and Ctrl+` (edit-associated-file) are very useful.  They let you pop between corresponding locations without having to move your cursor away from where you are within a symbol (or file, respectively).  So you can have your cursor in the argument list of a function definition, make some changes, Alt+` to the prototype, make the same change, then Alt+` right back to where you started.  It will also iterate through multiple overloads of the same symbol.  Dan put up a nice demo video demonstrating its utility.

b

  • Senior Community Member
  • Posts: 280
  • Hero Points: 25
Re: Modify Parameter list not wholly intuitive
« Reply #4 on: August 24, 2018, 08:24:25 pm »
Are these commands switched?   It appears that Alt+` resets the cursor to the beginning of the function/prototype definition, not preserving the cursor location where Ctrl+` toggles back and forth and does preserve cursor location.

Dennis

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 2706
  • Hero Points: 413
Re: Modify Parameter list not wholly intuitive
« Reply #5 on: August 24, 2018, 09:23:32 pm »
It can only preserve the cursor position when the definition and declaration are in separate files.

However, double-checking on this, I see that a bug was introduced into edit-associated-symbol.  Trying to fix a ridiculous border case, and it broke the common case.  This will be fixed in v23 beta3.

b

  • Senior Community Member
  • Posts: 280
  • Hero Points: 25
Re: Modify Parameter list not wholly intuitive
« Reply #6 on: August 27, 2018, 04:06:09 pm »
I wonder if that is what I was running into as other than one rotating through all of the definition files the other flipping between the two, they seemed about the same (just jumped to the file, but not to the associated parameter definition).

^+` would flip between c/h files, but not even to the correct function (let alone parameter).  Alt+` would cycle through all the files, land on the beginning of line of correct line of the function, but not to the corresponding parameter.  When it cycled back to the original file, the cursor location was reset to beginning of line.

Dennis

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 2706
  • Hero Points: 413
Re: Modify Parameter list not wholly intuitive
« Reply #7 on: August 27, 2018, 05:47:43 pm »
edit-associated-file (Ctrl+`) only flips between the files, it doesn't even try to move you to a related symbol (there might not even be one).

edit-associated-symbol (Alt+`) flips between symbol declarations/definitions, and tries to preserve your cursor position, but it can't do that with two symbols in the same file (since it has to move the cursor to get to the other symbol, there is nothing to preserve).

b

  • Senior Community Member
  • Posts: 280
  • Hero Points: 25
Re: Modify Parameter list not wholly intuitive
« Reply #8 on: August 27, 2018, 08:11:27 pm »
Thanks for the clarification.

rowbearto

  • Senior Community Member
  • Posts: 1378
  • Hero Points: 104
Re: Modify Parameter list not wholly intuitive
« Reply #9 on: August 27, 2018, 08:15:29 pm »
FYI: In my KDE system on Linux x64 CentOS 7, Alt+` is getting picked up by KDE and is not getting through to SE.

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1074
  • Hero Points: 96
Re: Modify Parameter list not wholly intuitive
« Reply #10 on: August 27, 2018, 09:28:15 pm »
The GNOME interface on Ubuntu (and I suppose other distributions) captures the Alt-` as well. It brings up a notification window if I remember right.  I looked into it far enough to see that there wasn't a straightforward way to remap it, and didn't pursue it.

Dennis

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 2706
  • Hero Points: 413
Re: Modify Parameter list not wholly intuitive
« Reply #11 on: August 27, 2018, 09:36:15 pm »
For those platforms where Alt+` won't work, it would be easy enough to map edit-associated-symbol to Ctrl+Shift+`, which should be available.  I admit, it is kind of clumsy to type though.

rgloden

  • Senior Community Member
  • Posts: 165
  • Hero Points: 5
Re: Modify Parameter list not wholly intuitive
« Reply #12 on: September 20, 2018, 03:32:24 am »
Maybe I missed it but in Windows version of SE 2017 I didn't find Alt+` documented in the Help->"Keys Help" page.  And search only found Ctrl+` in the Eclipse Emulation section of the page.