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

rewrap document on save #165

Open
jasonkuhrt opened this issue Oct 3, 2019 · 5 comments
Open

rewrap document on save #165

jasonkuhrt opened this issue Oct 3, 2019 · 5 comments
Labels
in pre-release version Is in pre-release version but not in stable yet

Comments

@jasonkuhrt
Copy link

Thanks so much for this awesome tool. I've been wanting something like this for a long time. Prettier has it in the backlog but you've actually done it. Kudos!

One thing that I could not figure out though (in VSCode) was how to make the rewrap run over the whole document on every file save. I'm probably just missing something obvious, but wasn't sure.

@leepowelldev
Copy link

If this isn't implemented it'd be great to see

@stkb stkb added this to the v1.12.0 milestone May 29, 2020
@stkb stkb removed this from the v1.12.0 milestone Jun 20, 2020
stkb added a commit that referenced this issue Feb 16, 2022
stkb added a commit that referenced this issue Feb 16, 2022
stkb added a commit that referenced this issue Feb 16, 2022
@stkb stkb added in pre-release version Is in pre-release version but not in stable yet and removed enhancement labels Feb 16, 2022
@stkb
Copy link
Owner

stkb commented Feb 16, 2022

This is now fixed pre-release version 17.7.

It's enabled with this setting (or through the UI):

{
    "rewrap.onSave": true
}

Naturally this can be configured per file-type or workspace (recommended).

If you don't like the result after saving a document you can just undo, but you'lll have to turn it off before saving again.

(I wasn't sure whether to call it "rewrap.onSave" or "rewrap.runOnSave", and the setting name might still change before it makes it into the stable version)

@stkb stkb mentioned this issue Feb 16, 2022
stkb added a commit that referenced this issue Feb 21, 2022
@ubalklen
Copy link

ubalklen commented Apr 2, 2022

This is amazing. Thanks!

@stkb you filled a major gap in the VSCode/Python stack, which is the lack of a formatter that can properly wrap long lines in docstrings. Surprisingly, neither Black (#2865), docformatter (#60) or pyment (#74) do that.

@politician
Copy link

(I wasn't sure whether to call it "rewrap.onSave" or "rewrap.runOnSave", and the setting name might still change before it makes it into the stable version)

Based on my settings I found those usages of onSave:

  • editor.formatOnSave
  • editor.codeActionsOnSave
  • typescript.extension.sortImports.sortOnSave

So maybe something like rewrap.wrapOnSave would be appropriate.

@karlhorky
Copy link

karlhorky commented Dec 7, 2023

Thanks for this extension and also the onSave option, this is great!

@stkb would you consider releasing the Prerelease version from 2022 as the main release version?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in pre-release version Is in pre-release version but not in stable yet
Projects
None yet
Development

No branches or pull requests

6 participants