Uploaded image for project: 'NetBeans'
  1. NetBeans
  2. NETBEANS-3032

Copy & paste improvement of variable names in PHP editor

    XMLWordPrintableJSON

    Details

    • Type: New Feature
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 11.1
    • Fix Version/s: None
    • Component/s: php - Editor
    • Labels:
      None

      Description

      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.

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

      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.

        Attachments

        1. netbeans-3032.gif
          392 kB
          Junichi Yamamoto

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              czukowski Czukowski
            • Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: