Czukowski created NETBEANS-3032:
-----------------------------------

             Summary: Copy & paste improvement of variable names in PHP editor
                 Key: NETBEANS-3032
                 URL: https://issues.apache.org/jira/browse/NETBEANS-3032
             Project: NetBeans
          Issue Type: New Feature
          Components: php - Editor
    Affects Versions: 11.1
            Reporter: Czukowski


I would like to propose an improvement for PHP editor. When one needs to have 
class method that set object properties, such as setter methods or constructors 
for dependency injection, method parameter names are often same as the object 
properties, so copy and pasting of the parameters names often occurs. However 
the variable names are being selected including the dollar sign prefix {{$}} 
and after pasting it needs to be removed. If there are many parameters to set, 
this may become very routine work.

The idea is that when the paste _containing a variable name_ occurs right after 
{{$this->}} (or perhaps rather after object instance operator {{->}}), then it 
will be pasted _without the {{$}} sign_. I believe this would greatly improve 
the workflow.

{code:php}
function __construct($someProperty) {
    $this->someProperty = $someProperty;
}
{code}

So in order to achieve property assignment, one would need to type

{{$this->}}, ctrl+v, {{=}}, ctrl+v

instead of, for example:

{{$this->}}, ctrl+v, ctrl+back-arrow (multiple times), backspace, end, {{=}}, 
ctrl+v

Of course, there could be variable variables, but I believe these haven't been 
considered a good practice for a long time and in any case, are much much more 
rare than the use case above.

Do you see any possible drawbacks to this?

There could also be a suggestion to generate the assignment for even less 
keystrokes, but I figure it would be far more complex solution than this.



--
This message was sent by Atlassian Jira
(v8.3.2#803003)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@netbeans.apache.org
For additional commands, e-mail: commits-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to