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: add option to use the first "editor.rulers" list element as the wrapping column instead of using the "rewrap.wrappingColumn" setting #383

Open
1 task
ElectricRCAircraftGuy opened this issue Sep 23, 2023 · 3 comments

Comments

@ElectricRCAircraftGuy
Copy link

ElectricRCAircraftGuy commented Sep 23, 2023

In Sublime Text, Alt + Q column wrapping is controlled by the first element in the "rulers" setting. (For those who don't know: each element in the "rulers" setting applies a vertical ruler bar in your editor window.)

Here, in Sublime Text, the wrapping column is 80:

    "rulers":
    [
        // 50,
        // 72,
        // When writing Stack Overflow answers, temporarily shift this "80" line up to be first so
        // Alt + Q will wrap at 80 chars to prevent the horizontal scroll bar from showing up on
        // your answer.
        80,
        100,
        120,
    ],

Here, it is also 80:

    "rulers":
    [
        80,
        50,
        72,
        100,
        120,
    ],

Here, it is 50:

    "rulers":
    [
        50,
        72,
        80,
        100,
        120,
    ],

Here, it is 120:

    "rulers":
    [
        120,
        50,
        72,
        80,
        100,
    ],

You get the point.

Feature request:

  • Add a checkbox setting to the Rewrap settings to allow the same behavior in VSCode.

In the VSCode User Settings JSON file, the option is called "editor.rulers", however, and would look like this, for instance:

    "editor.rulers": [
        80,
        100,
        120,
    ],

Rather than me having to add a separate entry like this to my settings.json file:

    "rewrap.wrappingColumn": 80,

...I'd like to just use the first element in "editor.rulers" as that wrapping-column setting, just like in Sublime Text.

Note: I regularly edit the settings.json file in the middle of writing answers on Stack Overflow or in code in order to get different wrapping behavior, since, in particular, Stack Overflow has required it to be 80 chars to not have a horizontal scroll bar in your code blocks in questions or answers.

@matthew-e-brown
Copy link

I just stumbled across this issue and I may have a fix for you. All you have to do to get behaviour that (while not exactly what you're asking for) will accommodate what it is you're trying to do should be to remove your rewrap.wrappingColumn setting entirely (or set it to zero).

Rewrap's default behaviour already makes use of editor.rulers. You can actually leave all the rulers you want to frequently wrap at in your editor.rulers array, and then use mulitple Alt+Q presses to switch between them. Not only that, but Rewrap will remember which of those rulers you most recently wrapped to, and use it for subsequent executions (so wrapping to the last of 4 rulers doesn't take 4 Alt+Q's every time).

Again, even though this isn't exactly a setting for "always use the first ruler," I'd argue that this is actually better. When set to "always use the first ruler," changing where you're wrapping means that you have to edit the settings file every time (which you say you already do). As it is right now, as long as you don't override the rulers with wrappingColumn, you can get away with never editing the settings file.

Does that solve your issue?

@ElectricRCAircraftGuy
Copy link
Author

ElectricRCAircraftGuy commented Sep 28, 2023

@matthew-e-brown , I'd still like to see the option I requested, but yes, this is super useful! Thank you very much.

How did you make that super cool Gif that shows which keys you are pressing, by the way?

Making Gifs would be super useful for tutorials and instructions, which I write a ton of, but it's not a skill I've learned yet.

ElectricRCAircraftGuy added a commit to ElectricRCAircraftGuy/eRCaGuy_dotfiles that referenced this issue Sep 28, 2023
See the comment here: stkb/Rewrap#383 (comment)

Pressing Alt + Q multiple times wraps to the various settings inside
`"editor.rulers":`.
@matthew-e-brown
Copy link

I'm proud my efforts to make a nice GIF didn't go unnoticed 😄 It's a combination of ScreenToGif and Key-n-Stroke. I can attest that they're very nice for instructions, I learned about ScreenToGif from one of the professors at my university :)

If I may... I'm not exactly a contributor here, but I'm curious. What is the improvement that using the first editor.rulers value brings over having a dedicated value in the settings file, if changing its value requires a manual edit of the settings file in either case? Either way, you just need to comment/uncomment one or two lines, and maybe reorder some; but both of those have pretty instant shortcuts in VS-Code.

Not saying this feature wouldn't have any purpose or anything like that, I'm just curious why this is the specific behaviour you're after.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants