Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support format on paste #13945

Closed
jrieken opened this issue Oct 18, 2016 · 10 comments

Comments

Projects
None yet
6 participants
@jrieken
Copy link
Member

commented Oct 18, 2016

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

@jrieken

This comment has been minimized.

Copy link
Member Author

commented Oct 18, 2016

related to #4039

@jrieken jrieken added this to the January 2017 milestone Jan 3, 2017

@egamma egamma referenced this issue Jan 3, 2017

Closed

January Iteration Plan #17608

56 of 56 tasks complete
@coreh

This comment has been minimized.

Copy link

commented Jan 6, 2017

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

@jrieken

This comment has been minimized.

Copy link
Member Author

commented Jan 12, 2017

@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
@rebornix

This comment has been minimized.

Copy link
Member

commented Jan 12, 2017

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

rebornix added a commit to rebornix/vscode that referenced this issue Jan 12, 2017

rebornix added a commit to rebornix/vscode that referenced this issue Jan 12, 2017

rebornix added a commit to rebornix/vscode that referenced this issue Jan 12, 2017

alexandrudima added a commit that referenced this issue Jan 19, 2017

Merge pull request #18476 from rebornix/FormatOnPaste
fix #13945. support format on paste

@jrieken jrieken referenced this issue Jan 23, 2017

Closed

Test format on paste #19047

2 of 2 tasks complete
@OliverJAsh

This comment has been minimized.

Copy link
Contributor

commented Feb 2, 2017

Like @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)

@jakearchibald

This comment has been minimized.

Copy link

commented Feb 2, 2017

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.

@rebornix

This comment has been minimized.

Copy link
Member

commented Feb 6, 2017

@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 @jrieken

@jakearchibald

This comment has been minimized.

Copy link

commented Feb 8, 2017

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.

@rebornix

This comment has been minimized.

Copy link
Member

commented Feb 8, 2017

@mjbvz I suppose what @jakearchibald mentioned is actually TypeScript formatter's default behavior, right?

@mjbvz

This comment has been minimized.

Copy link
Contributor

commented Feb 8, 2017

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.