[PSS 2017] Copy Definition

Post feature requests, product enhancement ideas, and other product-specific suggestions here. Do not post bug reports.
Forum rules
Do not post any licensing information in this forum.
Locked
User avatar
Bosparan
Posts: 282
Joined: Sun Mar 03, 2013 12:45 pm

[PSS 2017] Copy Definition

Post by Bosparan » Tue Jun 13, 2017 3:32 am

Hi,

one of the more frequent things I get to do is copy&paste entire function definitions.
Currently, this requires me to go the the first line, place my cursor before the the "function" statement, and then mark the entire function script-code.
If I have a single function as the entire content of the file, that's fairly easy to do with "CTRL"+"A", however in more congested scenarios - which are common for me - it's straight manual work as mentioned above.
Wouldn't an option be nice that allows us to copy the entire definition of the function the clicked portion of script is part of?
Or maybe even of a remote function when right-clicking on a function-name as it is being used in the current code.

Ugh ... I think that explanation was a bit confused, so how about these two example usages:

Copy definition of current function
- I am currently editing a function (let's call it Get-Test)
- I right-click anywhere within Get-Test and select "Copy Definition"
- I now have the definition of the function Get-Test in the clipboard

Copy definition of remote function
- I am currently editing a function (let's call it Get-Test)
- Get-Test calls another function named Get-Example
- I right-click on that call to Get-Example and select "Copy Definition"
- I now have the definition of the function Get-Example in the clipboard

Cheers,
Fred

User avatar
davidc
Posts: 5913
Joined: Thu Aug 18, 2011 4:56 am

Re: [PSS 2017] Copy Definition

Post by davidc » Tue Jun 13, 2017 7:23 am

You can copy a function definition by using the Function Explorer context menu's Copy command.

Alternatively, if you triple-click on the number column in the editor, it will automatically select the whole function.
David
SAPIEN Technologies, Inc.

User avatar
Bosparan
Posts: 282
Joined: Sun Mar 03, 2013 12:45 pm

Re: [PSS 2017] Copy Definition

Post by Bosparan » Tue Jun 13, 2017 8:05 am

Hi David,

thankyouthankyouthankyouthankyouthankyouthankyouthankyouthankyouthankyouthankyouthankyouthankyouthankyouthankyouthankyouthankyouthankyouthankyouthankyouthankyouthankyouthankyouthankyouthankyouthankyouthankyouthankyouthankyouthankyouthankyouthankyouthankyouthankyouthankyouthankyouthankyouthankyouthankyouthankyouthankyouthankyouthankyouthankyouthankyouthankyouthankyouthankyouthankyouthankyouthankyouthankyouthankyouthankyouthankyouthankyouthankyouthankyouthankyouthankyouthankyouthankyouthankyouthankyouthankyouthankyouthankyouthankyouthankyouthankyouthankyouthankyouthankyouthankyouthankyouthankyou...

The function explorer isn't really suitable for me in most cases for casual use - it's mostly hidden since I care more about snippets and the two share space in my configuration, I use it mostly for project-wide navigation purposes - but I was totally unaware of the option to triple-click on the numbers bar.
With that I obviously rest my case :)

Cheers,
Fred

Locked