diff options
Diffstat (limited to 'doc/zh-cn/config.md')
-rw-r--r-- | doc/zh-cn/config.md | 373 |
1 files changed, 371 insertions, 2 deletions
diff --git a/doc/zh-cn/config.md b/doc/zh-cn/config.md index 00739179..3cde1608 100644 --- a/doc/zh-cn/config.md +++ b/doc/zh-cn/config.md @@ -224,10 +224,36 @@ Array<string> * ``"exp-in-action"`` * ``"global-in-nil-env"`` * ``"index-in-func-name"`` +* ``"invisible"`` * ``"jump-local-scope"`` * ``"keyword"`` * ``"local-limit"`` * ``"lowercase-global"`` +* ``"lua-doc-miss-sign"`` +* ``"luadoc-error-diag-mode"`` +* ``"luadoc-miss-alias-extends"`` +* ``"luadoc-miss-alias-name"`` +* ``"luadoc-miss-arg-name"`` +* ``"luadoc-miss-cate-name"`` +* ``"luadoc-miss-class-extends-name"`` +* ``"luadoc-miss-class-name"`` +* ``"luadoc-miss-diag-mode"`` +* ``"luadoc-miss-diag-name"`` +* ``"luadoc-miss-field-extends"`` +* ``"luadoc-miss-field-name"`` +* ``"luadoc-miss-fun-after-overload"`` +* ``"luadoc-miss-generic-name"`` +* ``"luadoc-miss-local-name"`` +* ``"luadoc-miss-module-name"`` +* ``"luadoc-miss-operator-name"`` +* ``"luadoc-miss-param-extends"`` +* ``"luadoc-miss-param-name"`` +* ``"luadoc-miss-see-name"`` +* ``"luadoc-miss-sign-name"`` +* ``"luadoc-miss-symbol"`` +* ``"luadoc-miss-type-name"`` +* ``"luadoc-miss-vararg-type"`` +* ``"luadoc-miss-version"`` * ``"malformed-number"`` * ``"miss-end"`` * ``"miss-esc-x"`` @@ -245,6 +271,7 @@ Array<string> * ``"missing-return"`` * ``"missing-return-value"`` * ``"need-check-nil"`` +* ``"need-paren"`` * ``"newfield-call"`` * ``"newline-call"`` * ``"no-unknown"`` @@ -420,6 +447,7 @@ object<string, string> * close-non-object * deprecated * discard-returns + * invisible */ "strict": "Fallback", /* @@ -538,6 +566,7 @@ object<string, string> * close-non-object * deprecated * discard-returns + * invisible */ "strict": "Fallback", /* @@ -655,27 +684,75 @@ object<string, string> 优先级歧义,如:`num or 0 + 1`,推测用户的实际期望为 `(num or 0) + 1` */ "ambiguity-1": "Any", + /* + Enable diagnostics for assignments in which the value's type does not match the type of the assigned variable. + */ "assign-type-mismatch": "Opened", + /* + Enable diagnostics for calls of asynchronous functions within a synchronous function. + */ "await-in-sync": "None", + /* + Enable diagnostics for casts of local variables where the target type does not match the defined type. + */ "cast-local-type": "Opened", + /* + Enable diagnostics for casts where the target type does not match the initial type. + */ "cast-type-mismatch": "Opened", "circle-doc-class": "Any", + /* + Enable diagnostics for attempts to close a variable with a non-object. + */ "close-non-object": "Any", + /* + Enable diagnostics for code placed after a break statement in a loop. + */ "code-after-break": "Opened", + /* + Enable diagnostics for incorrectly styled lines. + */ "codestyle-check": "None", + /* + Enable diagnostics for `for` loops which will never reach their max/limit because the loop is incrementing instead of decrementing. + */ "count-down-loop": "Any", + /* + Enable diagnostics to highlight deprecated API. + */ "deprecated": "Any", + /* + Enable diagnostics for files which are required by two different paths. + */ "different-requires": "Any", + /* + Enable diagnostics for calls of functions annotated with `---@nodiscard` where the return values are ignored. + */ "discard-returns": "Any", + /* + Enable diagnostics to highlight a field annotation without a defining class annotation. + */ "doc-field-no-class": "Any", + /* + Enable diagnostics for a duplicated alias annotation name. + */ "duplicate-doc-alias": "Any", + /* + Enable diagnostics for a duplicated field annotation name. + */ "duplicate-doc-field": "Any", + /* + Enable diagnostics for a duplicated param annotation name. + */ "duplicate-doc-param": "Any", /* 在字面量表中重复定义了索引 */ "duplicate-index": "Any", - "duplicate-set-field": "Any", + /* + Enable diagnostics for setting the same field in a class more than once. + */ + "duplicate-set-field": "Opened", /* 空代码块 */ @@ -685,12 +762,28 @@ object<string, string> */ "global-in-nil-env": "Any", /* + Enable diagnostics for accesses to fields which are invisible. + */ + "invisible": "Any", + /* 首字母小写的全局变量定义 */ "lowercase-global": "Any", + /* + Enable diagnostics for function calls where the number of arguments is less than the number of annotated function parameters. + */ "missing-parameter": "Any", + /* + Enable diagnostics for functions with return annotations which have no return statement. + */ "missing-return": "Any", + /* + Enable diagnostics for return statements without values although the containing function declares returns. + */ "missing-return-value": "Any", + /* + Enable diagnostics for variable usages if `nil` or an optional (potentially `nil`) value was assigned to the variable before. + */ "need-check-nil": "Opened", /* 在字面量表中,2行代码之间缺少分隔符,在语法上被解析为了一次索引操作 @@ -700,8 +793,17 @@ object<string, string> 以 `(` 开始的新行,在语法上被解析为了上一行的函数调用 */ "newline-call": "Any", + /* + Enable diagnostics for cases in which the type cannot be inferred. + */ "no-unknown": "None", + /* + Enable diagnostics for calls to `coroutine.yield()` when it is not permitted. + */ "not-yieldable": "None", + /* + Enable diagnostics for function calls where the type of a provided parameter does not match the type of the annotated function definition. + */ "param-type-mismatch": "Opened", /* 重复定义的局部变量 @@ -711,34 +813,73 @@ object<string, string> 函数调用时,传入了多余的参数 */ "redundant-parameter": "Any", + /* + Enable diagnostics for return statements which are not needed because the function would exit on its own. + */ "redundant-return": "Opened", + /* + Enable diagnostics for return statements which return an extra value which is not specified by a return annotation. + */ "redundant-return-value": "Any", /* 赋值操作时,值的数量比被赋值的对象多 */ "redundant-value": "Any", + /* + Enable diagnostics for return values whose type does not match the type declared in the corresponding return annotation. + */ "return-type-mismatch": "Opened", + /* + Enable diagnostics for typos in strings. + */ "spell-check": "None", /* 后置空格 */ "trailing-space": "Opened", + /* + Enable diagnostics on multiple assignments if not all variables obtain a value (e.g., `local x,y = 1`). + */ "unbalanced-assignments": "Any", + /* + Enable diagnostics for class annotations in which an undefined class is referenced. + */ "undefined-doc-class": "Any", + /* + Enable diagnostics for type annotations referencing an undefined type or alias. + */ "undefined-doc-name": "Any", + /* + Enable diagnostics for cases in which a parameter annotation is given without declaring the parameter in the function definition. + */ "undefined-doc-param": "Any", /* `_ENV` 被设置为了新的字面量表,但是试图获取的全局变量不再这张表中 */ "undefined-env-child": "Any", + /* + Enable diagnostics for cases in which an undefined field of a variable is read. + */ "undefined-field": "Opened", /* 未定义的全局变量 */ "undefined-global": "Any", + /* + Enable diagnostics for casts of undefined variables. + */ "unknown-cast-variable": "Any", + /* + Enable diagnostics in cases in which an unknown diagnostics code is entered. + */ "unknown-diag-code": "Any", + /* + Enable diagnostics for unknown operators. + */ "unknown-operator": "Any", + /* + Enable diagnostics for unreachable code. + */ "unreachable-code": "Opened", /* 未使用的函数 @@ -790,26 +931,74 @@ object<string, string> 优先级歧义,如:`num or 0 + 1`,推测用户的实际期望为 `(num or 0) + 1` */ "ambiguity-1": "Warning", + /* + Enable diagnostics for assignments in which the value's type does not match the type of the assigned variable. + */ "assign-type-mismatch": "Warning", + /* + Enable diagnostics for calls of asynchronous functions within a synchronous function. + */ "await-in-sync": "Warning", + /* + Enable diagnostics for casts of local variables where the target type does not match the defined type. + */ "cast-local-type": "Warning", + /* + Enable diagnostics for casts where the target type does not match the initial type. + */ "cast-type-mismatch": "Warning", "circle-doc-class": "Warning", + /* + Enable diagnostics for attempts to close a variable with a non-object. + */ "close-non-object": "Warning", + /* + Enable diagnostics for code placed after a break statement in a loop. + */ "code-after-break": "Hint", + /* + Enable diagnostics for incorrectly styled lines. + */ "codestyle-check": "Warning", + /* + Enable diagnostics for `for` loops which will never reach their max/limit because the loop is incrementing instead of decrementing. + */ "count-down-loop": "Warning", + /* + Enable diagnostics to highlight deprecated API. + */ "deprecated": "Warning", + /* + Enable diagnostics for files which are required by two different paths. + */ "different-requires": "Warning", + /* + Enable diagnostics for calls of functions annotated with `---@nodiscard` where the return values are ignored. + */ "discard-returns": "Warning", + /* + Enable diagnostics to highlight a field annotation without a defining class annotation. + */ "doc-field-no-class": "Warning", + /* + Enable diagnostics for a duplicated alias annotation name. + */ "duplicate-doc-alias": "Warning", + /* + Enable diagnostics for a duplicated field annotation name. + */ "duplicate-doc-field": "Warning", + /* + Enable diagnostics for a duplicated param annotation name. + */ "duplicate-doc-param": "Warning", /* 在字面量表中重复定义了索引 */ "duplicate-index": "Warning", + /* + Enable diagnostics for setting the same field in a class more than once. + */ "duplicate-set-field": "Warning", /* 空代码块 @@ -820,12 +1009,28 @@ object<string, string> */ "global-in-nil-env": "Warning", /* + Enable diagnostics for accesses to fields which are invisible. + */ + "invisible": "Warning", + /* 首字母小写的全局变量定义 */ "lowercase-global": "Information", + /* + Enable diagnostics for function calls where the number of arguments is less than the number of annotated function parameters. + */ "missing-parameter": "Warning", + /* + Enable diagnostics for functions with return annotations which have no return statement. + */ "missing-return": "Warning", + /* + Enable diagnostics for return statements without values although the containing function declares returns. + */ "missing-return-value": "Warning", + /* + Enable diagnostics for variable usages if `nil` or an optional (potentially `nil`) value was assigned to the variable before. + */ "need-check-nil": "Warning", /* 在字面量表中,2行代码之间缺少分隔符,在语法上被解析为了一次索引操作 @@ -835,8 +1040,17 @@ object<string, string> 以 `(` 开始的新行,在语法上被解析为了上一行的函数调用 */ "newline-call": "Warning", + /* + Enable diagnostics for cases in which the type cannot be inferred. + */ "no-unknown": "Warning", + /* + Enable diagnostics for calls to `coroutine.yield()` when it is not permitted. + */ "not-yieldable": "Warning", + /* + Enable diagnostics for function calls where the type of a provided parameter does not match the type of the annotated function definition. + */ "param-type-mismatch": "Warning", /* 重复定义的局部变量 @@ -846,34 +1060,73 @@ object<string, string> 函数调用时,传入了多余的参数 */ "redundant-parameter": "Warning", + /* + Enable diagnostics for return statements which are not needed because the function would exit on its own. + */ "redundant-return": "Hint", + /* + Enable diagnostics for return statements which return an extra value which is not specified by a return annotation. + */ "redundant-return-value": "Warning", /* 赋值操作时,值的数量比被赋值的对象多 */ "redundant-value": "Warning", + /* + Enable diagnostics for return values whose type does not match the type declared in the corresponding return annotation. + */ "return-type-mismatch": "Warning", + /* + Enable diagnostics for typos in strings. + */ "spell-check": "Information", /* 后置空格 */ "trailing-space": "Hint", + /* + Enable diagnostics on multiple assignments if not all variables obtain a value (e.g., `local x,y = 1`). + */ "unbalanced-assignments": "Warning", + /* + Enable diagnostics for class annotations in which an undefined class is referenced. + */ "undefined-doc-class": "Warning", + /* + Enable diagnostics for type annotations referencing an undefined type or alias. + */ "undefined-doc-name": "Warning", + /* + Enable diagnostics for cases in which a parameter annotation is given without declaring the parameter in the function definition. + */ "undefined-doc-param": "Warning", /* `_ENV` 被设置为了新的字面量表,但是试图获取的全局变量不再这张表中 */ "undefined-env-child": "Information", + /* + Enable diagnostics for cases in which an undefined field of a variable is read. + */ "undefined-field": "Warning", /* 未定义的全局变量 */ "undefined-global": "Warning", + /* + Enable diagnostics for casts of undefined variables. + */ "unknown-cast-variable": "Warning", + /* + Enable diagnostics in cases in which an unknown diagnostics code is entered. + */ "unknown-diag-code": "Warning", + /* + Enable diagnostics for unknown operators. + */ "unknown-operator": "Warning", + /* + Enable diagnostics for unreachable code. + */ "unreachable-code": "Hint", /* 未使用的函数 @@ -912,7 +1165,7 @@ Array<string> # diagnostics.workspaceDelay -进行工作区诊断的延迟(毫秒)。当你启动工作区,或编辑了任意文件后,将会在后台对整个工作区进行重新诊断。设置为负数可以禁用工作区诊断。 +进行工作区诊断的延迟(毫秒)。 ## type @@ -926,6 +1179,28 @@ integer 3000 ``` +# diagnostics.workspaceEvent + +设置触发工作区诊断的时机。 + +## type + +```ts +string +``` + +## enum + +* ``"OnChange"``: 当文件发生变化时触发工作区诊断。 +* ``"OnSave"``: 当文件保存时触发工作区诊断。 +* ``"None"``: 关闭工作区诊断。 + +## default + +```jsonc +"OnSave" +``` + # diagnostics.workspaceRate 工作区诊断的运行速率(百分比)。降低该值会减少CPU占用,但是也会降低工作区诊断的速度。你当前正在编辑的文件的诊断总是全速完成,不受该选项影响。 @@ -942,6 +1217,54 @@ integer 100 ``` +# doc.packageName + +将特定名称的字段视为package,例如 `m_*` 意味着 `XXX.m_id` 与 `XXX.m_type` 只能在定义所在的文件中访问。 + +## type + +```ts +Array<string> +``` + +## default + +```jsonc +[] +``` + +# doc.privateName + +将特定名称的字段视为私有,例如 `m_*` 意味着 `XXX.m_id` 与 `XXX.m_type` 是私有字段,只能在定义所在的类中访问。 + +## type + +```ts +Array<string> +``` + +## default + +```jsonc +[] +``` + +# doc.protectedName + +将特定名称的字段视为受保护,例如 `m_*` 意味着 `XXX.m_id` 与 `XXX.m_type` 是受保护的字段,只能在定义所在的类极其子类中访问。 + +## type + +```ts +Array<string> +``` + +## default + +```jsonc +[] +``` + # format.defaultConfig 默认的格式化配置,优先级低于工作区内的 `.editorconfig` 文件。 @@ -1219,6 +1542,22 @@ integer 1000 ``` +# misc.executablePath + +VSCode中指定可执行文件路径。 + +## type + +```ts +string +``` + +## default + +```jsonc +"" +``` + # misc.parameters VSCode中启动语言服务时的[命令行参数](https://github.com/sumneko/lua-language-server/wiki/Getting-Started#arguments)。 @@ -1273,6 +1612,7 @@ object<string, string> "os": "default", "package": "default", "string": "default", + "string.buffer": "default", "table": "default", "table.clear": "default", "table.new": "default", @@ -1655,6 +1995,35 @@ boolean false ``` +# typeFormat.config + +Configures the formatting behavior while typing Lua code. + +## type + +```ts +object<string, string> +``` + +## default + +```jsonc +{ + /* + Controls if `end` is automatically completed at suitable positions. + */ + "auto_complete_end": "true", + /* + Controls if a separator is automatically appended at the end of a table declaration. + */ + "auto_complete_table_sep": "true", + /* + Controls if a line is formatted at all. + */ + "format_line": "true" +} +``` + # window.progressBar 在状态栏显示进度条。 |