Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

339
Views
Visual Studio how to stop indentation formatting on select javascript code?

I'm keen to know whether there is a way to stop Visual Studio Cntl + K + D hot function from resetting the indentation of my code for certain code sections?

Example is when I write html in javascript code, to make it more readable i like to apply my own indentations, as shown below:

let html =
    '<div class="d-flex flex-column" style="height: 100%">' +
        '<div class="d-flex">' +
            '<div class="icon-heading">' +
                '<i class="fa-solid fa-clipboard-list fa-1x"></i>' +
                '<h6 class="ms-2 mt-2">User Ack Notes</h6>' +
                '<!-- spinner = see layout.cshtml file -->' +
            '</div>' +
        '</div>' +
    '</div>;

But as soon as i hiy Cntrl + K + D then VS will automatically remove these indentations, as shown below:

enter image description here

This is very annoying and would be great if some kind of a js tag could be added to stop VS from applying the removal of indentations. I often use Cntrl + K + D to tidy up all other code blocks so I couldnt afford to simply remove the code tidy up feature.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!