1

Можно ли в VSCode настроить форматирование HTML кода так, чтоб не форматировалось по атрибутам тега по атрибутам, а перенос осуществлялся по параметру "html.format.wrapLineLength": 120 Пример: Теперь:

<input
    type="email"
    onChange={this.handleEmailChange}
    id="inputEmail"
    className="form-control"
    placeholder="Email address"
    required
    autofocus
/>

Надо:

<label for="inputEmail" className="sr-only">Email address</label>
<input type="email" onChange={this.handleEmailChange} id="inputEmail" className="form-control" placeholder="Email address" required autofocus />
<label for="inputPassword" className="sr-only">Password</label>
<input type="password" onChange={this.handlePasswordChange} id="inputPassword" className="form-control" placeholder="Password" required />

Пробовал параметр: "html.format.unformatted": "input", НЕ получилось.

1 ответ 1

4

важный нюанс !!!:

  • параметры пользователя
    глобальные

  • параметры рабочей области
    локальные перекрывают глобальные хранятся в текущем проекте в файле settings.json

    .vscode
    ├── launch.json
    ├── settings.json
    └── tasks.json
    

при настройке переключение между файлами происходит по клику на надписи, подчёркнутые на картинке

введите сюда описание изображения


{
    "html.format.wrapAttributes": "force-aligned"
}

<input type="email"
       onChange={this.handleEmailChange}
       id="inputEmail"
       className="form-control"
       placeholder="Email address"
       required
       autofocus />

{
    "html.format.wrapAttributes": "force-expand-multiline"
}

<input
 type="email"
 onChange={this.handleEmailChange}
 id="inputEmail"
 className="form-control"
 placeholder="Email address"
 required
 autofocus
/>

{
    "html.format.wrapAttributes": "auto"
}

<input type="email" onChange={this.handleEmailChange} id="inputEmail" className="form-control" placeholder="Email address"
 required autofocus />

введите сюда описание изображения

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.