Skip to content

Commit 3ad42fe

Browse files
committed
update config documentation
1 parent d52d634 commit 3ad42fe

File tree

2 files changed

+362
-144
lines changed

2 files changed

+362
-144
lines changed

docs/config/emmyrc_json_CN.md

Lines changed: 158 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,12 @@
22

33
# 🔧 EmmyLua 配置指南
44

5-
*全面掌握 EmmyLua Analyzer Rust 的配置选项*
6-
7-
[![Back to Main](https://img.shields.io/badge/← 返回主页-blue?style=for-the-badge)](../../README.md)
5+
*全面掌握 EmmyLua Analyzer Rust 的配置选项,让您的 Lua 开发更加高效*
86

97
</div>
108

119
---
1210

13-
## 📋 概述
14-
15-
EmmyLua 语言服务器支持灵活的配置系统,通过配置文件可以精细控制各种功能特性。
1611

1712
### 📁 配置文件
1813

@@ -24,6 +19,7 @@ EmmyLua 语言服务器支持灵活的配置系统,通过配置文件可以精
2419
- **`.emmyrc.json`**: 主要配置文件
2520
- **位置**: 项目根目录
2621
- **优先级**: 最高
22+
- **格式**: JSON Schema 支持
2723

2824
</td>
2925
<td width="50%">
@@ -32,12 +28,13 @@ EmmyLua 语言服务器支持灵活的配置系统,通过配置文件可以精
3228
- **`.luarc.json`**: 兼容配置文件
3329
- **自动转换**: 转换为 `.emmyrc.json` 格式
3430
- **覆盖规则**: 被 `.emmyrc.json` 覆盖
31+
- **兼容性**: 部分功能支持
3532

3633
</td>
3734
</tr>
3835
</table>
3936

40-
> **💡 注意**: `.emmyrc.json` 配置格式更加丰富,不兼容的部分会被自动忽略
37+
> **💡 提示**: `.emmyrc.json` 配置格式更加丰富和灵活,建议使用该格式以获得最佳体验
4138
4239
### 🛠️ Schema 支持
4340

@@ -56,66 +53,82 @@ EmmyLua 语言服务器支持灵活的配置系统,通过配置文件可以精
5653
以下是包含所有配置选项的完整配置文件示例:
5754

5855
<details>
59-
<summary><b>点击展开完整配置</b></summary>
56+
<summary><b>🔧 点击展开完整配置</b></summary>
6057

6158
```json
6259
{
60+
"$schema": "https://raw.githubusercontent.com/EmmyLuaLs/emmylua-analyzer-rust/refs/heads/main/crates/emmylua_code_analysis/resources/schema.json",
6361
"codeAction": {
6462
"insertSpace": false
6563
},
6664
"codeLens": {
6765
"enable": true
6866
},
6967
"completion": {
68+
"enable": true,
7069
"autoRequire": true,
7170
"autoRequireFunction": "require",
7271
"autoRequireNamingConvention": "keep",
7372
"autoRequireSeparator": ".",
7473
"callSnippet": false,
75-
"enable": true,
76-
"postfix": "@"
74+
"postfix": "@",
75+
"baseFunctionIncludesName": true
7776
},
7877
"diagnostics": {
79-
"diagnosticInterval": 500,
80-
"disable": [],
8178
"enable": true,
79+
"disable": [],
8280
"enables": [],
8381
"globals": [],
8482
"globalsRegex": [],
85-
"severity": {}
83+
"severity": {},
84+
"diagnosticInterval": 500
85+
},
86+
"doc": {
87+
"syntax": "md"
8688
},
8789
"documentColor": {
8890
"enable": true
8991
},
92+
"hover": {
93+
"enable": true
94+
},
9095
"hint": {
9196
"enable": true,
97+
"paramHint": true,
9298
"indexHint": true,
9399
"localHint": true,
94100
"overrideHint": true,
95-
"paramHint": true
101+
"metaCallHint": true
96102
},
97-
"hover": {
103+
"inlineValues": {
98104
"enable": true
99105
},
100106
"references": {
101107
"enable": true,
102108
"fuzzySearch": true,
103109
"shortStringSearch": false
104110
},
111+
"reformat": {
112+
"externalTool": null,
113+
"externalToolRangeFormat": null,
114+
"useDiff": false
115+
},
105116
"resource": {
106117
"paths": []
107118
},
108119
"runtime": {
120+
"version": "LuaLatest",
121+
"requireLikeFunction": [],
122+
"frameworkVersions": [],
123+
"extensions": [],
124+
"requirePattern": [],
109125
"classDefaultCall": {
126+
"functionName": "",
110127
"forceNonColon": false,
111-
"forceReturnSelf": false,
112-
"functionName": ""
128+
"forceReturnSelf": false
113129
},
114-
"extensions": [],
115-
"frameworkVersions": [],
116-
"requireLikeFunction": [],
117-
"requirePattern": [],
118-
"version": "LuaLatest"
130+
"nonstandardSymbol": [],
131+
"special": {}
119132
},
120133
"semanticTokens": {
121134
"enable": true
@@ -124,22 +137,22 @@ EmmyLua 语言服务器支持灵活的配置系统,通过配置文件可以精
124137
"detailSignatureHelper": true
125138
},
126139
"strict": {
140+
"requirePath": false,
141+
"typeCall": false,
127142
"arrayIndex": true,
128-
"docBaseConstMatchBaseType": true,
129143
"metaOverrideFileDefine": true,
130-
"requirePath": false,
131-
"typeCall": false
144+
"docBaseConstMatchBaseType": true
132145
},
133146
"workspace": {
134-
"enableReindex": false,
135-
"encoding": "utf-8",
136147
"ignoreDir": [],
137148
"ignoreGlobs": [],
138149
"library": [],
139-
"moduleMap": [],
150+
"workspaceRoots": [],
140151
"preloadFileSize": 0,
152+
"encoding": "utf-8",
153+
"moduleMap": [],
141154
"reindexDuration": 5000,
142-
"workspaceRoots": []
155+
"enableReindex": false
143156
}
144157
}
145158
```
@@ -164,8 +177,10 @@ EmmyLua 语言服务器支持灵活的配置系统,通过配置文件可以精
164177
| **`autoRequire`** | `boolean` | `true` | 📦 自动补全 require 语句 |
165178
| **`autoRequireFunction`** | `string` | `"require"` | ⚡ 自动补全时使用的函数名 |
166179
| **`autoRequireNamingConvention`** | `string` | `"keep"` | 🏷️ 命名规范转换方式 |
180+
| **`autoRequireSeparator`** | `string` | `"."` | 🔗 自动引用路径分隔符 |
167181
| **`callSnippet`** | `boolean` | `false` | 🎪 启用函数调用代码片段 |
168182
| **`postfix`** | `string` | `"@"` | 🔧 后缀补全触发符号 |
183+
| **`baseFunctionIncludesName`** | `boolean` | `true` | 📝 基础函数补全时包含函数名 |
169184

170185
#### 🏷️ 命名规范选项
171186

@@ -200,6 +215,69 @@ EmmyLua 语言服务器支持灵活的配置系统,通过配置文件可以精
200215

201216
---
202217

218+
### 🎯 codeAction - 代码操作
219+
220+
<div align="center">
221+
222+
#### 代码快速修复和重构操作配置
223+
224+
</div>
225+
226+
| 配置项 | 类型 | 默认值 | 描述 |
227+
|--------|------|--------|------|
228+
| **`insertSpace`** | `boolean` | `false` | 🔧 在 `---` 注释后插入 `@diagnostic disable-next-line` 时添加空格 |
229+
230+
---
231+
232+
### 📄 doc - 文档语法
233+
234+
| 配置项 | 类型 | 默认值 | 描述 |
235+
|--------|------|--------|------|
236+
| **`syntax`** | `string` | `"md"` | 📝 文档注释语法类型 |
237+
238+
#### 📚 支持的文档语法
239+
240+
<table>
241+
<tr>
242+
<td width="50%">
243+
244+
**`md`**
245+
Markdown 语法
246+
247+
</td>
248+
<td width="50%">
249+
250+
**`myst`**
251+
MyST 语法
252+
253+
</td>
254+
</tr>
255+
</table>
256+
257+
---
258+
259+
### 🎨 documentColor - 文档颜色
260+
261+
| 配置项 | 类型 | 默认值 | 描述 |
262+
|--------|------|--------|------|
263+
| **`enable`** | `boolean` | `true` | 🌈 启用/禁用文档中的颜色显示功能 |
264+
265+
---
266+
267+
### 🔧 reformat - 代码格式化
268+
269+
see [External Formatter Options](../external_format/external_formatter_options_CN.md)
270+
271+
---
272+
273+
### 📊 inlineValues - 内联值
274+
275+
| 配置项 | 类型 | 默认值 | 描述 |
276+
|--------|------|--------|------|
277+
| **`enable`** | `boolean` | `true` | 🔍 启用/禁用调试时的内联值显示 |
278+
279+
---
280+
203281
### 📝 signature - 函数签名
204282

205283
| 配置项 | 类型 | 默认值 | 描述 |
@@ -332,8 +410,9 @@ EmmyLua 语言服务器支持灵活的配置系统,通过配置文件可以精
332410
| **`enable`** | `boolean` | `true` | 🔧 启用/禁用内联提示 |
333411
| **`paramHint`** | `boolean` | `true` | 🏷️ 显示函数参数提示 |
334412
| **`indexHint`** | `boolean` | `true` | 📊 显示跨行索引表达式提示 |
335-
| **`localHint`** | `boolean` | `false` | 📍 显示局部变量类型提示 |
413+
| **`localHint`** | `boolean` | `true` | 📍 显示局部变量类型提示 |
336414
| **`overrideHint`** | `boolean` | `true` | 🔄 显示方法重载提示 |
415+
| **`metaCallHint`** | `boolean` | `true` | 🎭 显示元表 `__call` 调用提示 |
337416

338417
---
339418

@@ -347,45 +426,54 @@ EmmyLua 语言服务器支持灵活的配置系统,通过配置文件可以精
347426

348427
| 配置项 | 类型 | 默认值 | 描述 |
349428
|--------|------|--------|------|
350-
| **`version`** | `string` | `"Lua5.4"` | 🚀 Lua 版本选择 |
429+
| **`version`** | `string` | `"LuaLatest"` | 🚀 Lua 版本选择 |
351430
| **`requireLikeFunction`** | `string[]` | `[]` | 📦 类似 require 的函数列表 |
352431
| **`frameworkVersions`** | `string[]` | `[]` | 🎯 框架版本标识 |
353432
| **`extensions`** | `string[]` | `[]` | 📄 支持的文件扩展名 |
354433
| **`requirePattern`** | `string[]` | `[]` | 🔍 require 模式匹配规则 |
434+
| **`classDefaultCall`** | `object` | `{}` | 🏗️ 类默认调用配置 |
435+
| **`nonstandardSymbol`** | `string[]` | `[]` | 🔧 非标准符号列表 |
436+
| **`special`** | `object` | `{}` | ✨ 特殊符号配置 |
355437

356438
#### 🚀 支持的 Lua 版本
357439

358440
<table>
359441
<tr>
360-
<td width="20%">
442+
<td width="16.6%">
361443

362444
**`Lua5.1`**
363445
经典版本
364446

365447
</td>
366-
<td width="20%">
448+
<td width="16.6%">
367449

368450
**`Lua5.2`**
369451
增强功能
370452

371453
</td>
372-
<td width="20%">
454+
<td width="16.6%">
373455

374456
**`Lua5.3`**
375457
整数支持
376458

377459
</td>
378-
<td width="20%">
460+
<td width="16.6%">
379461

380462
**`Lua5.4`**
381463
最新特性
382464

383465
</td>
384-
<td width="20%">
466+
<td width="16.6%">
385467

386468
**`LuaJIT`**
387469
高性能版本
388470

471+
</td>
472+
<td width="16.6%">
473+
474+
**`LuaLatest`**
475+
最新特性合集
476+
389477
</td>
390478
</tr>
391479
</table>
@@ -395,11 +483,20 @@ EmmyLua 语言服务器支持灵活的配置系统,通过配置文件可以精
395483
```json
396484
{
397485
"runtime": {
398-
"version": "Lua5.4",
399-
"requireLikeFunction": ["import", "load"],
400-
"frameworkVersions": ["love2d", "openresty"],
401-
"extensions": [".lua", ".lua.txt"],
402-
"requirePattern": ["?.lua", "?/init.lua"]
486+
"version": "LuaLatest",
487+
"requireLikeFunction": ["import", "load", "dofile"],
488+
"frameworkVersions": ["love2d", "openresty", "nginx"],
489+
"extensions": [".lua", ".lua.txt", ".luau"],
490+
"requirePattern": ["?.lua", "?/init.lua", "lib/?.lua"],
491+
"classDefaultCall": {
492+
"functionName": "new",
493+
"forceNonColon": false,
494+
"forceReturnSelf": true
495+
},
496+
"nonstandardSymbol": ["continue"],
497+
"special": {
498+
"errorf":"error"
499+
}
403500
}
404501
}
405502
```
@@ -531,21 +628,33 @@ EmmyLua 语言服务器支持灵活的配置系统,通过配置文件可以精
531628
| 配置项 | 类型 | 默认值 | 描述 |
532629
|--------|------|--------|------|
533630
| **`enable`** | `boolean` | `true` | 🔍 启用/禁用引用查找功能 |
534-
| **`fuzzy_search`** | `boolean` | `true` | 🎯 启用模糊搜索 |
631+
| **`fuzzySearch`** | `boolean` | `true` | 🎯 启用模糊搜索 |
632+
| **`shortStringSearch`** | `boolean` | `false` | 🔤 启用短字符串搜索 |
535633

536634
---
537635

636+
637+
### 📚 相关资源
638+
538639
<div align="center">
539640

540-
## 🎯 总结
641+
[![GitHub](https://img.shields.io/badge/GitHub-EmmyLuaLs/emmylua--analyzer--rust-blue?style=for-the-badge&logo=github)](https://github.com/EmmyLuaLs/emmylua-analyzer-rust)
642+
[![Documentation](https://img.shields.io/badge/文档-完整配置指南-green?style=for-the-badge&logo=gitbook)](../../README.md)
643+
[![Issues](https://img.shields.io/badge/问题反馈-GitHub%20Issues-red?style=for-the-badge&logo=github)](https://github.com/EmmyLuaLs/emmylua-analyzer-rust/issues)
644+
645+
</div>
646+
647+
---
648+
649+
### 🎉 开始使用
541650

542-
通过合理配置 EmmyLua,您可以:
651+
1. **创建配置文件**: 在项目根目录创建 `.emmyrc.json`
652+
2. **添加 Schema**: 复制上方的 schema URL 以获得智能提示
653+
3. **逐步配置**: 根据项目需求逐步添加配置项
654+
4. **测试验证**: 保存配置并测试语言服务器功能
543655

544-
- **🎯 提升开发效率**: 智能补全和提示
545-
- **🔍 提高代码质量**: 严格的类型检查和诊断
546-
- **🛠️ 定制开发环境**: 适应不同项目需求
547-
- **⚡ 优化性能**: 合理的工作区和索引配置
656+
> **💡 小贴士**: 建议从基础配置开始,逐步添加高级功能,这样可以更好地理解每个配置项的作用。
548657
549-
[⬆ 返回顶部](#-emmylua-配置指南)
658+
[⬆ 返回顶部](#-emmylua-analyzer-rust-配置指南)
550659

551660
</div>

0 commit comments

Comments
 (0)