Skip to content

PHP indentation usually breaks when pasting over a method #34424

Closed

Description

  • VSCode Version: 1.16.1
  • OS Version: 10.12.6

Steps to Reproduce:

  1. Write some PHP code
  2. Select a method (class function) in full with some whitespace before it so that pasting it twice will result in the right thing being duplicated
  3. Copy (command+c)
  4. Paste (command+v) twice
  5. Observe strange indentation:

weird-indentation

Reproduces without extensions: Yes

Activity

  1. neerolyte commented on Sep 15, 2017

    @neerolyte
    Author

    Happens in Insiders 1.17.0 too.

  2. MikeVelazcoMtz commented on Sep 20, 2017

    @MikeVelazcoMtz

    This happens to me also, but with my indentation is with spaces and on every paste adds one space to each line.

  3. neerolyte commented on Sep 21, 2017

    @neerolyte
    Author

    From #6392

    I found that hitting CTRL-Z (undo) after CTRL-V (paste) fixes the indentation. Faster to fix, but what extra step is taking place that the CTRL-Z has to undo it? The auto-indent?

  4. neerolyte commented on Sep 21, 2017

    @neerolyte
    Author

    Putting:

        "[php]": {
            "editor.autoIndent": false
        }

    in config also stops VSCode breaking indentation in PHP files (by turning off the feature).

  5. MikeVelazcoMtz commented on Sep 21, 2017

    @MikeVelazcoMtz

    I checked and found what I suppose it is a related issue:

    When pasting from a file with phpdocumentor comments to another a method it adds one space to every line:

    error_vscode

  6. peluprvi commented on Sep 21, 2017

    @peluprvi

    This happens with js files too, only in some cases.

    Examples with problem:

    (function(){
    
      var error = function(){
        return true;
      };
    
    })();
    (function(){
    
      'use strict';
    
      var error = function(){
        return true;
      };
      
    })();

    Examples without problem:

    (function(){
      'use strict';
    
      var error = function(){
        return false;
      };
    
    })();
    (function(){
      
      'use strict';
    
      var error = false;
    
    })();
    (function(){
      var error = function(){
        return false;
      };
    
    })();
  7. peluprvi commented on Oct 16, 2017

    @peluprvi

    Related to: #33011 and #36294

  8. added
    bug
    on Nov 16, 2017
  9. added
    php
    on Sep 19, 2018
  10. robrecord commented on Mar 6, 2019

    @robrecord

    This isn't just PHP, but every language. This is a core feature. How is it languishing?

  11. robrecord commented on Oct 29, 2019

    @robrecord

    Any detail as to why this bug was closed, Connor Peet (@connor4312) ?

  12. connor4312 commented on Oct 29, 2019

    @connor4312
    Member

    The issue here was fixed in the linked commit (867bcae), which is available on the Insiders build and will be in the next release 🙂

  13. locked and limited conversation to collaborators on Nov 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugeditor-autoindentphp

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions