Skip to content

Commit 381d677

Browse files
committed
update config doc
1 parent e957dfc commit 381d677

3 files changed

Lines changed: 910 additions & 683 deletions

File tree

README.md

Lines changed: 60 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,33 +39,81 @@ Or download pre-built binaries from the [Releases](https://github.com/CppCXY/emm
3939

4040
### Editor Setup
4141

42+
Before connecting your editor:
43+
44+
1. Install `emmylua_ls` and make sure it is available in `PATH`, or use an absolute binary path in your LSP client.
45+
2. Add a project config file such as `.emmyrc.json` or `.luarc.json`.
46+
3. Restart the language server after changing global editor or workspace configuration.
47+
48+
See the [Configuration Guide](./docs/config/emmyrc_json_EN.md) for all supported options.
49+
4250
<details>
4351
<summary><b>VS Code</b></summary>
4452

45-
Install the [EmmyLua Extension](https://marketplace.visualstudio.com/items?itemName=tangzx.emmylua).
53+
Recommended setup:
54+
55+
1. Install the [EmmyLua Extension](https://marketplace.visualstudio.com/items?itemName=tangzx.emmylua).
56+
2. Open a Lua workspace.
57+
3. Add `.emmyrc.json` at the project root if you need custom runtime, diagnostics, or library paths.
58+
59+
This is the easiest way to get completion, diagnostics, hover, formatting, semantic tokens, and project indexing with minimal manual setup.
4660

4761
</details>
4862

4963
<details>
5064
<summary><b>Neovim</b></summary>
5165

66+
Neovim 0.11+ example:
67+
5268
```lua
53-
vim.lsp.enable({"emmylua_ls"})
69+
vim.lsp.config("emmylua_ls", {
70+
cmd = { "emmylua_ls" },
71+
filetypes = { "lua" },
72+
root_markers = { ".emmyrc.json", ".luarc.json", ".git" },
73+
})
74+
75+
vim.lsp.enable("emmylua_ls")
5476
```
5577

78+
If you manage servers manually, replace `cmd` with the full path to your binary.
79+
5680
</details>
5781

5882
<details>
5983
<summary><b>IntelliJ IDE</b></summary>
6084

6185
Install the [EmmyLua2 Plugin](https://plugins.jetbrains.com/plugin/25076-emmylua2) from the JetBrains Marketplace.
6286

87+
For most projects, no extra setup is required beyond opening the workspace. Add `.emmyrc.json` if you need custom workspace roots, library paths, or stricter diagnostics.
88+
6389
</details>
6490

6591
<details>
6692
<summary><b>Other editors</b></summary>
6793

68-
Any editor with LSP support can use `emmylua_ls` via stdio (default) or TCP.
94+
Any editor with LSP support can use `emmylua_ls` over stdio, which is the default and recommended mode.
95+
96+
Typical client command:
97+
98+
```json
99+
{
100+
"command": "emmylua_ls",
101+
"args": []
102+
}
103+
```
104+
105+
Use TCP only when you explicitly want a remote or debug-friendly setup:
106+
107+
```bash
108+
emmylua_ls -c tcp --ip 127.0.0.1 --port 5007
109+
```
110+
111+
Useful client root markers:
112+
113+
- `.emmyrc.json`
114+
- `.luarc.json`
115+
- `.emmyrc.lua`
116+
- `.git`
69117

70118
</details>
71119

@@ -86,7 +134,15 @@ Any editor with LSP support can use `emmylua_ls` via stdio (default) or TCP.
86134

87135
### LSP Capabilities
88136

89-
Completion · Go to Definition · Find References · Go to Implementation · Hover · Signature Help · Rename · Code Actions · Diagnostics · Document & Workspace Symbols · Formatting · Folding · Document Links · Semantic Tokens · Inlay Hints · Document Highlights · Code Lens · Call Hierarchy · Document Color
137+
| Area | Capabilities |
138+
| --- | --- |
139+
| Navigation | Go to Definition, Go to Implementation, Find References, Call Hierarchy, Document Highlights |
140+
| Symbols | Document Symbols, Workspace Symbols, Selection Range |
141+
| Editing | Completion, Rename, Code Actions, Document Formatting, Range Formatting, On-type Formatting |
142+
| Insight | Hover, Signature Help, Diagnostics, Semantic Tokens, Inlay Hints, Code Lens, Document Color |
143+
| Structure | Folding Range, Document Links |
144+
145+
In practice, this gives you a full day-to-day Lua editing workflow: symbol navigation, annotation-aware type feedback, project-wide references, incremental diagnostics, and formatting support in editors that expose standard LSP features.
90146

91147
### Code Quality
92148

0 commit comments

Comments
 (0)