skip to Main Content

I’ve been trying to figure out how to format URL link but just cannot find a solution. Here’s what I have currently:

current

and here’s what I want it to be

expected

Except adding those tabs breaks the URL. I’m aware of the ALT + Z word wrap for vscode, however I would like a little more control on exactly where the text wraps and that I can set different lengths for different URLs.

is this something even possible?

2

Answers


  1. If you want to set different length for different URLs, you have to do it manually. If you want a similar length, you can update VS Code settings or add a tool like prettier and add max-length rules in it.

    Login or Signup to reply.
  2. You can use an extension like Prettier to handle formatting in VSCode. Install Prettier and after installing,
    In the search bar, type Prettier. You will see various options like "Print Width", "Tab Width", etc.

    Print Width: Controls the maximum line length. This can help you avoid very long URLs that go off-screen. Default is 80 characters, but you can increase it:

    "prettier.printWidth": 100
    

    Format on Save: If you want Prettier to automatically format your files upon saving, enable the following:

    "editor.formatOnSave": true
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search