diff --git a/src/content/wiki/diagnostics.mdx b/src/content/wiki/diagnostics.mdx index 169f155..93e7e12 100644 --- a/src/content/wiki/diagnostics.mdx +++ b/src/content/wiki/diagnostics.mdx @@ -124,7 +124,7 @@ The codestyle group contains diagnostics for maintaining a good code style. **Default File Status:** `"None"` -Triggered when the opinionated style checking detects an incorrectly styled line. +Triggered when the opinionated style checking detects an incorrectly styled line. The style can be customized using the [`Lua.format.defaultConfig` setting](/wiki/settings#formatdefaultconfig). @@ -134,7 +134,7 @@ Triggered when the opinionated style checking detects an incorrectly styled line **Default File Status:** `"None"` -Triggered when the opinionated style checking detects an incorrectly named element. +Triggered when the opinionated style checking detects an incorrectly named element. The style can be customized using the [`Lua.nameStyle.config` setting](/wiki/settings#namestyleconfig). @@ -144,7 +144,7 @@ Triggered when the opinionated style checking detects an incorrectly named eleme **Default File Status:** `"None"` -Triggered when a typo is detected in a string. The dictionary can be customized using the [`Lua.spell.dict` setting](https://github.com/LuaLS/lua-language-server/wiki/Settings#spelldict). +Triggered when a typo is detected in a string. The dictionary can be customized using the [`Lua.spell.dict` setting](/wiki/settings#spelldict). @@ -334,7 +334,7 @@ Triggered when there are two [`@param`](/wiki/annotations#param) annotations wit **Default File Status:** `"None"` -Triggered when a functions signature is partially documented with [annotations](/wiki/annotations), but the annotations do not cover every element of the signature. +Triggered when a functions signature is partially documented with [annotations](/wiki/annotations), but the annotations do not cover every element of the signature. E.g. one of the parameters is not annotated, or the return value is not annotated. @@ -468,6 +468,14 @@ Triggered when the returns of a function are being ignored when it is not permit + + +### invisible + +Triggered when accesses to fields which are invisible. Specifically, access to [`@package`](/wiki/annotations#package) from another file, [`@private`](/wiki/annotations#private) not within self class, or [`@protected`](/wiki/annotations#protected) not within self class or child classes. + + + ## strong The strong group contains diagnostics considered "strong". These can help you write better code but may require more work to follow. diff --git a/src/content/wiki/settings.mdx b/src/content/wiki/settings.mdx index ab4b929..70b64e0 100644 --- a/src/content/wiki/settings.mdx +++ b/src/content/wiki/settings.mdx @@ -27,6 +27,31 @@ Settings that affect the [addon manager](/wiki/addons#addon-manager). Set the on/off state of the addon manager. Disabling the addon manager prevents it from registering its command. +### addonManager.repositoryBranch + +**Type:** `string`
+**Default:** `""` + +Specifies the git branch used by the addon manager. + +### addonManager.repositoryPath + +**Type:** `string`
+**Default:** `""` + +Specifies the git path used by the addon manager. + +## codeLens + +Settings that affect the [codeLens](https://code.visualstudio.com/blogs/2017/02/12/code-lens-roundup). + +### codeLens.enable + +**Type:** `boolean`
+**Default:** `false` + +Enable code lens. + ## completion Settings that adjust how autocompletions are provided while typing. @@ -198,6 +223,13 @@ An array of variable names that will be declared as global. } ``` +### diagnostics.globalsRegex + +**Type:** `Array`
+**Default:** `[]` + +Find defined global variables using regex. + ### diagnostics.groupFileStatus **Type:** Object<[diagnostic_group_name](/wiki/diagnostics), file_state> @@ -230,6 +262,7 @@ An array of variable names that will be declared as global. "await": "Fallback", /* * codestyle-check + * name-style-check * spell-check */ "codestyle": "Fallback", @@ -246,12 +279,14 @@ An array of variable names that will be declared as global. */ "global": "Fallback", /* - * cast-type-mismatch * circle-doc-class * doc-field-no-class * duplicate-doc-alias * duplicate-doc-field * duplicate-doc-param + * incomplete-signature-doc + * missing-global-doc + * missing-local-export-doc * undefined-doc-class * undefined-doc-name * undefined-doc-param @@ -268,6 +303,7 @@ An array of variable names that will be declared as global. * close-non-object * deprecated * discard-returns + * invisible */ "strict": "Fallback", /* @@ -278,6 +314,7 @@ An array of variable names that will be declared as global. * assign-type-mismatch * cast-local-type * cast-type-mismatch + * inject-field * need-check-nil * param-type-mismatch * return-type-mismatch @@ -285,6 +322,7 @@ An array of variable names that will be declared as global. */ "type-check": "Fallback", /* + * missing-fields * missing-parameter * missing-return * missing-return-value @@ -346,6 +384,7 @@ Set the file status required for each diagnostic group. This setting is an `Obje "await": "Fallback", /* * codestyle-check + * name-style-check * spell-check */ "codestyle": "Fallback", @@ -362,12 +401,14 @@ Set the file status required for each diagnostic group. This setting is an `Obje */ "global": "Fallback", /* - * cast-type-mismatch * circle-doc-class * doc-field-no-class * duplicate-doc-alias * duplicate-doc-field * duplicate-doc-param + * incomplete-signature-doc + * missing-global-doc + * missing-local-export-doc * undefined-doc-class * undefined-doc-name * undefined-doc-param @@ -384,6 +425,7 @@ Set the file status required for each diagnostic group. This setting is an `Obje * close-non-object * deprecated * discard-returns + * invisible */ "strict": "Fallback", /* @@ -394,6 +436,7 @@ Set the file status required for each diagnostic group. This setting is an `Obje * assign-type-mismatch * cast-local-type * cast-type-mismatch + * inject-field * need-check-nil * param-type-mismatch * return-type-mismatch @@ -401,6 +444,7 @@ Set the file status required for each diagnostic group. This setting is an `Obje */ "type-check": "Fallback", /* + * missing-fields * missing-parameter * missing-return * missing-return-value @@ -488,13 +532,21 @@ Set how files loaded with [`workspace.library`](#workspacelibrary) are diagnosed "duplicate-doc-field": "Any", "duplicate-doc-param": "Any", "duplicate-index": "Any", - "duplicate-set-field": "Any", + "duplicate-set-field": "Opened", "empty-block": "Opened", + "global-elements": "None", "global-in-nil-env": "Any", + "incomplete-signature-doc": "None", + "inject-field": "Opened", + "invisible": "Any", "lowercase-global": "Any", + "missing-fields": "Any", + "missing-global-doc": "None", + "missing-local-export-doc": "None", "missing-parameter": "Any", "missing-return": "Any", "missing-return-value": "Any", + "name-style-check": "None", "need-check-nil": "Opened", "newfield-call": "Any", "newline-call": "Any", @@ -570,11 +622,19 @@ Set how files loaded with [`workspace.library`](#workspacelibrary) are diagnosed "duplicate-index": "Warning", "duplicate-set-field": "Warning", "empty-block": "Hint", + "global-elements": "Warning", "global-in-nil-env": "Warning", + "incomplete-signature-doc": "Warning", + "inject-field": "Warning", + "invisible": "Warning", "lowercase-global": "Information", + "missing-fields": "Warning", + "missing-global-doc": "Warning", + "missing-local-export-doc": "Warning", "missing-parameter": "Warning", "missing-return": "Warning", "missing-return-value": "Warning", + "name-style-check": "Warning", "need-check-nil": "Warning", "newfield-call": "Warning", "newline-call": "Warning", @@ -667,13 +727,55 @@ The pattern used for matching table field names as a [private](/wiki/annotations The pattern used for matching field names as a [protected](/wiki/annotations#protected) field. Fields that match any of the patterns provided will be private to that class and its child classes. +### doc.regengine + +**Type:** `string`
+**Default:** `"glob"`
+**Options:** + +- `"glob"` - The default lightweight pattern syntax +- `"lua"` - Full Lua-style regular expressions + +Specifies the regular expression engine used for matching documentation scope names. + +## docScriptPath + +**Type:** `string`
+**Default:** `""`
+ +Specifies a custom Lua script path to override the default documentation generation behavior. When set, the server uses this script (instead of [the built-in one](https://github.com/LuaLS/lua-language-server/blob/master/script/cli/doc/export.lua)) to generate LuaDocs, allowing customization of filtering, sorting, and formatting rules. Leave empty to use the default script. Requires the custom script to implement specific APIs for compatibility. + + + +API + +```Lua +export.getLocalPath(uri) -- Called when the documentation needs to get the path of a source relative to the DOC path. Returns the relative path, or the absolute path, prefixed with the string '[FOREIGN]' + +export.positionOf(rowcol) -- Wrapper for guide.positionOf(rowcol[1], rowcol[2]) + +export.sortDoc(a,b) -- A comparison function used by table.sort that is used to sort every piece of documentation in alphabetical order. + +export.documentObject(source, has_seen) -- A function that gets called on every source object. It is responsible for filtering each source to their corresponding export.makeDocObject[] function + +export.makeDocObject[] -- A table of functions that are responsible for building their corresponding 's documentation. TYPES include 'type', 'variable', 'doc.class', etc. 'INIT' corresponds to every documentation object before it is processed by its corresponding type. + +export.gatherGlobals() -- Called when the documentation needs an exhaustive list of the globals it should export documentation. By default this includes the result of vm.getAllGlobals(). Returns the collected variables/types. + +export.makeDocs(globals, callback) -- Documents globals from export.gatherGlobals() by calling export.documentObject on each one; updates its progress by calling callback when a global is finished being documented. Returns a table of the collected documentation + +export.serializeAndExport(docs, outputDir) -- Serializes documentation tables from export.makeDocs to json and markdown, Writes them to /doc.json and /doc.md, respectively. Returns these paths. +``` + + + ## format -Settings for configuring the built-in code formatter. +Settings for configuring the [built-in code formatter](/wiki/formatter). ### format.defaultConfig -**Type:** `Object +**Type:** `Object`
**Default:** `{}` The default configuration for the formatter. If there is a `.editorconfig` in the workspace, it will take priority. Read more on the [formatter's GitHub page](https://github.com/CppCXY/EmmyLuaCodeStyle/tree/master/docs). @@ -708,6 +810,13 @@ Settings for configuring inline hints. See an example below. If a function has been defined as [`@async`](/wiki/annotations#async), display an `await` hint when it is being called. +### hint.awaitPropagate + +**Type:** `boolean`
+**Default:** `false` + +Enable the propagation of `await`. When a function calls a function marked [`@async`](/wiki/annotations#async), it will be automatically marked as [`@async`](/wiki/annotations#async). + ### hint.enable **Type:** `boolean`
@@ -755,7 +864,7 @@ Show a hint to display the type being applied at assignment operations. ## hover -Setting for configuring hover tooltips. The hover tooltips can contain all kinds of useful information. +Settings for configuring hover tooltips. The hover tooltips can contain all kinds of useful information. ### hover.enable @@ -806,6 +915,24 @@ Enable hovering a string that contains an escape character to see its true strin The maximum number of characters that can be previewed by hovering a string before it is truncated. +## language + +Settings for VSCode only. + +### language.completeAnnotation + +**Type:** `boolean`
+**Default:** `true` + +Automatically insert "---@ " after a line break following a annotation. + +### language.fixIndent + +**Type:** `boolean`
+**Default:** `true` + +Fix incorrect auto-indentation, such as incorrect indentation when line breaks occur within a string containing the word "function". + ## misc Miscellaneous settings that do not belong to any of the other groups. @@ -824,6 +951,17 @@ Miscellaneous settings that do not belong to any of the other groups. Manually specify the path for the Lua Language Server executable file. +## nameStyle + +Settings for configuring [name style diagnostics](/wiki/diagnostics#name-style-check). + +### nameStyle.config + +**Type:** Object<string, case>
+**Default:** `{}` + +Set name style config. Read more on the [formatter's GitHub page](https://github.com/CppCXY/EmmyLuaCodeStyle/tree/master/docs). + ## runtime Settings for configuring the runtime environment. @@ -834,7 +972,7 @@ Settings for configuring the runtime environment. **`status` Options:** -- `"default"` - The library will be enabled if it is a part of the current [`runtime.version`](#runtimeversion). +- `"default"` - The library will be enabled if it is a part of the current [`runtime.version`](#runtimeversion) - `"enable"` - Always enable this library - `"disable"` - Always disable this library @@ -1022,7 +1160,7 @@ The spell group contains settings that help detect typos and misspellings. **Type:** `Array`
**Default:** `[]` -A custom dictionary of words that you know are spelled correctly but are being reported as incorrect. Adding words to this dictionary will make them exempt from spell checking. +A custom dictionary of words that you know are spelled correctly but are being reported as incorrect. Adding words to this dictionary will make them exempt from [spell checking](/wiki/diagnostics#spell-check). ## telemetry @@ -1051,6 +1189,31 @@ The type group contains settings for type checking. Whether casting a `number` to an `integer` is allowed. +### type.checkTableShape + +**Type:** `boolean`
+**Default:** `false` + +Strictly check the shape of the table. + +### type.inferParamType + +**Type:** `boolean`
+**Default:** `false` + +When a parameter type is not annotated, it is inferred from the function's call sites. + +When this setting is `false`, the type of the parameter is `any` when it is not annotated. + +### type.inferTableSize + +**Type:** `integer`
+**Default:** `10` + +Controls the maximum number of table fields analyzed during type inference. For tables with fields exceeding this value, only the first N fields (where N is this setting's value) are used to infer types, prioritizing analysis performance. Smaller tables will have all fields analyzed for higher type accuracy. + +Adjust this value to balance between precise type hints and efficient analysis, especially when working with large configuration tables or performance-sensitive projects. + ### type.weakNilCheck **Type:** `boolean`
@@ -1081,6 +1244,41 @@ Whether it is permitted to assign a union type which only has one matching type local str = false ``` +## typeFormat + +The typeFormat group contains settings that configures the formatting behavior. + +### typeFormat.config + +**Type:** Object<behavior, boolean_string>
+ +**`behavior` Options:** + +- `"auto_complete_end"` - Controls if `end` is automatically completed at suitable positions +- `"auto_complete_table_sep"` - Controls if a separator is automatically appended at the end of a table declaration +- `"format_line"` - Controls if a line is formatted at all + +**`boolean_string` Options:** + +- `"true"` - On +- `"false"` - Off + + + +Default Value + +```JSON +{ + "auto_complete_end": "true", + "auto_complete_table_sep": "true", + "format_line": "true" +} +``` + + + +Configure the formatting behavior while typing Lua code. + ## window The window group contains settings that modify the window in VS Code.