Skip to content

Copy and Paste issue with closing brace #65614

Closed

Description

@Daijobou

Version: 1.30.1 (system setup)
Commit: dea8705
Datum: 2018-12-18T18:12:07.165Z
Electron: 2.0.12
Chrome: 61.0.3163.100
Node.js: 8.9.3
V8: 6.1.534.41
Betriebssystem: Windows_NT x64 10.0.17763
Windows 10

See GIF
vscodea

The closing brace go to wrong place after paste code, in second example.

Activity

  1. Daijobou commented on Jan 3, 2019

    @Daijobou
    Author

    Here is much more issues with autoindent. Should I create a new ticket or paste it here? Example
    vscodeh

  2. Daijobou commented on Apr 10, 2019

    @Daijobou
    Author

    Here another variant with 1.33.0
    Structure looks fine, but after copy&paste format is mismatch. After paste I press shortcut STRG+Z (german) for "undo" and its not remove the block, its formatted the block correctly!? A second "undo" remove the pasted block. Create formating new with starting from line beginning the copy&paste error is gone. See
    pasteA

  3. Tronic commented on Aug 13, 2019

    @Tronic

    The difference of indentation in a pasted block vs. receiving code gets applied to a line of code directly after paste location. Meaning: if you copy 8-spaces indented code and paste it into 4-spaces indented code, one of the original code lines incorrectly gets deindented by four spaces. If the copied code was indented less than the paste location, extra indent gets added to the next line. My testcases https://paste.zi.fi/p/vscodebug.py/view

  4. added
    under-discussion
    on Oct 21, 2019
  5. rebornix commented on Nov 3, 2020

    @rebornix
    Contributor

    This is due to the limited architecture (regex based indentation rules and only support limited code styles), we may want to consider using formatters if they exist for indenation adjustment (if interested, we can discuss in #19847).

    For this particular issue, if the indentation rules are leading to more trouble than having no auto indent, you can set editor.autoIndent to advanced to disable the regex based indentation adjustment or use auto formatting (editor.formatOnType, editor.formatOnPaste). As we don't have an easy good-enough fix for it, we close it for now and explore better solutions through issues like (#19847 and #34621).

  6. locked and limited conversation to collaborators on Dec 18, 2020
  7. added 3 commits that reference this issue on May 19, 2023
    dd67538
    3b8024e
    b733589
  8. added a commit that references this issue on Jun 9, 2023
    3ae10ad
  9. added a commit that references this issue on Jul 18, 2023
    835deb4
  10. added 5 commits that reference this issue on Sep 30, 2023
    38fa637
    886e568
    6ed6108
    1e2c3d3
    8b96807
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

editor-autoindentunder-discussion

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions