Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

345
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda