mirror of
https://github.com/zed-industries/zed.git
synced 2025-02-05 18:25:57 +00:00
docs: Add lua-language-server formatter example (#24105)
Some checks are pending
CI / Check Postgres and Protobuf migrations, mergability (push) Waiting to run
CI / Check formatting and spelling (push) Waiting to run
CI / (macOS) Run Clippy and tests (push) Waiting to run
CI / (Linux) Run Clippy and tests (push) Waiting to run
CI / (Linux) Build Remote Server (push) Waiting to run
CI / (Windows) Run Clippy and tests (push) Waiting to run
CI / Create a macOS bundle (push) Blocked by required conditions
CI / Linux x86_x64 release bundle (push) Blocked by required conditions
CI / Linux arm64 release bundle (push) Blocked by required conditions
CI / Auto release preview (push) Blocked by required conditions
Deploy Docs / Deploy Docs (push) Waiting to run
Docs / Check formatting (push) Waiting to run
Script / ShellCheck Scripts (push) Waiting to run
Some checks are pending
CI / Check Postgres and Protobuf migrations, mergability (push) Waiting to run
CI / Check formatting and spelling (push) Waiting to run
CI / (macOS) Run Clippy and tests (push) Waiting to run
CI / (Linux) Run Clippy and tests (push) Waiting to run
CI / (Linux) Build Remote Server (push) Waiting to run
CI / (Windows) Run Clippy and tests (push) Waiting to run
CI / Create a macOS bundle (push) Blocked by required conditions
CI / Linux x86_x64 release bundle (push) Blocked by required conditions
CI / Linux arm64 release bundle (push) Blocked by required conditions
CI / Auto release preview (push) Blocked by required conditions
Deploy Docs / Deploy Docs (push) Waiting to run
Docs / Check formatting (push) Waiting to run
Script / ShellCheck Scripts (push) Waiting to run
This commit is contained in:
parent
4885ace107
commit
1dd2bbe2ba
1 changed files with 21 additions and 4 deletions
|
@ -16,22 +16,39 @@ See [LuaLS Settings Documentation](https://luals.github.io/wiki/settings/) for a
|
|||
"$schema": "https://raw.githubusercontent.com/LuaLS/vscode-lua/master/setting/schema.json",
|
||||
"runtime.version": "Lua 5.4",
|
||||
"diagnostics.severity": {
|
||||
// "duplicate-set-field": "Hint"
|
||||
"duplicate-set-field": "Hint"
|
||||
},
|
||||
"format.enable": true,
|
||||
"format.defaultConfig": {
|
||||
"indent_style": "space",
|
||||
"indent_size": "4"
|
||||
},
|
||||
// Location(s) of any LuaCATS / EmmyLua annotation stubs
|
||||
"workspace.library": [
|
||||
// "path/to/library/directory"
|
||||
"../soemdir/library"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Formatting
|
||||
|
||||
Zed can enable auto-formatting of code with formatters like [StyLua](https://github.com/JohnnyMorganz/StyLua).
|
||||
### LuaLS
|
||||
|
||||
To enable auto-formatting with your LuaLS, make sure you have `"format.enable": true,` in your .luarc.json add the following to your Zed `settings.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
"languages": {
|
||||
"Lua": {
|
||||
"format_on_save": "on",
|
||||
"formatter": "language_server"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### StyLua
|
||||
|
||||
Alternative you can use [StyLua](https://github.com/JohnnyMorganz/StyLua):
|
||||
|
||||
1. Install [StyLua](https://github.com/JohnnyMorganz/StyLua): `brew install stylua` or `cargo install stylua --features lua52,lua53,lua54,luau,luajit` (feel free to remove any Lua versions you don't need).
|
||||
2. Add the following to your `settings.json`:
|
||||
|
|
Loading…
Reference in a new issue