Skip to content

Support format on paste #13945

Closed
Closed

Description

We should add support for format on paste. Idea is to simply invoke selection formatters when paste has happened.

Activity

  1. added
    feature-request
    formatting
    on Oct 18, 2016
  2. jrieken commented on Oct 18, 2016

    @jrieken
    ContributorAuthor

    related to #4039

  3. coreh commented on Jan 6, 2017

    @coreh

    On OS X, could this be mapped to "Paste and Match Style"? ⌥⇧⌘V

  4. jrieken commented on Jan 12, 2017

    @jrieken
    ContributorAuthor

    Peng Lyu (@rebornix) Do you want me to get started on this? We already have the concept for formatting a range so, my plan is to do the following:

    1. detect paste range
    2. invoke range formatter
  5. rebornix commented on Jan 12, 2017

    @rebornix
    Contributor

    Johannes Rieken (@jrieken) previously I implemented it in another way but we think that's not good, I'll follow your suggestions and do this again :)

  6. added a commit that references this issue on Jan 19, 2017
    abbd2a7
  7. OliverJAsh commented on Feb 2, 2017

    @OliverJAsh
    Contributor

    Like Marco Buono (@coreh) I'm also interested to know whether this can be a command separate from paste so the user can choose which to use on demand (i.e. one keyboard shortcut for paste, one for paste + format)

  8. jakearchibald commented on Feb 2, 2017

    @jakearchibald

    Firstly, thanks for adding this, it's been the one feature I really missed from Sublime Text.

    Having a play around with it, it seems to create two entries into undo history per single paste. I can't decide if that's a bug or a feature.

  9. rebornix commented on Feb 6, 2017

    @rebornix
    Contributor

    Jake Archibald (@jakearchibald) It's not a bug but I can't say it's a feature :( The behavior is consistent with FormatOnType or Save as we hook the formatting handler to Type/Save/Paste event, which makes it two entries in undo/redo stack. cc Johannes Rieken (@jrieken)

  10. jakearchibald commented on Feb 8, 2017

    @jakearchibald

    Another "is this a bug or not?"

    If I paste:

    self.addEventListener('fetch', function(event) {
      event.respondWith(
        promiseAny([
          caches.match(event.request),
          fetch(event.request)
        ])
      );
    });

    It adds a space between function and (event). I didn't expect it to do that.

  11. rebornix commented on Feb 8, 2017

    @rebornix
    Contributor

    Matt Bierner (@mjbvz) I suppose what Jake Archibald (@jakearchibald) mentioned is actually TypeScript formatter's default behavior, right?

  12. mjbvz commented on Feb 8, 2017

    @mjbvz
    Contributor

    Yes, you can disable this formatting using "javascript.format.insertSpaceAfterFunctionKeywordForAnonymousFunctions": false or "typescript.format.insertSpaceAfterFunctionKeywordForAnonymousFunctions": false

  13. locked and limited conversation to collaborators on Nov 18, 2017
  14. added 2 commits that reference this issue on Sep 6, 2026
    8c7bcce
    3830e12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

feature-requestformatting

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions