Skip to content

Commit e24ed7e

Browse files
committed
release
1 parent ff1591a commit e24ed7e

File tree

6 files changed

+209
-7
lines changed

6 files changed

+209
-7
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# EmmyLuaAnalyzer-Rust
22

3-
This project is in its early stages but already offers basic functionality. Future development will focus on expanding features, improving stability, and refining its overall usability. Your feedback and contributions are welcome to help shape its direction.
3+
We welcome your feedback and contributions. Please feel free to submit pull requests (PRs) and report issues to help shape the project's direction.
44

55
## crates
66

@@ -17,8 +17,9 @@ This project is in its early stages but already offers basic functionality. Futu
1717

1818
## Documentation
1919

20-
- [emmyrc config](./docs/config/emmyrc_json_EN.md)
21-
- [formatting config](https://github.com/CppCXY/EmmyLuaCodeStyle/blob/master/README_EN.md)
20+
- [Features](./docs/features/features_EN.md)
21+
- [Emmyrc Config](./docs/config/emmyrc_json_EN.md)
22+
- [Formatting Config](https://github.com/CppCXY/EmmyLuaCodeStyle/blob/master/README_EN.md)
2223

2324
## Build
2425

crates/emmylua_ls/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "emmylua_ls"
3-
version = "0.2.0"
3+
version = "0.2.4"
44
edition = "2021"
55

66
[dependencies]

docs/features/features_CN.md

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
# emmylua语言服务器的特性介绍
2+
3+
## 自动补全
4+
5+
支持正常的代码补全,包括函数、变量、表字段、模块等。除此以外,EmmyLua在补全上花了很多心思,提供了更多的补全功能。
6+
- `auto require` 支持在自动补全列表列出当前有返回值的lua模块, 并在键入Tab时在文件顶部所有require语句之后添加该模块的require语句。
7+
- `alias enum` 会根据当前函数参数的类型是否为alias或者enum类型,来自动补全对应的alias或者enum字段。
8+
- `function` 会根据当前函数参数的类型是否为函数类型,来自动补全对应的lambda表达式
9+
- `namespace` 如果当前变量的类型是namespace类型,EmmyLua会自动补全namespace下的子空间或者类名, 要申明namespace类型,可以使用`---@type namespace<"类名">`
10+
- `module path` 如果当前所在的字符串是require的参数, Emmylua会补全对应的模块路径, 并且同时支持使用`.``/`来分割路径
11+
- `file system path` 在任意字符串中, 如果存在 `/` 或者 `\\` , EmmyLua会试图基于相关配置提供文件系统路径补全
12+
- `postfix` 在任意变量后面输入`@`符号, 会自动补全对应的postfix表达式, 该符号还可改为 `.`
13+
- `snippet` 提供基础的代码片段补全功能, 以后会考虑基于文件模板系统支持自定义模板
14+
15+
## 代码提示
16+
17+
支持正常的通过鼠标悬浮显示变量、函数、表字段、模块等的提示信息。除此以外,EmmyLua在提示上也提供了更多的功能。
18+
- `const` 如果当前变量是常量类型, 那么在鼠标悬浮时会显示该变量的值, 如果是常量表达式, 则会计算出表达式的值
19+
20+
## 代码检查
21+
22+
EmmyLua提供了基于EmmyLua doc的丰富的代码检查功能, 支持通过配置文件来禁止某些检查, 或者启用一些额外的检查。或者通过注释来控制检查的行为. 例如:
23+
24+
```lua
25+
---@diagnostic disable: undefined-global
26+
```
27+
通过这一句可以在当前文件禁用undefined-global的检查
28+
29+
```lua
30+
---@diagnostic disable-next-line: undefined-global
31+
```
32+
通过这一句可以在下一行禁用undefined-global的检查
33+
34+
配置相关的检查功能可以在配置文件中进行配置, 例如:
35+
36+
```json
37+
{
38+
"diagnostics": {
39+
"disable": ["undefined-global"]
40+
}
41+
}
42+
```
43+
44+
## 文档符号
45+
46+
EmmyLua支持在文件中显示结构化的文档符号, 在vscode中可通过左侧的OUTLINE看到, 也可以通过快捷键`Ctrl+Shift+O`打开.
47+
48+
## 工作区符号搜索
49+
50+
EmmyLua支持在工作区中搜索符号, 在vscode中可通过快捷键`Ctrl+T`打开搜索框, 输入`@`符号, 然后输入要搜索的符号名称, 即可搜索到对应的符号.
51+
52+
## 重构
53+
54+
EmmyLua支持在变量和字段的rename重构, 在vscode中可通过快捷键`F2`来进行重构.
55+
56+
## 代码格式化
57+
58+
EmmyLua支持在vscode中使用`Format Document``Format Selection`来格式化代码, 格式化的功能使用的是[EmmyLuaCodeStyle](https://github.com/CppCXY/EmmyLuaCodeStyle), 相关配置请参考对应的文档.
59+
60+
## 代码折叠
61+
62+
EmmyLua支持所有正常的代码折叠功能, 包括函数、if、for、while等. 另外EmmyLua还支持折叠注释块, 通过`--region``--endregion`来标记折叠区域.
63+
64+
## 代码跳转
65+
66+
EmmyLua支持在vscode中使用`Go to Definition``Peek Definition`来跳转到定义, 另外可以通过鼠标左键加`ctrl`键来点击跳转到定义.
67+
68+
## 代码引用
69+
70+
EmmyLua支持在vscode中使用`Find All References`来查找引用, 另外可以通过鼠标左键加`ctrl`键来点击查找引用. 特别地, EmmyLua支持一些特殊的引用查找:
71+
- 字符串引用查找功能: 如果选中一个字符串, 可以通过右键菜单中的`Find All References`来查找该字符串的引用, 或者通过`ctrl` + 鼠标左键来查找引用
72+
- 模糊引用查找功能: 如果选中一个变量, 该变量无法找到定义, 则会尝试进行模糊引用查找, 通过配置文件可以控制是否启用模糊引用查找
73+
74+
## Document Color
75+
76+
EmmyLua会试图分析字符串中连续的16进制数字, 如果连续的数字是6位或者8位, 则会尝试将其解析为颜色值, 并在代码中显示颜色块.
77+
78+
## Document Link
79+
80+
EmmyLua会试图分析字符串中可能存在的的文件路径, 并在代码中显示链接, 可以通过鼠标点击来打开链接.
81+
82+
## 语义高亮
83+
84+
EmmyLua支持LSP中规定的`semanticHighlighting`功能, 会分析token的成分并且给与适当的高亮
85+
86+
## EmmyLua Annotator
87+
88+
EmmyLua通过私有协议强化代码渲染, 例如对可变local变量加上下划线
89+
90+
## inlay hints
91+
92+
EmmyLua支持在代码中显示一些提示信息, 例如参数的类型, 变量的类型. 函数是否是对父类的重写, 函数是否是await调用等等. 可以通过配置文件来控制是否启用这些提示信息.
93+
94+
## document highlight
95+
96+
尽管vscode本身的document highlight功能已经基本满足要求了, 但是EmmyLua还是提供了自己的document highlight功能, 用于高亮变量的引用和同组的关键词, 也考虑到其他编辑器可能需要语言服务器提供这个功能.
97+

docs/features/features_EN.md

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
# Introduction to the features of the EmmyLua Language Server
2+
3+
[中文介绍](./features_CN.md)
4+
5+
## Auto Completion
6+
7+
Supports standard code completion, including functions, variables, table fields, and modules. In addition, EmmyLua includes more advanced completion features:
8+
- `auto require` Shows Lua modules that have return values in the completion list. When pressing Tab, it automatically adds the require statement for that module at the top of the file after existing require statements.
9+
- `alias enum` Automatically completes corresponding alias or enum fields based on the parameter type in the current function.
10+
- `function` Suggests lambda expressions if the current function parameter is a function type.
11+
- `namespace` If the current variable is a namespace type, EmmyLua automatically completes sub-namespaces or class names. Declare a namespace type using `---@type namespace<"ClassName">`.
12+
- `module path` When typing within the argument of require, EmmyLua completes module paths, supporting both '.' and '/' as separators.
13+
- `file system path` In any string containing '/' or '\\', EmmyLua tries to complete file system paths based on relevant settings.
14+
- `postfix` When typing the '@' symbol after any variable, the corresponding postfix expressions are suggested. This symbol can also be replaced with '.'.
15+
- `snippet` Provides basic code snippet completions. Future releases may support custom templates via a file template system.
16+
17+
## Code Hints
18+
19+
Displays traditional hover hints for variables, functions, table fields, and modules. EmmyLua also offers additional features for code hints:
20+
- `const` If the current variable is a constant type, hovering over it displays the variable’s value. For constant expressions, EmmyLua calculates and shows the expression result.
21+
22+
## Code Checks
23+
24+
EmmyLua leverages EmmyLua doc for comprehensive code checks. These checks can be disabled or enabled via configuration files, or controlled using annotations such as:
25+
```lua
26+
---@diagnostic disable: undefined-global
27+
```
28+
This disables undefined-global checks in the current file.
29+
30+
```lua
31+
---@diagnostic disable-next-line: undefined-global
32+
```
33+
This disables undefined-global checks for the following line.
34+
35+
You can configure these checks in a config file, for example:
36+
```json
37+
{
38+
"diagnostics": {
39+
"disable": ["undefined-global"]
40+
}
41+
}
42+
```
43+
44+
## Document Symbols
45+
46+
EmmyLua supports structured document symbols. In VSCode, these can be viewed in the OUTLINE panel on the left or by pressing Ctrl+Shift+O.
47+
48+
## Workspace Symbol Search
49+
50+
EmmyLua supports workspace-wide symbol searches. In VSCode, press Ctrl+T, type '@', then the symbol name to search for the corresponding symbol.
51+
52+
## Refactoring
53+
54+
EmmyLua supports variable and field rename refactoring. In VSCode, use the F2 shortcut for this operation.
55+
56+
## Code Formatting
57+
58+
EmmyLua supports the "Format Document" and "Format Selection" features in VSCode, using [EmmyLuaCodeStyle](https://github.com/CppCXY/EmmyLuaCodeStyle). Refer to its documentation for related configurations.
59+
60+
## Code Folding
61+
62+
EmmyLua supports standard code folding for functions, if-statements, for-loops, while-loops, etc. Additionally, it supports folding for comment blocks marked by `--region` and `--endregion`.
63+
64+
## Go to Definition
65+
66+
In VSCode, EmmyLua supports "Go to Definition" and "Peek Definition." You can also Ctrl+click with the mouse to jump to definition.
67+
68+
## Find References
69+
70+
EmmyLua supports "Find All References" in VSCode. You can also Ctrl+click with the mouse to find references. Special cases include:
71+
- String reference search: If you select a string, you can use "Find All References" or Ctrl+click to find all references of that string.
72+
- Fuzzy references: If a selected variable has no definition, EmmyLua attempts a fuzzy reference search. This can be enabled or disabled via the configuration file.
73+
74+
## Document Color
75+
76+
EmmyLua attempts to detect sequences of six or eight hexadecimal digits in a string and interpret them as color values, displaying a color preview.
77+
78+
## Document Link
79+
80+
EmmyLua tries to detect possible file paths in strings and displays clickable links to open those paths.
81+
82+
## Semantic Highlighting
83+
84+
EmmyLua supports `semanticHighlighting` as defined by the LSP, assigning appropriate highlighting based on token analysis.
85+
86+
## EmmyLua Annotator
87+
88+
EmmyLua extends code rendering through a private protocol, for example, underlining mutable local variables.
89+
90+
## Inlay Hints
91+
92+
EmmyLua can display additional hints, such as parameter types, variable types, and whether a function overrides a parent class method or is an await call. These hints can be enabled or disabled via configuration.
93+
94+
## Document Highlight
95+
96+
Although VSCode’s built-in document highlight is sufficient, EmmyLua also provides its own highlight feature for variable references and related keywords. This is especially useful for editors that require language server-based highlighting.
97+

resources/schema.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,10 +186,10 @@
186186
]
187187
},
188188
{
189-
"description": "Type not match",
189+
"description": "Param Type not match",
190190
"type": "string",
191191
"enum": [
192-
"type-not-match"
192+
"param-type-not-match"
193193
]
194194
},
195195
{
@@ -269,6 +269,13 @@
269269
"local-const-reassign"
270270
]
271271
},
272+
{
273+
"description": "Iter variable reassign",
274+
"type": "string",
275+
"enum": [
276+
"iter-variable-reassign"
277+
]
278+
},
272279
{
273280
"description": "Duplicate type",
274281
"type": "string",

0 commit comments

Comments
 (0)