Skip to content

Commit 28bff89

Browse files
committed
update document
1 parent 5bbc188 commit 28bff89

File tree

5 files changed

+262
-1
lines changed

5 files changed

+262
-1
lines changed

CHANGELOG.md

Lines changed: 68 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,75 @@
11
# Change Log
22

3+
## 1.1.3
4+
5+
`NEW` 功能 `命名风格检查` 正式支持配置.
6+
7+
`CHANGE` `local empty = function() end` 格式化时不会再换行
8+
9+
`NEW` 支持形如 `local d; Init()` 的排版方式
10+
11+
`NEW` 支持链式表达式对齐
12+
13+
## 1.1.2
14+
15+
`NEW` 新选项 `align_continuous_line_space`
16+
17+
`NEW` 还有其他更新, 但是我忘了
18+
19+
## 1.1.1
20+
21+
`NEW` 优化type format
22+
23+
`FIX` type format 不会清理`---@format disable``---@format disable-next`之下的内容了
24+
25+
## 1.1.0
26+
27+
`FIX` 修复许多BUG
28+
29+
30+
`NEW` 重新支持`---@format disable``---@format disable-next`
31+
32+
## 1.0.9
33+
34+
`FIX` 修复缩进检查的一些BUG
35+
36+
## 1.0.8
37+
38+
`NEW` 支持缩进检查
39+
40+
`NEW` 修复一些BUG
41+
42+
## 1.0.7
43+
44+
`FIX` fix #89 #90
45+
46+
## 1.0.6
47+
48+
`NEW` 支持内联注释对齐
49+
50+
## 1.0.5
51+
52+
`FIX` 修复文件增量更新算法的BUG
53+
54+
## 1.0.4
55+
56+
`Upgrade` 试图修复vscode-languageclient带来的依赖错误
57+
58+
## 1.0.3
59+
60+
`Upgrade` 试图修复插件无法激活的问题, 更新所有依赖库
61+
62+
`FIX` 修复一个格式化行为.
63+
64+
`NEW` 选项`space_before_function_call_single_arg`支持其他值always/only_string/only_table/none
65+
66+
## 1.0.2
67+
68+
`FIX` 修复lineIndex错误导致的Unicode字符BUG
69+
370
## 1.0.0
471

5-
`EmmyLuaCodeStyle`经过一年的更新现在进入正式版
72+
`EmmyLuaCodeStyle` 经过一年的更新现在进入正式版
673

774
`Refactor` 大部分代码重写, 数据结构重新设计
875

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
* [格式化行为介绍](docs/format_action.md)
2828
* [如何配置格式化](docs/format_config.md)
29+
* [如何配置命名风格检查](docs/name_style.md)
2930

3031
# Contribute
3132

README_EN.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ In addition to providing language service examples, the project also provides an
2525

2626
* [Introduction to formatting behavior](docs/format_action_EN.md)
2727
* [How to configure formatting](docs/format_config_EN.md)
28+
* [How to configure naming style checking](docs/name_style_EN.md)
29+
2830
## Contribute
2931
Any pr or issue are welcome
3032

docs/name_style.md

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
## 概述
2+
3+
命名风格检查支持基于基本命名法的检查和正则表达式检查:
4+
* snake-case
5+
* camel-case
6+
* pascal-case
7+
* upper-snake-case
8+
* pattern
9+
10+
## 配置
11+
12+
开启命名风格检查需要在settings添加配置:
13+
```json
14+
"emmylua.lint.nameStyle": true
15+
```
16+
17+
在vscode的setting中增加配置项`emmylua.name.config`, 可如下填写:
18+
```json
19+
"emmylua.name.config": {
20+
"local_name_style": "snake_case"
21+
},
22+
```
23+
可配置的项有:
24+
* local_name_style
25+
* function_param_name_style
26+
* function_name_style
27+
* local_function_name_style
28+
* table_field_name_style
29+
* global_variable_name_style
30+
* module_name_style
31+
* require_module_name_style
32+
* class_name_style
33+
34+
每一个可配置项的格式都是相同的, 每个可配置项可配置的值支持如下格式:
35+
* 单字符串 例如:
36+
```json
37+
"local_name_style": "snake_case"
38+
```
39+
40+
单字符串支持的值有: `snake_case`, `pascal_case`, `upper_snake_case`, `camel_case`
41+
42+
* 字符串数组, 例如:
43+
```json
44+
"local_name_style": [
45+
"snake_case",
46+
"upper_snake_case"
47+
]
48+
```
49+
50+
* 忽略列表
51+
52+
忽略列表的一般形式是:
53+
```json
54+
"local_name_style": {
55+
"type": "ignore",
56+
"param": ["m", "M", "Do"]
57+
}
58+
```
59+
60+
* 正则表达式
61+
62+
正则语法为javascript正则语法.
63+
正则表达式的一般形式是:
64+
```json
65+
"local_name_style": {
66+
"type" : "pattern",
67+
"param": "uuu*"
68+
}
69+
```
70+
71+
正则表达式支持捕获组后再匹配基本命名法:
72+
```json
73+
"local_name_style": {
74+
"type" : "pattern",
75+
"param": "m_(w+)",
76+
"$1": "camel_case"
77+
}
78+
```
79+
80+
其中`"$1": "camel_case"`表示第一个捕获组的内容需要匹配 `camel_case` 命名法
81+
82+
* 支持表结构和字符串的混合数组 例如:
83+
84+
```json
85+
"local_name_style": [
86+
"snake_case",
87+
"pascal_case",
88+
"camel_case",
89+
{
90+
"type" : "pattern",
91+
"param": "m_(w+)",
92+
"$1": "camel_case"
93+
}
94+
]
95+
```
96+

docs/name_style_EN.md

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
## Overview
2+
3+
Naming style checking supports checking based on basic nomenclature and regular expression checking:
4+
* snake-case
5+
* camel-case
6+
* pascal-case
7+
* upper-snake-case
8+
* pattern
9+
10+
## configuration
11+
12+
To enable naming style checking, you need to add configuration in settings:
13+
```json
14+
"emmylua.lint.nameStyle": true
15+
```
16+
17+
Add the configuration item `emmylua.name.config` in the setting of vscode, which can be filled in as follows:
18+
```json
19+
"emmylua.name.config": {
20+
"local_name_style": "snake_case"
21+
},
22+
```
23+
The configurable items are:
24+
* local_name_style
25+
* function_param_name_style
26+
* function_name_style
27+
* local_function_name_style
28+
* table_field_name_style
29+
* global_variable_name_style
30+
* module_name_style
31+
* require_module_name_style
32+
* class_name_style
33+
34+
The format of each configurable item is the same, and the configurable value of each configurable item supports the following formats:
35+
* Single string Example:
36+
```json
37+
"local_name_style": "snake_case"
38+
```
39+
40+
Supported values for single string are: `snake_case`, `pascal_case`, `upper_snake_case`, `camel_case`
41+
42+
* String array, for example:
43+
```json
44+
"local_name_style": [
45+
"snake_case",
46+
"upper_snake_case"
47+
]
48+
```
49+
50+
* ignore list
51+
52+
The general form of an ignore list is:
53+
```json
54+
"local_name_style": {
55+
"type": "ignore",
56+
"param": ["m", "M", "Do"]
57+
}
58+
```
59+
60+
* regular expression
61+
62+
The regular syntax is javascript regular syntax.
63+
The general form of a regular expression is:
64+
```json
65+
"local_name_style": {
66+
"type" : "pattern",
67+
"param": "uuu*"
68+
}
69+
```
70+
71+
Regular expressions support capture groups and then match basic nomenclature:
72+
```json
73+
"local_name_style": {
74+
"type" : "pattern",
75+
"param": "m_(w+)",
76+
"$1": "camel_case"
77+
}
78+
```
79+
80+
Where `"$1": "camel_case"` means that the content of the first capture group needs to match the `camel_case` nomenclature
81+
82+
* Supports mixed arrays of table structures and strings For example:
83+
84+
```json
85+
"local_name_style": [
86+
"snake_case",
87+
"pascal_case",
88+
"camel_case",
89+
{
90+
"type" : "pattern",
91+
"param": "m_(w+)",
92+
"$1": "camel_case"
93+
}
94+
]
95+
```

0 commit comments

Comments
 (0)