Skip to content

Commit 81a2417

Browse files
committed
config document
1 parent 39354ed commit 81a2417

File tree

5 files changed

+256
-12
lines changed

5 files changed

+256
-12
lines changed

EmmyLuaAnalyzer.sln.DotSettings.user

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
22
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AAsyncMethodBuilderCore_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FAppData_003FLocal_003FSymbols_003Fsrc_003Fdotnet_003Fruntime_003Fa5cc707d976a14495462c9c492a921ff0927b8f5_003Fsrc_003Flibraries_003FSystem_002EPrivate_002ECoreLib_003Fsrc_003FSystem_003FRuntime_003FCompilerServices_003FAsyncMethodBuilderCore_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
33
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AAsyncTaskMethodBuilder_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FSourcesCache_003Fd3fc258f4b84fee36638494d82d089d492fbff3b922cc98397e061c246599c6f_003FAsyncTaskMethodBuilder_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
4+
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ACamelCaseNamingStrategy_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FSourcesCache_003F8bc33c76c1b4ce503e92c9426e77372e63dc92fc0785c7f4318021c8afc8_003FCamelCaseNamingStrategy_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
45
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ACodeLensResponse_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fffaa84ff0ee24797965086335219d4ea16d800_003Fe6_003F4445b551_003FCodeLensResponse_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
56
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ACodeLens_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fffaa84ff0ee24797965086335219d4ea16d800_003F0a_003F595aa972_003FCodeLens_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
67
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AEncodingTable_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FSourcesCache_003Ff08f49764a1335bcad2faaf9f1a9c897a3fa5d193ec94fa5c2e9f45a08ef2c8_003FEncodingTable_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>

README.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,15 @@ The EmmyLuaAnalyzer project is a static analyzer and language service for the Lu
1515

1616
## Documentation
1717

18-
- TODO
18+
[.emmyrc.json config](./docs/.emmyrc.json_EN.md)
1919

2020
## Usage
2121

2222
### Use EmmyLuaAnalyzer's analysis core through nuget
2323
TODO
2424

25-
### Use EmmyLuaAnalyzer's language service through the VSCode plugin
26-
You can currently use EmmyLuaAnalyzer's language service by checking `Use EmmyLuaAnalyzer` in VSCode-EmmyLua.
27-
28-
## Testing
29-
30-
Currently in beta, everyone is welcome to test and make suggestions. There is still a lot of work in progress and needs to be improved.
25+
### Use EmmyLuaAnalyzer's language server through the VSCode plugin
26+
You can currently use EmmyLuaAnalyzer's language server by install `VSCode-EmmyLua`.
3127

3228
## LICENSE
3329

README_CN.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,16 @@ EmmyLuaAnalyzer 项目是使用C#实现的 Lua 语言的静态分析器和语言
1515

1616
## 文档
1717

18-
- TODO
18+
[.emmyrc.json config](./docs/.emmyrc.json_CN.md)
1919

2020
## 使用
2121

2222
### 通过nuget使用EmmyLuaAnalyzer的分析核心
2323
TODO
2424

2525
### 通过VSCode插件使用EmmyLuaAnalyzer的语言服务
26-
当前可以通过在VSCode-EmmyLua中勾选`Use EmmyLuaAnalyzer`来使用EmmyLuaAnalyzer的语言服务
2726

28-
## 测试
29-
30-
当前处于测试版,欢迎大家测试并提出建议, 有很多工作还在进行中,还需要完善
27+
当前可以通过使用VSCode-EmmyLua或者intellij-EmmyLua2使用该语言服务
3128

3229
## LICENSE
3330

docs/.emmyrc.json_CN.md

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
# 配置说明
2+
3+
需要在工作区根目录下创建一个 `.emmyrc.json` 文件,用于配置 EmmyLuaAnalyzer 的一些参数。
4+
5+
它主要的配置格式是:
6+
```json
7+
{
8+
"completion": {
9+
"autoRequire": true,
10+
"autoRequireFunction": "require",
11+
"autoRequireNamingConvention": "camelCase",
12+
"callSnippet": false,
13+
"postfix": "@"
14+
},
15+
"signature": {
16+
"detailSignatureHelper": false
17+
},
18+
"diagnostics": {
19+
"disable": [
20+
],
21+
"globals": [],
22+
"globalsRegex": [],
23+
"severity": {
24+
},
25+
"enables": [
26+
]
27+
},
28+
"hint": {
29+
"paramHint": true,
30+
"indexHint": true,
31+
"localHint": true,
32+
"overrideHint": true
33+
},
34+
"runtime": {
35+
"version": "Lua5.4",
36+
"requireLikeFunction": [],
37+
"frameworkVersions": [],
38+
"extensions": [],
39+
"requirePattern": []
40+
},
41+
"workspace": {
42+
"ignoreDir": [
43+
44+
],
45+
"ignoreGlobs": [
46+
],
47+
"library": [],
48+
"workspaceRoots": [],
49+
"preloadFileSize": 1048576,
50+
"encoding": ""
51+
},
52+
"resource": {
53+
"paths": [
54+
]
55+
},
56+
"codeLens": {
57+
"enable": true
58+
},
59+
"strict": {
60+
"requirePath": false,
61+
"typeCall": true
62+
}
63+
}
64+
65+
```
66+
67+
68+
## completion
69+
70+
- `autoRequire`: 是否自动补全 require 语句,默认为 `true`
71+
- `autoRequireFunction`: 自动补全 require 语句时使用的函数名,默认为 `require`
72+
- `autoRequireNamingConvention`: 自动补全 require 语句时使用的命名规范,默认为 `camelCase`, 可选值为 `camelCase`, `snakeCase`, `pascalCase`
73+
- `callSnippet`: 是否使用代码片段补全函数调用,默认为 `false`
74+
- `postfix`: 补全时的后缀,默认为 `@`。但是设置该选项暂时无用
75+
76+
## signature
77+
78+
- `detailSignatureHelper`: 是否显示详细的函数签名帮助,默认为 `false`
79+
80+
## diagnostics
81+
82+
- `disable`: 禁用的诊断信息列表, 如果需要工作区内禁用一些诊断消息, 需要填上对应诊断的id, 例如: `"undefined-global"`
83+
- `globals`: 全局变量列表, 在该列表中的全局变量不会被诊断为未定义.
84+
- `globalsRegex`: 全局变量正则表达式列表, 符合正则表达式的全局变量不会被诊断为未定义.
85+
- `severity`: 诊断消息的严重程度, 例如: `"undefined-global": "warning"`, 可选值为 `"error"`, `"warning"`, `"information"`, `"hint"`.
86+
- `enables`: 启用的诊断信息列表, 语言服务的诊断不是全部都启用的, 可以通过该选项启用一些诊断消息. 例如: `"undefined-field"`
87+
88+
## hint
89+
90+
- `paramHint`: 是否显示参数提示,默认为 `true`
91+
- `indexHint`: 在索引表达式跨行时, 是否显示hint,默认为 `true`
92+
- `localHint`: 是否显示局部变量提示,默认为 `true`
93+
- `overrideHint`: 是否显示重载提示,默认为 `true`
94+
95+
## runtime
96+
97+
- `version`: 运行时版本, 默认为 `Lua5.4`, 可选值为 `Lua5.1`, `Lua5.2`, `Lua5.3`, `Lua5.4`, `LuaJIT`.
98+
- `requireLikeFunction`: 类似 require 的函数列表, 用于识别类似 require 的函数, 例如: `["import"]`.
99+
- `frameworkVersions`: 框架版本列表, 用于识别框架版本, 例如: `["love2d"]`. 可以和emmylua doc 的version标签配合使用.
100+
- `extensions`: 文件扩展名列表, 用于识别文件扩展名, 例如: `[".lua", ".lua.txt"]`.
101+
- `requirePattern`: require 模式列表, 该参数和lua中的package.path和package.cpath有关, 例如: `["?.lua", "?.lua.txt"]`. 默认不需要填写, 将自动拥有,
102+
`["?.lua", "?/init.lua"]`.
103+
104+
## workspace
105+
106+
工作区配置, 大部分工作区配置本身既支持相对路径也支持绝对路径
107+
108+
- `ignoreDir`: 忽略的目录列表, 用于忽略一些目录, 例如: `["build", "dist"]`.
109+
- `ignoreGlobs`: 忽略的文件列表, 基于正则表达式的忽略一些文件, 例如: `["*.log", "*.tmp"]`.
110+
- `library`: 库文件目录列表, 用于指定一些库文件, 例如: `["/usr/local/lib"]`.
111+
- `workspaceRoots`: 工作区根目录列表, 用于指定工作区的根目录, 例如: `["Assets/script/Lua"]`. 该功能主要是为了让require正常工作, 如果必须要打开lua主目录的上级目录, 需要在这里添加当前打开的目录相对于lua主目录的相对路径.
112+
- `preloadFileSize`: 预加载文件大小, 默认为 `1048576` 字节, 用于控制预加载文件的大小.
113+
- `encoding`: 文件编码, 默认为 `utf-8`, 用于读取文件时的编码.
114+
115+
## resource
116+
117+
- `paths`: 资源路径列表, 用于指定需要加载的资源的根目录, 例如: `["Assets/settings"]`. 其默认值为当前打开的工作区目录, emmylua支持在任意字符串中的文件路径补全, 以及任意字符串中的文件路径跳转. 通过配置这个目录, 可以让emmylua知道哪些目录是资源目录, 从而正确的提供补全和跳转.
118+
119+
## codeLens
120+
121+
- `enable`: 是否启用CodeLens功能, 默认为 `true`.
122+
123+
## strict
124+
125+
- `requirePath`: 是否启用require严格模式, 默认为 `true`. 严格模式时, require必须从指定的根目录开始, 否则无法跳转
126+
- `typeCall`: 是否启用类型调用时严格模式, 默认为 `true`. 严格模式时, 类型调用必须手动写好重载, 否则返回unknown, 非严格模式时, 类型调用会返回自身

docs/.emmyrc.json_EN.md

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
# 配置说明
2+
To create a `.emmyrc.json` file in the root directory of your workspace, which is used to configure some parameters of EmmyLuaAnalyzer.
3+
4+
The main configuration format is:
5+
```json
6+
{
7+
"completion": {
8+
"autoRequire": true,
9+
"autoRequireFunction": "require",
10+
"autoRequireNamingConvention": "camelCase",
11+
"callSnippet": false,
12+
"postfix": "@"
13+
},
14+
"signature": {
15+
"detailSignatureHelper": false
16+
},
17+
"diagnostics": {
18+
"disable": [
19+
],
20+
"globals": [],
21+
"globalsRegex": [],
22+
"severity": {
23+
},
24+
"enables": [
25+
]
26+
},
27+
"hint": {
28+
"paramHint": true,
29+
"indexHint": true,
30+
"localHint": true,
31+
"overrideHint": true
32+
},
33+
"runtime": {
34+
"version": "Lua5.4",
35+
"requireLikeFunction": [],
36+
"frameworkVersions": [],
37+
"extensions": [],
38+
"requirePattern": []
39+
},
40+
"workspace": {
41+
"ignoreDir": [
42+
43+
],
44+
"ignoreGlobs": [
45+
],
46+
"library": [],
47+
"workspaceRoots": [],
48+
"preloadFileSize": 1048576,
49+
"encoding": ""
50+
},
51+
"resource": {
52+
"paths": [
53+
]
54+
},
55+
"codeLens": {
56+
"enable": true
57+
},
58+
"strict": {
59+
"requirePath": false,
60+
"typeCall": true
61+
}
62+
}
63+
64+
```
65+
66+
67+
## completion
68+
69+
- `autoRequire`: Whether to automatically complete the require statement, default is `true`.
70+
- `autoRequireFunction`: The function name used for automatically completing the require statement, default is `require`.
71+
- `autoRequireNamingConvention`: The naming convention used for automatically completing the require statement, default is `camelCase`, optional values are `camelCase`, `snakeCase`, `pascalCase`.
72+
- `callSnippet`: Whether to use code snippets for function call completion, default is `false`.
73+
- `postfix`: The postfix used for completion, default is `@`. However, setting this option is currently ineffective.
74+
75+
## signature
76+
77+
- `detailSignatureHelper`: Whether to display detailed function signature help, default is `false`.
78+
79+
## diagnostics
80+
81+
- `disable`: List of disabled diagnostic messages. If you need to disable some diagnostic messages in the workspace, you need to fill in the corresponding diagnostic IDs, for example: `"undefined-global"`.
82+
- `globals`: List of global variables. Global variables in this list will not be diagnosed as undefined.
83+
- `globalsRegex`: List of regular expressions for global variables. Global variables that match the regular expressions will not be diagnosed as undefined.
84+
- `severity`: Severity of diagnostic messages, for example: `"undefined-global": "warning"`, optional values are `"error"`, `"warning"`, `"information"`, `"hint"`.
85+
- `enables`: List of enabled diagnostic messages. Not all diagnostic messages of the language service are enabled by default. You can use this option to enable some diagnostic messages, for example: `"undefined-field"`.
86+
87+
## hint
88+
89+
- `paramHint`: Whether to display parameter hints, default is `true`.
90+
- `indexHint`: Whether to display hints when indexing expressions span multiple lines, default is `true`.
91+
- `localHint`: Whether to display hints for local variables, default is `true`.
92+
- `overrideHint`: Whether to display hints for overrides, default is `true`.
93+
94+
## runtime
95+
96+
- `version`: Runtime version, default is `Lua5.4`, optional values are `Lua5.1`, `Lua5.2`, `Lua5.3`, `Lua5.4`, `LuaJIT`.
97+
- `requireLikeFunction`: List of functions similar to require, used to identify functions similar to require, for example: `["import"]`.
98+
- `frameworkVersions`: List of framework versions, used to identify framework versions, for example: `["love2d"]`. Can be used in conjunction with the version tag in emmylua doc.
99+
- `extensions`: List of file extensions, used to identify file extensions, for example: `[".lua", ".lua.txt"]`.
100+
- `requirePattern`: List of require patterns, this parameter is related to package.path and package.cpath in Lua, for example: `["?.lua", "?.lua.txt"]`. It is not necessary to fill in by default, it will be automatically included, `["?.lua", "?/init.lua"]`.
101+
102+
## workspace
103+
104+
Workspace configuration, most workspace configurations support both relative paths and absolute paths.
105+
106+
- `ignoreDir`: List of ignored directories, used to ignore some directories, for example: `["build", "dist"]`.
107+
- `ignoreGlobs`: List of ignored files, used to ignore some files based on regular expressions, for example: `["*.log", "*.tmp"]`.
108+
- `library`: List of library directories, used to specify some library files, for example: `["/usr/local/lib"]`.
109+
- `workspaceRoots`: List of workspace root directories, used to specify the root directories of the workspace, for example: `["Assets/script/Lua"]`. This feature is mainly used to make require work properly. If you need to open the parent directory of the lua main directory, you need to add the relative path of the currently opened directory to the lua main directory here.
110+
- `preloadFileSize`: Preloaded file size, default is `1048576` bytes, used to control the size of preloaded files.
111+
- `encoding`: File encoding, default is `utf-8`, used for reading files.
112+
113+
## resource
114+
115+
- `paths`: List of resource paths, used to specify the root directories of the resources that need to be loaded, for example: `["Assets/settings"]`. Its default value is the currently opened workspace directory. EmmyLua supports file path completion in any string and file path jumping in any string. By configuring this directory, EmmyLua can know which directories are resource directories and provide completion and jumping correctly.
116+
117+
## codeLens
118+
119+
- `enable`: Whether to enable the CodeLens feature, default is `true`.
120+
121+
## strict
122+
123+
- `requirePath`: Whether to enable strict mode for require, default is `true`. In strict mode, require must start from the specified root directory, otherwise it cannot jump.
124+
- `typeCall`: Whether to enable strict mode for type calls, default is `true`. In strict mode, type calls must have manually written overloads, otherwise it will return unknown. In non-strict mode, type calls will return themselves.

0 commit comments

Comments
 (0)