Skip to content

Regression: JavaScript Indentation drifts on paste #36294

Closed

Description

  • VSCode Version: Code 1.17.1 (1e9d365, 2017-10-10T14:10:17.189Z)
  • OS Version: Darwin x64 15.6.0
  • Extensions:
Extension Author (truncated) Version
code-settings-sync Sha 2.8.3
sort-lines Tyr 1.3.0
vscode-new-file dku 3.1.1
tslint eg2 1.0.11
cpptools ms- 0.13.1
vscode-icons rob 7.15.0
vscode-open-in-github sys 1.6.0

Steps to Reproduce:

  1. Select a section of javascript with indentation including a newline
  2. Paste

animation

Reproduces without extensions: Yes
Reproduces in insiders: Yes 1.18 (989c400)

Previously, the indention was as expected on paste. My editor.formatOnPaste is explicitly set to false in my user settings. A basic rule of thumb seems to apply that selecting a text range and pasting once should be a noop. Is there something I'm missing or a new setting I need to disable?

UPDATE: it's worth nothing that the same indentation creep problem does not apply to lines within the same block

Activity

  1. added
    editor-core
    on Oct 15, 2017
  2. added
    editor-autoindent
    on Oct 15, 2017
  3. added
    javascript
    and removed
    editor-core
    on Oct 15, 2017
  4. added
    info-needed
    on Nov 15, 2017
  5. mjbvz commented on Nov 15, 2017

    @mjbvz
    Contributor

    Patrick Hulce (@patrickhulce) Can you please share some source code that reproduces this issue

  6. patrickhulce commented on Nov 15, 2017

    @patrickhulce
    Author

    sure Matt Bierner (@mjbvz), here's a sample I was just able to reproduce with a screenshot for selection emphasis

    image

    Code as text
    describe('test', () => {
      it('test 1', () => {
    
      }) // select from here ->
    
      it('should be fine', () => {
        // but it is not :(
      }) // to here ->
    })
  7. added
    bug
    and removed
    info-needed
    on Nov 16, 2017
  8. added a commit that references this issue on Nov 28, 2017
  9. rebornix commented on Nov 28, 2017

    @rebornix
    Contributor

    #36294, #29896, #38833 share the same root cause: empty lines are not handled gracefully. I pushed a fix which makes this specific case work but it may not work for all cases ;)

  10. locked and limited conversation to collaborators on Jan 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugeditor-autoindentjavascript

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions