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

Feature request: command to hard wrap text block at certain column (Sublime Text: cmd+shift+Q) #2770

Closed
peterbourgon opened this issue Feb 6, 2016 · 8 comments
Labels
feature-request Request for new features or functionality

Comments

@peterbourgon
Copy link

This is a followup from vscode-go/#113. In Sublime Text, if I place the cursor in a paragraph, or select a block of text, and press cmd+shift+Q, it will hard-wrap the paragraph/block at the currently defined wrap column. It also preserves comment semantics, i.e. prefix or block-level comment definitions.

fwmzg5jcdg

This feature is incredibly valuable.

@stkb
Copy link
Contributor

stkb commented Feb 8, 2016

I was just thinking the other day of writing an extension for this (haven't found an existing one), that supported comments for various languages. Is it only comments you're needing this for or other things too?

@peterbourgon
Copy link
Author

Comments are definitely the 80% (99%?) use-case. I guess the only other place I could see it being useful is in a big multi-line string literal. But even that's a stretch.

@alexdima alexdima added the feature-request Request for new features or functionality label Feb 8, 2016
@stkb
Copy link
Contributor

stkb commented Feb 9, 2016

@peterbourgon I've just published the extension rewrap. The readme is a bit hastily put together so hope you can work it out. At the moment it only supports C-style comments (// and /* ... */) so adding more languages is the next priority. Would appreciate any feedback you have :)

@peterbourgon
Copy link
Author

@stkb I've installed it and had a play. Works nicely! Thank you very much; one happy customer here.

@natefinch
Copy link

OMG @stkb you are my personal hero. This was my number one pain point when switching from Sublime. Thanks so much!

@natefinch
Copy link

One oddity is that it seems to leave wrapped text selected if my cursor was in the text that got wrapped, which means I end up overwriting the text if I wrap in the middle of typing.

So like, if I write "abc 123 456" and my cursor is after the 6, and the wrapping point is between the letters and numbers. When I wrap, all the text that gets moved to the next line (the numbers) will be selected (with my cursor at the end of the selection).

@stkb
Copy link
Contributor

stkb commented Apr 12, 2016

@natefinch Thanks for the compliment :)

And yeah the selection and text cursor position after wrapping is something I've never been happy with, just haven't got round to fully investigating yet. Sometimes vscode seems to do one thing, sometimes another. I've created an issue for it in the repo: stkb/Rewrap#4

@lnunno
Copy link

lnunno commented Mar 17, 2017

How is this not built in? Thanks @stkb

@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests

5 participants