html: Improve settings, formatting and user binaries (#27524)
Added support for using `language_server` as HTML formatter. Added support for finding `vscode-html-language-server` in user's path. Release Notes: - N/A
This commit is contained in:
parent
8b3ddcd545
commit
435a36b9f9
2 changed files with 71 additions and 8 deletions
|
@ -17,6 +17,55 @@ If you do not want to use the HTML extension, you can add the following to your
|
|||
}
|
||||
```
|
||||
|
||||
## Formatting
|
||||
|
||||
By default Zed uses [Prettier](https://prettier.io/) for formatting HTML
|
||||
|
||||
You can disable `format_on_save` by adding the following to your Zed settings:
|
||||
|
||||
```json
|
||||
"languages": {
|
||||
"HTML": {
|
||||
"format_on_save": "off",
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
You can still trigger formatting manually with {#kb editor::Format} or by opening the command palette ( {#kb commandPalette::Toggle} and selecting `Format Document`.
|
||||
|
||||
### LSP Formatting
|
||||
|
||||
If you prefer you can use `vscode-html-language-server` instead of Prettier for auto-formatting by adding the following to your Zed settings:
|
||||
|
||||
```json
|
||||
"languages": {
|
||||
"HTML": {
|
||||
"formatter": "language_server",
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
You can customize various [formatting options](https://code.visualstudio.com/docs/languages/html#_formatting) for `vscode-html-language-server` via Zed settings.json:
|
||||
|
||||
```json
|
||||
"lsp": {
|
||||
"vscode-html-language-server": {
|
||||
"settings": {
|
||||
"html": {
|
||||
"format": {
|
||||
// Indent under <html> and <head> (default: false)
|
||||
"indentInnerHtml": true,
|
||||
// Disable formatting inside <svg> or <script>
|
||||
"contentUnformatted": "svg,script",
|
||||
// Add an extra newline before <div> and <p>
|
||||
"extraLiners": "div,p"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## See also:
|
||||
|
||||
- [CSS](./css.md)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue