diff --git a/.luarc.json b/.luarc.json index 1c17ef2b5..81463341c 100644 --- a/.luarc.json +++ b/.luarc.json @@ -24,7 +24,7 @@ "unusedLocalExclude": [ "_*" ] }, "runtime": { - "version": "Lua 5.4", + "version": "Lua 5.5", "path": [ "script/?.lua", "script/?/init.lua", diff --git a/.vscode/launch.json b/.vscode/launch.json index 77de71efb..efeb72fae 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -9,7 +9,7 @@ "stopOnEntry": false, "program": "${workspaceRoot}/test.lua", "luaexe": "${workspaceFolder}/bin/lua-language-server", - "luaVersion": "lua54", + "luaVersion": "lua55", "sourceCoding": "utf8", "console": "integratedTerminal", "internalConsoleOptions": "openOnSessionStart", @@ -29,6 +29,7 @@ "address": "127.0.0.1:11422", "outputCapture": [ ], + "luaVersion": "lua55", "sourceFormat": "string", "sourceMaps": [ [ @@ -60,7 +61,7 @@ "internalConsoleOptions": "openOnSessionStart", "arg": [ ], - "luaVersion": "lua-latest", + "luaVersion": "lua55", "sourceCoding": "utf8", "outputCapture": [ "print", @@ -82,7 +83,7 @@ "internalConsoleOptions": "openOnSessionStart", "arg": [ ], - "luaVersion": "lua-latest", + "luaVersion": "lua55", "sourceCoding": "utf8", "outputCapture": [ "print", @@ -104,7 +105,7 @@ "internalConsoleOptions": "openOnSessionStart", "arg": [ ], - "luaVersion": "lua-latest", + "luaVersion": "lua55", "sourceCoding": "utf8", "outputCapture": [ "print", @@ -126,7 +127,7 @@ "--check", "${workspaceRoot}", ], - "luaVersion": "lua-latest", + "luaVersion": "lua55", "sourceCoding": "utf8", "outputCapture": [ "print", @@ -148,7 +149,7 @@ "--doc", "${workspaceRoot}", ], - "luaVersion": "lua-latest", + "luaVersion": "lua55", "sourceCoding": "utf8", "outputCapture": [ "print", diff --git a/3rd/bee.lua b/3rd/bee.lua index ee7efd071..466c4f071 160000 --- a/3rd/bee.lua +++ b/3rd/bee.lua @@ -1 +1 @@ -Subproject commit ee7efd07155c33c2c95f4a66d17b2f3ef122896a +Subproject commit 466c4f071a17ab7c31e402383b0a2097b03535ba diff --git a/3rd/luamake b/3rd/luamake index a83fa224d..d5bd143b0 160000 --- a/3rd/luamake +++ b/3rd/luamake @@ -1 +1 @@ -Subproject commit a83fa224d083ad5ee4d39367621ee8c8c8db379b +Subproject commit d5bd143b0307dcb8a7c25fb9308f3f7721fe1a8d diff --git a/changelog.md b/changelog.md index 936597e46..79b3e9e02 100644 --- a/changelog.md +++ b/changelog.md @@ -3,6 +3,10 @@ ## Unreleased +## 3.16.3 +`2025-12-23` +* `CHG` Upgraded to Lua 5.5, memory usage has been reduced by ~10% + ## 3.16.2 `2025-12-18` * `NEW` Added `completion.maxSuggestCount` which lets you increase the amount of fields to analyze before requiring more specific input diff --git a/errors.json b/errors.json new file mode 100644 index 000000000..952f43abf --- /dev/null +++ b/errors.json @@ -0,0 +1,265 @@ +[{ + "resource": "/d:/github/vscode-lua/server/script/core/workspace-symbol.lua", + "owner": "_generated_diagnostic_collection_name_#0", + "code": "keyword", + "severity": 8, + "message": "关键字无法作为名称。", + "source": "Lua 语法检查", + "startLineNumber": 61, + "startColumn": 12, + "endLineNumber": 61, + "endColumn": 18, + "origin": "extHost1" +},{ + "resource": "/d:/github/vscode-lua/server/script/core/workspace-symbol.lua", + "owner": "_generated_diagnostic_collection_name_#0", + "code": "undefined-global", + "severity": 4, + "message": "未定义的全局变量 `global`。", + "source": "Lua 诊断", + "startLineNumber": 115, + "startColumn": 29, + "endLineNumber": 115, + "endColumn": 35, + "origin": "extHost1" +},{ + "resource": "/d:/github/vscode-lua/server/script/vm/global.lua", + "owner": "_generated_diagnostic_collection_name_#0", + "code": "keyword", + "severity": 8, + "message": "关键字无法作为名称。", + "source": "Lua 语法检查", + "startLineNumber": 549, + "startColumn": 12, + "endLineNumber": 549, + "endColumn": 18, + "origin": "extHost1" +},{ + "resource": "/d:/github/vscode-lua/server/script/vm/global.lua", + "owner": "_generated_diagnostic_collection_name_#0", + "code": "keyword", + "severity": 8, + "message": "关键字无法作为名称。", + "source": "Lua 语法检查", + "startLineNumber": 653, + "startColumn": 12, + "endLineNumber": 653, + "endColumn": 18, + "origin": "extHost1" +},{ + "resource": "/d:/github/vscode-lua/server/script/vm/global.lua", + "owner": "_generated_diagnostic_collection_name_#0", + "code": "keyword", + "severity": 8, + "message": "关键字无法作为名称。", + "source": "Lua 语法检查", + "startLineNumber": 693, + "startColumn": 12, + "endLineNumber": 693, + "endColumn": 18, + "origin": "extHost1" +},{ + "resource": "/d:/github/vscode-lua/server/script/vm/global.lua", + "owner": "_generated_diagnostic_collection_name_#0", + "code": "keyword", + "severity": 8, + "message": "关键字无法作为名称。", + "source": "Lua 语法检查", + "startLineNumber": 746, + "startColumn": 12, + "endLineNumber": 746, + "endColumn": 18, + "origin": "extHost1" +},{ + "resource": "/d:/github/vscode-lua/server/script/vm/operator.lua", + "owner": "_generated_diagnostic_collection_name_#0", + "code": "set-const", + "severity": 8, + "message": "不能对常量赋值。", + "source": "Lua 语法检查", + "startLineNumber": 108, + "startColumn": 13, + "endLineNumber": 108, + "endColumn": 14, + "origin": "extHost1" +},{ + "resource": "/d:/github/vscode-lua/server/script/vm/ref.lua", + "owner": "_generated_diagnostic_collection_name_#0", + "code": "keyword", + "severity": 8, + "message": "关键字无法作为名称。", + "source": "Lua 语法检查", + "startLineNumber": 100, + "startColumn": 12, + "endLineNumber": 100, + "endColumn": 18, + "origin": "extHost1" +},{ + "resource": "/d:/github/vscode-lua/server/script/vm/type.lua", + "owner": "_generated_diagnostic_collection_name_#0", + "code": "keyword", + "severity": 8, + "message": "关键字无法作为名称。", + "source": "Lua 语法检查", + "startLineNumber": 281, + "startColumn": 12, + "endLineNumber": 281, + "endColumn": 18, + "origin": "extHost1" +},{ + "resource": "/d:/github/vscode-lua/server/script/vm/type.lua", + "owner": "_generated_diagnostic_collection_name_#0", + "code": "keyword", + "severity": 8, + "message": "关键字无法作为名称。", + "source": "Lua 语法检查", + "startLineNumber": 370, + "startColumn": 16, + "endLineNumber": 370, + "endColumn": 22, + "origin": "extHost1" +},{ + "resource": "/d:/github/vscode-lua/server/script/vm/type.lua", + "owner": "_generated_diagnostic_collection_name_#0", + "code": "keyword", + "severity": 8, + "message": "关键字无法作为名称。", + "source": "Lua 语法检查", + "startLineNumber": 472, + "startColumn": 16, + "endLineNumber": 472, + "endColumn": 22, + "origin": "extHost1" +},{ + "resource": "/d:/github/vscode-lua/server/script/vm/type.lua", + "owner": "_generated_diagnostic_collection_name_#0", + "code": "keyword", + "severity": 8, + "message": "关键字无法作为名称。", + "source": "Lua 语法检查", + "startLineNumber": 903, + "startColumn": 12, + "endLineNumber": 903, + "endColumn": 18, + "origin": "extHost1" +},{ + "resource": "/d:/github/vscode-lua/server/script/vm/visible.lua", + "owner": "_generated_diagnostic_collection_name_#0", + "code": "keyword", + "severity": 8, + "message": "关键字无法作为名称。", + "source": "Lua 语法检查", + "startLineNumber": 142, + "startColumn": 8, + "endLineNumber": 142, + "endColumn": 14, + "origin": "extHost1" +},{ + "resource": "/d:/github/vscode-lua/server/script/workspace/require-path.lua", + "owner": "_generated_diagnostic_collection_name_#0", + "code": "set-const", + "severity": 8, + "message": "不能对常量赋值。", + "source": "Lua 语法检查", + "startLineNumber": 85, + "startColumn": 9, + "endLineNumber": 85, + "endColumn": 17, + "origin": "extHost1" +},{ + "resource": "/d:/github/vscode-lua/server/script/workspace/require-path.lua", + "owner": "_generated_diagnostic_collection_name_#0", + "code": "set-const", + "severity": 8, + "message": "不能对常量赋值。", + "source": "Lua 语法检查", + "startLineNumber": 106, + "startColumn": 17, + "endLineNumber": 106, + "endColumn": 25, + "origin": "extHost1" +},{ + "resource": "/d:/github/vscode-lua/server/script/workspace/require-path.lua", + "owner": "_generated_diagnostic_collection_name_#0", + "code": "set-const", + "severity": 8, + "message": "不能对常量赋值。", + "source": "Lua 语法检查", + "startLineNumber": 108, + "startColumn": 17, + "endLineNumber": 108, + "endColumn": 25, + "origin": "extHost1" +},{ + "resource": "/d:/github/vscode-lua/server/script/workspace/workspace.lua", + "owner": "_generated_diagnostic_collection_name_#0", + "code": "set-const", + "severity": 8, + "message": "不能对常量赋值。", + "source": "Lua 语法检查", + "startLineNumber": 184, + "startColumn": 9, + "endLineNumber": 184, + "endColumn": 13, + "origin": "extHost1" +},{ + "resource": "/d:/github/vscode-lua/server/script/workspace/workspace.lua", + "owner": "_generated_diagnostic_collection_name_#0", + "code": "set-const", + "severity": 8, + "message": "不能对常量赋值。", + "source": "Lua 语法检查", + "startLineNumber": 226, + "startColumn": 9, + "endLineNumber": 226, + "endColumn": 13, + "origin": "extHost1" +},{ + "resource": "/d:/github/vscode-lua/server/tools/locale.lua", + "owner": "_generated_diagnostic_collection_name_#0", + "code": "set-const", + "severity": 8, + "message": "不能对常量赋值。", + "source": "Lua 语法检查", + "startLineNumber": 36, + "startColumn": 13, + "endLineNumber": 36, + "endColumn": 17, + "origin": "extHost1" +},{ + "resource": "/d:/github/vscode-lua/server/tools/love-api.lua", + "owner": "_generated_diagnostic_collection_name_#0", + "code": "set-const", + "severity": 8, + "message": "不能对常量赋值。", + "source": "Lua 语法检查", + "startLineNumber": 40, + "startColumn": 9, + "endLineNumber": 40, + "endColumn": 13, + "origin": "extHost1" +},{ + "resource": "/d:/github/vscode-lua/server/tools/lovr-api.lua", + "owner": "_generated_diagnostic_collection_name_#0", + "code": "set-const", + "severity": 8, + "message": "不能对常量赋值。", + "source": "Lua 语法检查", + "startLineNumber": 41, + "startColumn": 9, + "endLineNumber": 41, + "endColumn": 13, + "origin": "extHost1" +},{ + "resource": "/d:/github/vscode-lua/server/tools/lua51.lua", + "owner": "_generated_diagnostic_collection_name_#0", + "code": "set-const", + "severity": 8, + "message": "不能对常量赋值。", + "source": "Lua 语法检查", + "startLineNumber": 67, + "startColumn": 9, + "endLineNumber": 67, + "endColumn": 11, + "origin": "extHost1" +}] diff --git a/locale/en-us/meta.lua b/locale/en-us/meta.lua index a58c6f489..756cd1cc5 100644 --- a/locale/en-us/meta.lua +++ b/locale/en-us/meta.lua @@ -6,66 +6,103 @@ arg = assert = 'Raises an error if the value of its argument v is false (i.e., `nil` or `false`); otherwise, returns all its arguments. In case of error, `message` is the error object; when absent, it defaults to `"assertion failed!"`' -cgopt.collect = -'Performs a full garbage-collection cycle.' -cgopt.stop = -'Stops automatic execution.' -cgopt.restart = -'Restarts automatic execution.' -cgopt.count = -'Returns the total memory in Kbytes.' -cgopt.step = -[[ -Performs a garbage-collection step. This option may be followed by an integer `size`. -If `size` is a positive n, the collector acts as if n new bytes have been allocated; if `size` is zero, the collector performs a basic step. -In incremental mode, a basic step corresponds to the current step size; in generational mode, a basic step performs a full minor collection, -or an incremental step if the collector has scheduled one. -In incremental mode, the function returns `true` if the step finished a collection cycle; in generational mode, it returns `true` if the step finished a major collection. -]] -cgopt.setpause = -'Set `pause`.' -cgopt.setstepmul = -'Set `step multiplier`.' -cgopt.incremental = -'Changes the collector mode to incremental and returns the previous mode (either `"generational"` or `"incremental"`).' -cgopt.generational = -'Changes the collector mode to generational and returns the previous mode (either `"generational"` or `"incremental"`).' -cgopt.param = -[[ -Changes and/or retrieves the values of a collector parameter. This option must be followed by one or two extra arguments: -the parameter name (a string) and an optional new value (an integer in the range [0,100000]). -The call always returns the previous value of the parameter; if no new value is given, the value is left unchanged. -Lua stores these values in a compressed format, so the value returned as the previous value may not be exactly the last value set. -]] - -gcparam.minormul = -'The minor multiplier.' -gcparam.majorminor = -'The major-minor multiplier.' -gcparam.minormajor = -'The minor-major multiplier.' -gcparam.pause = -'The garbage-collector pause.' -gcparam.stepmul = -'The step multiplier.' -gcparam.stepsize = -'The step size.' - -cgopt.isrunning = -'Returns whether the collector is running.' - -collectgarbage = -[[ -Generic interface to the garbage collector. According to the first argument `opt`, it performs: -• `"collect"`: Performs a full garbage-collection cycle (default option). -• `"stop"`: Stops automatic execution of the collector; it runs only when explicitly invoked, until `"restart"`. -• `"restart"`: Restarts automatic execution of the collector. -• `"count"`: Returns the total memory in use by Lua in Kbytes (fractional; multiply by 1024 for bytes). -• `"step"`: Performs a garbage-collection step; optional integer `size` controls behavior and return value (see `cgopt.step`). -• `"isrunning"`: Returns whether the collector is running (i.e., not stopped). -• `"incremental"`: Changes the mode to incremental and returns the previous mode. -• `"generational"`: Changes the mode to generational and returns the previous mode. -• `"param"`: Changes/reads collector parameters (see `gcparam.*`), always returns the previous value. +collectgarbage51 = +[[ +This function is a generic interface to the garbage collector. It performs different functions according to its first argument, opt: + +* `"collect"`: performs a full garbage-collection cycle. This is the default option. +* `"stop"`: stops the garbage collector. +* `"restart"`: restarts the garbage collector. +* `"count"`: returns the total memory in use by Lua (in Kbytes). +* `"step"`: performs a garbage-collection step. The step "size" is controlled by arg (larger values mean more steps) in a non-specified way. If you want to control the step size you must experimentally tune the value of arg. Returns true if the step finished a collection cycle. +* `"setpause"`: sets arg as the new value for the pause of the collector (see §2.10). Returns the previous value for pause. +* `"setstepmul"`: sets arg as the new value for the step multiplier of the collector (see §2.10). Returns the previous value for step. +]] + +collectgarbage52 = +[[ +This function is a generic interface to the garbage collector. It performs different functions according to its first argument, opt: + +* `"collect"`: performs a full garbage-collection cycle. This is the default option. +* `"stop"`: stops automatic execution of the garbage collector. The collector will run only when explicitly invoked, until a call to restart it. +* `"restart"`: restarts automatic execution of the garbage collector. +* `"count"`: returns the total memory in use by Lua (in Kbytes) and a second value with the total memory in bytes modulo 1024. The first value has a fractional part, so the following equality is always true: + ```lua + k, b = collectgarbage("count") + assert(k*1024 == math.floor(k)*1024 + b) + ``` + (The second result is useful when Lua is compiled with a non floating-point type for numbers.) +* `"step"`: performs a garbage-collection step. The step "size" is controlled by arg (larger values mean more steps) in a non-specified way. If you want to control the step size you must experimentally tune the value of arg. Returns true if the step finished a collection cycle. +* `"setpause"`: sets arg as the new value for the pause of the collector (see §2.5). Returns the previous value for pause. +* `"setstepmul"`: sets arg as the new value for the step multiplier of the collector (see §2.5). Returns the previous value for step. +* `"isrunning"`: returns a boolean that tells whether the collector is running (i.e., not stopped). +* `"generational"`: changes the collector to generational mode. This is an experimental feature (see §2.5). +* `"incremental"`: changes the collector to incremental mode. This is the default mode. +]] + +collectgarbage53 = +[[ +This function is a generic interface to the garbage collector. It performs different functions according to its first argument, opt: + +* `"collect"`: performs a full garbage-collection cycle. This is the default option. +* `"stop"`: stops automatic execution of the garbage collector. The collector will run only when explicitly invoked, until a call to restart it. +* `"restart"`: restarts automatic execution of the garbage collector. +* `"count"`: returns the total memory in use by Lua in Kbytes. The value has a fractional part, so that it multiplied by 1024 gives the exact number of bytes in use by Lua (except for overflows). +* `"step"`: performs a garbage-collection step. The step "size" is controlled by arg. With a zero value, the collector will perform one basic (indivisible) step. For non-zero values, the collector will perform as if that amount of memory (in KBytes) had been allocated by Lua. Returns true if the step finished a collection cycle. +* `"setpause"`: sets arg as the new value for the pause of the collector (see §2.5). Returns the previous value for pause. +* `"setstepmul"`: sets arg as the new value for the step multiplier of the collector (see §2.5). Returns the previous value for step. +* "isrunning"`: returns a boolean that tells whether the collector is running (i.e., not stopped). +]] + +collectgarbage54 = +[[ +This function is a generic interface to the garbage collector. It performs different functions according to its first argument, opt: + +* `"collect"`: Performs a full garbage-collection cycle. This is the default option. +* `"stop"`: Stops automatic execution of the garbage collector. The collector will run only when explicitly invoked, until a call to restart it. +* `"restart"`: Restarts automatic execution of the garbage collector. +* `"count"`: Returns the total memory in use by Lua in Kbytes. The value has a fractional part, so that it multiplied by 1024 gives the exact number of bytes in use by Lua. +* `"step"`: Performs a garbage-collection step. The step "size" is controlled by arg. With a zero value, the collector will perform one basic (indivisible) step. For non-zero values, the collector will perform as if that amount of memory (in Kbytes) had been allocated by Lua. Returns true if the step finished a collection cycle. +* `"isrunning"`: Returns a boolean that tells whether the collector is running (i.e., not stopped). +* `"incremental"`: Change the collector mode to incremental. This option can be followed by three numbers: the garbage-collector pause, the step multiplier, and the step size (see §2.5.1). A zero means to not change that value. +* `"generational"`: Change the collector mode to generational. This option can be followed by two numbers: the garbage-collector minor multiplier and the major multiplier (see §2.5.2). A zero means to not change that value. +See §2.5 for more details about garbage collection and some of these options. + +This function should not be called by a finalizer. +]] + +collectgarbage55 = +[[ +This function is a generic interface to the garbage collector. It performs different functions according to its first argument, opt: + +* `"collect"`: Performs a full garbage-collection cycle. This is the default option. +* `"stop"`: Stops automatic execution of the garbage collector. The collector will run only when explicitly invoked, until a call to restart it. +* `"restart"`: Restarts automatic execution of the garbage collector. +* `"count"`: Returns the total memory in use by Lua in Kbytes. The value has a fractional part, so that it multiplied by 1024 gives the exact number of bytes in use by Lua. +* `"step"`: Performs a garbage-collection step. This option may be followed by an extra argument, an integer with the step size. + + If the size is a positive n, the collector acts as if n new bytes have been allocated. If the size is zero, the collector performs a basic step. In incremental mode, a basic step corresponds to the current step size. In generational mode, a basic step performs a full minor collection or an incremental step, if the collector has scheduled one. + + In incremental mode, the function returns true if the step finished a collection cycle. In generational mode, the function returns true if the step finished a major collection. + +* `"isrunning"`: Returns a boolean that tells whether the collector is running (i.e., not stopped). +* `"incremental"`: Changes the collector mode to incremental and returns the previous mode. +* `"generational"`: Changes the collector mode to generational and returns the previous mode. +* `"param"`: Changes and/or retrieves the values of a parameter of the collector. This option must be followed by one or two extra arguments: The name of the parameter being changed or retrieved (a string) and an optional new value for that parameter, an integer in the range [0,100000]. The first argument must have one of the following values: + * `"minormul"`: The minor multiplier. + * `"majorminor"`: The major-minor multiplier. + * `"minormajor"`: The minor-major multiplier. + * `"pause"`: The garbage-collector pause. + * `"stepmul"`: The step multiplier. + * `"stepsize"`: The step size. + + The call always returns the previous value of the parameter. If the call does not give a new value, the value is left unchanged. + + Lua stores these values in a compressed format, so, the value returned as the previous value may not be exactly the last value set. + +See §2.5 for more details about garbage collection and some of these options. + +This function should not be called by a finalizer. ]] dofile = @@ -685,12 +722,29 @@ string.char = 'Returns a string with length equal to the number of arguments, in which each character has the internal numeric code equal to its corresponding argument.' string.dump = 'Returns a string containing a binary representation (a *binary chunk*) of the given function.' +string.find = +'Looks for the first match of `pattern` (see §6.4.1) in the string.' string.find['>5.2'] = 'Looks for the first match of `pattern` (see §6.4.1) in the string.' string.find['=5.1'] = 'Looks for the first match of `pattern` (see §5.4.1) in the string.' string.format = 'Returns a formatted version of its variable number of arguments following the description given in its first argument.' +string.gmatch = +[[ +Returns an iterator function. Each call to that iterator continues matching `pattern` (see §6.4.1) over s and returns all captures. + +The following example iterates over all words in string s, printing one per line: +```lua + s = +"hello world from Lua" + for w in string.gmatch(s, "%a+") do + print(w) + end +``` +]] +string.gsub = +'Returns a copy of s where all occurrences of `pattern` (or the first n occurrences if n is given) are replaced by repl (see §6.4.1).' string.gmatch['>5.2'] = [[ Returns an iterator function that, each time it is called, returns the next captures from `pattern` (see §6.4.1) over the string s. @@ -725,6 +779,12 @@ string.len = 'Returns its length.' string.lower = 'Returns a copy of this string with all uppercase letters changed to lowercase.' +string.match = +'Looks for the first match of `pattern` (see §6.4.1) in the string. If it finds one, `match` returns the captures; otherwise it returns nil.' +string.pack = +'Returns a binary string containing the values `v1`, `v2`, etc. packed (that is, serialized in binary form) according to the format string `fmt` (see §6.4.2).' +string.packsize = +'Returns the length of a string resulting from `string.pack` with the given format string `fmt`. The format string cannot contain the variable-length options `s` or `z` (see §6.4.2).' string.match['>5.2'] = 'Looks for the first match of `pattern` (see §6.4.1) in the string.' string.match['=5.1'] = diff --git a/locale/en-us/script.lua b/locale/en-us/script.lua index 1c7c29272..a49378fff 100644 --- a/locale/en-us/script.lua +++ b/locale/en-us/script.lua @@ -44,10 +44,13 @@ DIAG_AMBIGUITY_1 = 'Compute `{}` first. You may need to add brackets.' DIAG_LOWERCASE_GLOBAL = 'Global variable in lowercase initial, Did you miss `local` or misspell it?' + ASSIGN_CONST_GLOBAL = 'Cannot assign to global variable `{}`.' + VARIABLE_NOT_DECLARED = 'Variable `{}` not declared (global declarations active).' + DIAG_EMPTY_BLOCK = 'Empty block.' DIAG_DIAGNOSTICS = @@ -381,6 +384,8 @@ HOVER_DOCUMENT_LUA53 = 'http://www.lua.org/manual/5.3/manual.html#{}' HOVER_DOCUMENT_LUA54 = 'http://www.lua.org/manual/5.4/manual.html#{}' +HOVER_DOCUMENT_LUA55 = +'https://www.lua.org/manual/5.5/manual.html#{}' HOVER_DOCUMENT_LUAJIT = 'http://www.lua.org/manual/5.1/manual.html#{}' HOVER_NATIVE_DOCUMENT_LUA51 = @@ -391,6 +396,8 @@ HOVER_NATIVE_DOCUMENT_LUA53 = 'command:extension.lua.doc?["en-us/53/manual.html/{}"]' HOVER_NATIVE_DOCUMENT_LUA54 = 'command:extension.lua.doc?["en-us/54/manual.html/{}"]' +HOVER_NATIVE_DOCUMENT_LUA55 = +'command:extension.lua.doc?["en-us/55/manual.html/{}"]' HOVER_NATIVE_DOCUMENT_LUAJIT = 'command:extension.lua.doc?["en-us/51/manual.html/{}"]' HOVER_MULTI_PROTOTYPE = @@ -666,6 +673,8 @@ CLI_CHECK_SUCCESS = 'Diagnosis completed, no problems found' CLI_CHECK_PROGRESS = 'Found {} problems in {} files' +CLI_CHECK_RESULTS = +'Diagnosis complete, {} problems found, see {}' CLI_CHECK_RESULTS_OUTPATH = 'Diagnosis complete, {} problems found, see {}' CLI_CHECK_RESULTS_PRETTY = diff --git a/locale/en-us/setting.lua b/locale/en-us/setting.lua index c831497ed..13f5f9f73 100644 --- a/locale/en-us/setting.lua +++ b/locale/en-us/setting.lua @@ -115,10 +115,14 @@ config.diagnostics.ignoredFiles.Opened = "Only when these files are opened will it be diagnosed." config.diagnostics.ignoredFiles.Disable = "These files are not diagnosed." +config.diagnostics.disableScheme = +'Do not diagnose Lua files that use the following scheme.' config.diagnostics.validScheme = 'Enable diagnostics for Lua files that use the following scheme.' config.diagnostics.unusedLocalExclude = 'Do not diagnose `unused-local` when the variable name matches the following pattern.' +config.diagnostics.validScheme = +'Enable diagnostics for Lua files that use the following scheme.' config.workspace.ignoreDir = "Ignored files and directories (Use `.gitignore` grammar)."-- .. example.ignoreDir, config.workspace.ignoreSubmodules = diff --git a/locale/es-419/meta.lua b/locale/es-419/meta.lua index 41ce8cbdd..446213a81 100644 --- a/locale/es-419/meta.lua +++ b/locale/es-419/meta.lua @@ -6,66 +6,103 @@ arg = assert = 'Alsa un error si el valor de sus argumentos es falso. (ej: `nil` ó `falso`); de lo contrario, retorna todos sus argumentos. En caso de error, `message` es el mensaje de error; cuando se omite, el valor predeterminado es `"assertion failed!"`' -cgopt.collect = -'Realiza un ciclo completo de recolección de basura.' -cgopt.stop = -'Detiene la ejecución automática.' -cgopt.restart = -'Reinicia la ejecución automática.' -cgopt.count = -'Retorna el total de memoria en Kbytes.' -cgopt.step = -[[ -Realiza un paso de recolección de basura. Esta opción puede seguirse por un entero `size`. -Si `size` es un n positivo, el recolector actúa como si se hubieran asignado n nuevos bytes; si `size` es cero, realiza un paso básico. -En modo incremental, un paso básico corresponde al tamaño de paso actual; en modo generacional, un paso básico realiza una recolección menor completa, -o un paso incremental si el recolector ha agendado uno. -En modo incremental, la función retorna `true` si el paso terminó un ciclo de recolección; en modo generacional, retorna `true` si el paso terminó una recolección mayor. -]] -cgopt.setpause = -'Establece la pausa.' -cgopt.setstepmul = -'Establece el multiplicador para el paso de recolección de basura.' -cgopt.incremental = -'Cambia el modo del recolector a incremental y retorna el modo anterior (sea `"generational"` o `"incremental"`).' -cgopt.generational = -'Cambia el modo del recolector a generacional y retorna el modo anterior (sea `"generational"` o `"incremental"`).' -cgopt.param = -[[ -Cambia y/o recupera los valores de un parámetro del recolector. Esta opción debe ir seguida de uno o dos argumentos adicionales: -el nombre del parámetro (una cadena) y un nuevo valor opcional (un entero en el rango [0,100000]). -La llamada siempre retorna el valor anterior del parámetro; si no se da un nuevo valor, el valor se mantiene sin cambios. -Lua almacena estos valores en un formato comprimido, por lo que el valor retornado como anterior puede no ser exactamente el último valor establecido. -]] - -gcparam.minormul = -'El multiplicador menor.' -gcparam.majorminor = -'El multiplicador mayor-menor.' -gcparam.minormajor = -'El multiplicador menor-mayor.' -gcparam.pause = -'La pausa del recolector de basura.' -gcparam.stepmul = -'El multiplicador de paso.' -gcparam.stepsize = -'El tamaño del paso.' - -cgopt.isrunning = -'Retorna si el recolector está corriendo.' - -collectgarbage = -[[ -Interfaz genérica al recolector de basura. Según el primer argumento `opt`, realiza: -• `"collect"`: Realiza un ciclo completo de recolección de basura (opción predeterminada). -• `"stop"`: Detiene la ejecución automática; el recolector corre sólo cuando se invoca explícitamente, hasta `"restart"`. -• `"restart"`: Reinicia la ejecución automática. -• `"count"`: Retorna la memoria total usada por Lua en Kbytes (fraccionario; multiplique por 1024 para bytes). -• `"step"`: Realiza un paso de recolección; entero opcional `size` controla el comportamiento y el retorno (vea `cgopt.step`). -• `"isrunning"`: Retorna si el recolector está corriendo (es decir, no detenido). -• `"incremental"`: Cambia el modo a incremental y retorna el modo anterior. -• `"generational"`: Cambia el modo a generacional y retorna el modo anterior. -• `"param"`: Cambia/lee parámetros del recolector (vea `gcparam.*`), siempre retorna el valor anterior. +collectgarbage51 = +[[ +Esta función es una interfaz genérica para el recolector de basura. Realiza diferentes funciones según su primer argumento, opt: + +* `"collect"`: realiza un ciclo completo de recolección de basura. Esta es la opción predeterminada. +* `"stop"`: detiene el recolector de basura. +* `"restart"`: reinicia el recolector de basura. +* `"count"`: retorna la memoria total en uso por Lua (en Kbytes). +* `"step"`: realiza un paso de recolección de basura. El "tamaño" del paso es controlado por arg (valores más grandes significan más pasos) de una manera no especificada. Si desea controlar el tamaño del paso, debe ajustar experimentalmente el valor de arg. Retorna true si el paso terminó un ciclo de recolección. +* `"setpause"`: establece arg como el nuevo valor para la pausa del recolector (ver §2.10). Retorna el valor anterior de pausa. +* `"setstepmul"`: establece arg como el nuevo valor para el multiplicador de paso del recolector (ver §2.10). Retorna el valor anterior del multiplicador de paso. +]] + +collectgarbage52 = +[[ +Esta función es una interfaz genérica para el recolector de basura. Realiza diferentes funciones según su primer argumento, opt: + +* `"collect"`: realiza un ciclo completo de recolección de basura. Esta es la opción predeterminada. +* `"stop"`: detiene la ejecución automática del recolector de basura. El recolector solo se ejecutará cuando se invoque explícitamente, hasta una llamada para reiniciarlo. +* `"restart"`: reinicia la ejecución automática del recolector de basura. +* `"count"`: retorna la memoria total en uso por Lua (en Kbytes) y un segundo valor con la memoria total en bytes módulo 1024. El primer valor tiene una parte fraccionaria, por lo que la siguiente igualdad siempre es verdadera: + ```lua + k, b = collectgarbage("count") + assert(k*1024 == math.floor(k)*1024 + b) + ``` + (El segundo resultado es útil cuando Lua se compila con un tipo no flotante para números.) +* `"step"`: realiza un paso de recolección de basura. El "tamaño" del paso es controlado por arg (valores más grandes significan más pasos) de una manera no especificada. Si desea controlar el tamaño del paso, debe ajustar experimentalmente el valor de arg. Retorna true si el paso terminó un ciclo de recolección. +* `"setpause"`: establece arg como el nuevo valor para la pausa del recolector (ver §2.5). Retorna el valor anterior de pausa. +* `"setstepmul"`: establece arg como el nuevo valor para el multiplicador de paso del recolector (ver §2.5). Retorna el valor anterior del multiplicador de paso. +* `"isrunning"`: retorna un booleano que indica si el recolector está en ejecución (es decir, no detenido). +* `"generational"`: cambia el recolector al modo generacional. Esta es una característica experimental (ver §2.5). +* `"incremental"`: cambia el recolector al modo incremental. Este es el modo predeterminado. +]] + +collectgarbage53 = +[[ +Esta función es una interfaz genérica para el recolector de basura. Realiza diferentes funciones según su primer argumento, opt: + +* `"collect"`: realiza un ciclo completo de recolección de basura. Esta es la opción predeterminada. +* `"stop"`: detiene la ejecución automática del recolector de basura. El recolector solo se ejecutará cuando se invoque explícitamente, hasta una llamada para reiniciarlo. +* `"restart"`: reinicia la ejecución automática del recolector de basura. +* `"count"`: retorna la memoria total en uso por Lua en Kbytes. El valor tiene una parte fraccionaria, por lo que multiplicado por 1024 da el número exacto de bytes en uso por Lua (excepto por desbordamientos). +* `"step"`: realiza un paso de recolección de basura. El "tamaño" del paso es controlado por arg. Con un valor cero, el recolector realizará un paso básico (indivisible). Para valores distintos de cero, el recolector se comportará como si esa cantidad de memoria (en KBytes) hubiera sido asignada por Lua. Retorna true si el paso terminó un ciclo de recolección. +* `"setpause"`: establece arg como el nuevo valor para la pausa del recolector (ver §2.5). Retorna el valor anterior de pausa. +* `"setstepmul"`: establece arg como el nuevo valor para el multiplicador de paso del recolector (ver §2.5). Retorna el valor anterior del multiplicador de paso. +* "isrunning"`: retorna un booleano que indica si el recolector está en ejecución (es decir, no detenido). +]] + +collectgarbage54 = +[[ +Esta función es una interfaz genérica para el recolector de basura. Realiza diferentes funciones según su primer argumento, opt: + +* `"collect"`: Realiza un ciclo completo de recolección de basura. Esta es la opción predeterminada. +* `"stop"`: Detiene la ejecución automática del recolector de basura. El recolector solo se ejecutará cuando se invoque explícitamente, hasta una llamada para reiniciarlo. +* `"restart"`: Reinicia la ejecución automática del recolector de basura. +* `"count"`: Retorna la memoria total en uso por Lua en Kbytes. El valor tiene una parte fraccionaria, por lo que multiplicado por 1024 da el número exacto de bytes en uso por Lua. +* `"step"`: Realiza un paso de recolección de basura. El "tamaño" del paso es controlado por arg. Con un valor cero, el recolector realizará un paso básico (indivisible). Para valores distintos de cero, el recolector se comportará como si esa cantidad de memoria (en Kbytes) hubiera sido asignada por Lua. Retorna true si el paso terminó un ciclo de recolección. +* `"isrunning"`: Retorna un booleano que indica si el recolector está en ejecución (es decir, no detenido). +* `"incremental"`: Cambia el modo del recolector a incremental. Esta opción puede ir seguida de tres números: la pausa del recolector de basura, el multiplicador de paso y el tamaño del paso (ver §2.5.1). Un cero significa no cambiar ese valor. +* `"generational"`: Cambia el modo del recolector a generacional. Esta opción puede ir seguida de dos números: el multiplicador menor del recolector de basura y el multiplicador mayor (ver §2.5.2). Un cero significa no cambiar ese valor. +Vea §2.5 para más detalles sobre la recolección de basura y algunas de estas opciones. + +Esta función no debe ser llamada por un finalizador. +]] + +collectgarbage55 = +[[ +Esta función es una interfaz genérica para el recolector de basura. Realiza diferentes funciones según su primer argumento, opt: + +* `"collect"`: Realiza un ciclo completo de recolección de basura. Esta es la opción predeterminada. +* `"stop"`: Detiene la ejecución automática del recolector de basura. El recolector solo se ejecutará cuando se invoque explícitamente, hasta una llamada para reiniciarlo. +* `"restart"`: Reinicia la ejecución automática del recolector de basura. +* `"count"`: Retorna la memoria total en uso por Lua en Kbytes. El valor tiene una parte fraccionaria, por lo que multiplicado por 1024 da el número exacto de bytes en uso por Lua. +* `"step"`: Realiza un paso de recolección de basura. Esta opción puede ir seguida de un argumento adicional, un entero con el tamaño del paso. + + Si el tamaño es un n positivo, el recolector actúa como si se hubieran asignado n nuevos bytes. Si el tamaño es cero, el recolector realiza un paso básico. En modo incremental, un paso básico corresponde al tamaño de paso actual. En modo generacional, un paso básico realiza una recolección menor completa o un paso incremental, si el recolector ha programado uno. + + En modo incremental, la función retorna true si el paso terminó un ciclo de recolección. En modo generacional, la función retorna true si el paso terminó una recolección mayor. + +* `"isrunning"`: Retorna un booleano que indica si el recolector está en ejecución (es decir, no detenido). +* `"incremental"`: Cambia el modo del recolector a incremental y retorna el modo anterior. +* `"generational"`: Cambia el modo del recolector a generacional y retorna el modo anterior. +* `"param"`: Cambia y/o recupera los valores de un parámetro del recolector. Esta opción debe ir seguida de uno o dos argumentos adicionales: El nombre del parámetro que se cambia o recupera (una cadena) y un nuevo valor opcional para ese parámetro, un entero en el rango [0,100000]. El primer argumento debe tener uno de los siguientes valores: + * `"minormul"`: El multiplicador menor. + * `"majorminor"`: El multiplicador mayor-menor. + * `"minormajor"`: El multiplicador menor-mayor. + * `"pause"`: La pausa del recolector de basura. + * `"stepmul"`: El multiplicador de paso. + * `"stepsize"`: El tamaño del paso. + + La llamada siempre retorna el valor anterior del parámetro. Si la llamada no proporciona un nuevo valor, el valor permanece sin cambios. + + Lua almacena estos valores en un formato comprimido, por lo que el valor retornado como valor anterior puede no ser exactamente el último valor establecido. + +Vea §2.5 para más detalles sobre la recolección de basura y algunas de estas opciones. + +Esta función no debe ser llamada por un finalizador. ]] dofile = @@ -429,7 +466,6 @@ seekwhence.set = 'Sitúa la posición base está al inicio del archivo.' seekwhence.cur = 'Sitúa la posición base en la actual.' - seekwhence['.end'] = 'Sitúa la posición base al final del archivo.' @@ -687,6 +723,10 @@ string.dump = 'Retorna un string que contiene una representación binaria de la función provista.' string.find = 'Busca el primer calce del patrón `pattern` (véase §6.4.1) en el string.' +string.find['>5.2'] = +'Busca el primer calce del patrón `pattern` (véase §6.4.1) en el string.' +string.find['=5.1'] = +'Busca el primer calce del patrón `pattern` (véase §5.4.1) en el string.' string.format = 'Retorna una versión formateada de su argumentos (en número variable) siguiendo la descripción dada en su primer argumento.' string.gmatch = @@ -704,6 +744,36 @@ Por ejemplo, el bucle siguiente itera sobre todas las palabras del sstring s, im ]] string.gsub = 'Retorna una copia de s en la cual todos (o los primeras `n`, si es provisto este argumento) ocurrencias del patrón `pattern` (vease §6.4.1) han sido reemplazadas por el string de reemplazo especificado por `repl`.' +string.gmatch['>5.2'] = +[[ +Retorna una función iteradora que, cada vez que es llamada, retorna las siguientes capturas del patrón `pattern` (véase §6.4.1) sobre el string s. + +Por ejemplo, el bucle siguiente itera sobre todas las palabras del string s, imprimiendo una por línea: +```lua + s = +"hello world from Lua" + for w in string.gmatch(s, "%a+") do + print(w) + end +``` +]] +string.gmatch['=5.1'] = +[[ +Retorna una función iteradora que, cada vez que es llamada, retorna las siguientes capturas del patrón `pattern` (véase §5.4.1) sobre el string s. + +Por ejemplo, el bucle siguiente itera sobre todas las palabras del string s, imprimiendo una por línea: +```lua + s = +"hello world from Lua" + for w in string.gmatch(s, "%a+") do + print(w) + end +``` +]] +string.gsub['>5.2'] = +'Retorna una copia de s en la cual todas (o las primeras `n`, si se entrega) ocurrencias del patrón `pattern` (véase §6.4.1) han sido reemplazadas por un string de reemplazo especificado por `repl`.' +string.gsub['=5.1'] = +'Retorna una copia de s en la cual todas (o las primeras `n`, si se entrega) ocurrencias del patrón `pattern` (véase §5.4.1) han sido reemplazadas por un string de reemplazo especificado por `repl`.' string.len = 'Retorna el largo.' string.lower = @@ -714,6 +784,14 @@ string.pack = 'Retorna el string binario que contiene los valores `v1`, `v2`, etc. empacados (serializados en forma binaria) de acuerdo al string de formato `fmt` (véase §6.4.2) .' string.packsize = 'Retorna el largo del string que retorna `string.pack` con el formato `fmt` (véase §6.4.2) provisto.' +string.match['>5.2'] = +'Busca el primer calce del patrón `pattern` (véase §6.4.1) en el string.' +string.match['=5.1'] = +'Busca el primer calce del patrón `pattern` (véase §5.4.1) en el string.' +string.pack['>5.2'] = +'Retorna el string binario que contiene los valores `v1`, `v2`, etc. empacados (serializados en forma binaria) de acuerdo al string de formato `fmt` (véase §6.4.2).' +string.packsize['>5.2'] = +'Retorna el largo del string que retorna `string.pack` con el formato `fmt` (véase §6.4.2) provisto.' string.rep['>5.2'] = 'Retorna el string que es la concatenación de `n` copias del string `s` separado por el string `sep`.' string.rep['<5.1'] = diff --git a/locale/es-419/script.lua b/locale/es-419/script.lua index b3be7c855..effa46446 100644 --- a/locale/es-419/script.lua +++ b/locale/es-419/script.lua @@ -36,12 +36,21 @@ DIAG_OVER_MAX_ARGS = 'Esta función espera un máximo de {:d} argumento(s), pero está recibiendo {:d}.' DIAG_MISS_ARGS = 'Esta función requiere {:d} argumento(s), pero está recibiendo {:d}.' +DIAG_UNNECESSARY_ASSERT = +'Aserción innecesaria: esta expresión siempre es verdadera.' DIAG_OVER_MAX_VALUES = 'Solo tiene {} variables, pero se están asignando {} valores.' DIAG_AMBIGUITY_1 = 'Se calcula `{}` primero. Agregar corchetes podría ser necesario.' DIAG_LOWERCASE_GLOBAL = 'Variable global con inicial minúscula, ¿olvidó agregar `local` o está mal escrita?' + +ASSIGN_CONST_GLOBAL = +'No se puede asignar a la variable global `{}`.' + +VARIABLE_NOT_DECLARED = +'Variable `{}` no declarada (declaraciones globales activas).' + DIAG_EMPTY_BLOCK = 'Bloque vacío.' DIAG_DIAGNOSTICS = @@ -375,6 +384,8 @@ HOVER_DOCUMENT_LUA53 = 'http://www.lua.org/manual/5.3/manual.html#{}' HOVER_DOCUMENT_LUA54 = 'http://www.lua.org/manual/5.4/manual.html#{}' +HOVER_DOCUMENT_LUA55 = +'https://www.lua.org/manual/5.5/manual.html#{}' HOVER_DOCUMENT_LUAJIT = 'http://www.lua.org/manual/5.1/manual.html#{}' HOVER_NATIVE_DOCUMENT_LUA51 = @@ -385,6 +396,8 @@ HOVER_NATIVE_DOCUMENT_LUA53 = 'command:extension.lua.doc?["en-us/53/manual.html/{}"]' HOVER_NATIVE_DOCUMENT_LUA54 = 'command:extension.lua.doc?["en-us/54/manual.html/{}"]' +HOVER_NATIVE_DOCUMENT_LUA55 = +'command:extension.lua.doc?["en-us/55/manual.html/{}"]' HOVER_NATIVE_DOCUMENT_LUAJIT = 'command:extension.lua.doc?["en-us/51/manual.html/{}"]' HOVER_MULTI_PROTOTYPE = @@ -662,6 +675,10 @@ CLI_CHECK_PROGRESS= 'Se encontraron {} problema(s) en {} archivo(s)' CLI_CHECK_RESULTS= 'Se completó el diagnóstico, se encontraron {} problema(s), vea {}' +CLI_CHECK_RESULTS_OUTPATH = +'Diagnóstico completado, se encontraron {} problema(s), vea {}' +CLI_CHECK_RESULTS_PRETTY = +'Diagnóstico completado, se encontraron {} problema(s)' CLI_CHECK_MULTIPLE_WORKERS= 'Iniciando {} tarea(s) de trabajo, se ha deshabitado la salida de progreso. Esto podría tomar unos minutos.' CLI_DOC_INITING = diff --git a/locale/es-419/setting.lua b/locale/es-419/setting.lua index f6d92f451..d29ef2e62 100644 --- a/locale/es-419/setting.lua +++ b/locale/es-419/setting.lua @@ -6,9 +6,8 @@ config.addonManager.repositoryBranch = "Especifica la rama de git usada por el manejador de extensiones." config.addonManager.repositoryPath = "Especifica la ruta git usada por el manejador de extensiones." -config.addonRepositoryPath = -- TODO: need translate! -"Specifies the addon repository path (not related to the addon manager)." - +config.addonRepositoryPath = +"Especifica la ruta del repositorio de complementos (no relacionada con el gestor de complementos)." config.runtime.version = "Versión de Lua que se ejecuta." config.runtime.path = @@ -119,8 +118,12 @@ config.diagnostics.ignoredFiles.Disable = "Estos archivos no se diagnostican." config.diagnostics.disableScheme = 'Los archivos de Lua que siguen el siguiente esquema no se diagnostican.' +config.diagnostics.validScheme = +'Habilita diagnósticos para archivos Lua que usan el siguiente esquema.' config.diagnostics.unusedLocalExclude = 'Las variables que calcen con el siguiente patrón no se diagnostican con `unused-local`.' +config.diagnostics.validScheme = +'Habilita diagnósticos para archivos Lua que usan el siguiente esquema.' config.workspace.ignoreDir = "Directorios y archivos ignorados (se usa la misma gramática que en `.gitignore`)" config.workspace.ignoreSubmodules = @@ -180,6 +183,8 @@ config.completion.showWord.Disable = "Sin presentar las palabras contextuales." config.completion.autoRequire = "Agrega automáticamente el `require` correspondiente cuando la entrada se parece a un nombre de archivo." +config.completion.maxSuggestCount = +"Número máximo de campos a analizar para autocompletar. Cuando un objeto tiene más campos que este límite, las sugerencias requerirán una entrada más específica para aparecer." config.completion.showParams = "Muestra los parámetros en la lista de completado. Cuando la función tiene múltiples definiciones, se mostrarán por separado." config.completion.requireSeparator = @@ -260,6 +265,9 @@ config.hint.arrayIndex.Disable = 'Deshabilita las pistas en de los índices de arreglos.' config.hint.await = 'Si la función que se llama está marcada con `---@async`, pregunta por un `await` en la llamada.' +config.hint.awaitPropagate = +'Habilita la propagación de `await`. Cuando una función llama a una función marcada con `---@async`,\z +se marcará automáticamente como `---@async`.' config.hint.semicolon = 'Si no hay punto y coma al final de la sentencia, despliega un punto y coma virtual.' config.hint.semicolon.All = @@ -323,22 +331,22 @@ config.type.checkTableShape = [[ Chequea estrictamente la forma de la tabla. ]] -config.type.inferTableSize = -- TODO: need translate! -'Maximum number of table fields analyzed during type inference.' +config.type.inferTableSize = +'Cantidad máxima de campos de tabla analizados durante la inferencia de tipos.' config.doc.privateName = 'Trata los nombres específicos de campo como privados. Por ejemplo `m_*` significa `XXX.m_id` y `XXX.m_tipo` son privados, por lo que solo pueden ser accedidos donde se define la clase.' config.doc.protectedName = 'Trata los nombres específicos de campo como protegidos. Por ejemplo `m_*` significa `XXX.m_id` y `XXX.m_tipo` son privados, por lo que solo pueden ser accedidos donde se define la clase y sus subclases.' config.doc.packageName = 'Trata los nombres específicos de campo como del paquete. Por ejemplo `m_*` significa `XXX.m_id` y `XXX.m_tipo` son de paquete, por lo que solo pueden ser accedidos en el archivo donde son definidos.' -config.doc.regengine = -- TODO: need translate! -'The regular expression engine used for matching documentation scope names.' -config.doc.regengine.glob = -- TODO: need translate! -'The default lightweight pattern syntax.' -config.doc.regengine.lua = -- TODO: need translate! -'Full Lua-style regular expressions.' -config.docScriptPath = -- TODO: need translate! -'The regular expression engine used for matching documentation scope names.' +config.doc.regengine = +'Motor de expresiones regulares usado para coincidir nombres de ámbito de documentación.' +config.doc.regengine.glob = +'Sintaxis de patrones ligera predeterminada.' +config.doc.regengine.lua = +'Expresiones regulares completas al estilo Lua.' +config.docScriptPath = +'Motor de expresiones regulares usado para coincidir nombres de ámbito de documentación.' config.diagnostics['unused-local'] = 'Habilita el diagnóstico de variables local sin uso.' config.diagnostics['unused-function'] = @@ -423,6 +431,8 @@ config.diagnostics['missing-return-value'] = 'Habilita el diagnóstico para expresiones `return …` sin valores aunque la función que la contiene declare retornos.' config.diagnostics['need-check-nil'] = 'Habilita el diagnóstico para usos de variables si `nil` o un valor opcional (potencialmente `nil`) haya sido asignado a la variable anteriormente.' +config.diagnostics['unnecessary-assert'] = +'Habilita diagnósticos para aserciones redundantes en valores verdaderos.' config.diagnostics['no-unknown'] = 'Habilita el diagnóstico para los casos en que el tipo no puede ser inferido.' config.diagnostics['not-yieldable'] = diff --git a/locale/ja-jp/meta.lua b/locale/ja-jp/meta.lua index e938068dd..9493b9bcd 100644 --- a/locale/ja-jp/meta.lua +++ b/locale/ja-jp/meta.lua @@ -6,66 +6,103 @@ arg = assert = '引数 v が偽(i.e., `nil` または `false`)の場合、エラーを発生させる。それ以外の場合は、すべての引数を返えす。エラーが発生した際、`message` がエラーオブジェクトになる。`message` が指定されていない場合、デフォルトでエラーオブジェクトが `"assertion failed!"` になる。' -cgopt.collect = -'完全なガベージコレクションサイクルを実行する。' -cgopt.stop = -'自動実行を停止する。' -cgopt.restart = -'自動実行を再開する。' -cgopt.count = -'利用されているメモリ量の合計をキロバイト単位で返す。' -cgopt.step = -[[ -ガベージコレクションのステップを実行します。このオプションの後には整数 `size` を付けることができます。 -`size` が正の n の場合、コレクタは n バイトが新たに割り当てられたかのように動作します。`size` が 0 の場合、基本ステップを実行します。 -インクリメンタルモードでは、基本ステップは現在のステップサイズに対応します。世代別モードでは、基本ステップは完全なマイナー収集、 -またはコレクタがインクリメンタルステップを予定している場合はそのインクリメンタルステップを実行します。 -インクリメンタルモードでは、ステップが収集サイクルを完了した場合に `true` を返します。世代別モードでは、ステップがメジャー収集を完了した場合に `true` を返します。 -]] -cgopt.setpause = -'`pause` の値を設定する。' -cgopt.setstepmul = -'`step multiplier` の値を設定する。' -cgopt.incremental = -'モードをインクリメンタルに変更し、以前のモード(`"generational"` または `"incremental"`)を返します。' -cgopt.generational = -'モードを世代別に変更し、以前のモード(`"generational"` または `"incremental"`)を返します。' -cgopt.param = -[[ -コレクタのパラメータの値を変更/取得します。このオプションの後には 1 つまたは 2 つの追加引数が必要です: -対象パラメータ名(文字列)と、オプションの新しい値([0,100000] の範囲の整数)。 -呼び出しは常にそのパラメータの「以前の値」を返します。新しい値が与えられない場合、値は変更されません。Lua はこれらの値を圧縮形式で保存するため、 -返される以前の値は最後に設定された値と完全には一致しない場合があります。 -]] - -gcparam.minormul = -'マイナー乗数。' -gcparam.majorminor = -'メジャー・マイナー乗数。' -gcparam.minormajor = -'マイナー・メジャー乗数。' -gcparam.pause = -'ガベージコレクターの一時停止。' -gcparam.stepmul = -'ステップ乗数。' -gcparam.stepsize = -'ステップサイズ。' - -cgopt.isrunning = -'ガベージコレクションが実行中かどうかを返す。' - -collectgarbage = -[[ -ガベージコレクタへの汎用インターフェース。第1引数 `opt` によって次を実行します: -• `"collect"`: 完全なガベージコレクションサイクルを実行(デフォルト)。 -• `"stop"`: コレクタの自動実行を停止;`"restart"` まで明示的に呼び出したときのみ実行。 -• `"restart"`: コレクタの自動実行を再開。 -• `"count"`: Lua が使用しているメモリ総量を KBytes で返す(小数あり;1024 を掛けるとバイト数)。 -• `"step"`: ガベージコレクションのステップを実行;整数 `size` により動作と戻り値が制御される(`cgopt.step` 参照)。 -• `"isrunning"`: コレクタが実行中かどうか(停止されていないか)を返す。 -• `"incremental"`: インクリメンタルモードに変更し、以前のモードを返す。 -• `"generational"`: 世代別モードに変更し、以前のモードを返す。 -• `"param"`: コレクタのパラメータを変更/取得(`gcparam.*` 参照)。常に以前の値を返す。 +collectgarbage51 = +[[ +この関数はガベージコレクタへの汎用インターフェースです。最初の引数 opt に応じて、さまざまな機能を実行します: + +* `"collect"`:完全なガベージコレクションサイクルを実行します。これがデフォルトオプションです。 +* `"stop"`:ガベージコレクタを停止します。 +* `"restart"`:ガベージコレクタを再起動します。 +* `"count"`:Lua が使用しているメモリの合計(キロバイト単位)を返します。 +* `"step"`:ガベージコレクションステップを実行します。ステップの「サイズ」は arg によって制御されます(より大きな値はより多くのステップを意味します)が、具体的な方法は規定されていません。ステップサイズを制御したい場合は、arg の値を実験的に調整する必要があります。ステップが収集サイクルを完了した場合、true を返します。 +* `"setpause"`:arg をコレクタの一時停止の新しい値として設定します(§2.10 参照)。一時停止の以前の値を返します。 +* `"setstepmul"`:arg をコレクタのステップ乗数の新しい値として設定します(§2.10 参照)。ステップ乗数の以前の値を返します。 +]] + +collectgarbage52 = +[[ +この関数はガベージコレクタへの汎用インターフェースです。最初の引数 opt に応じて、さまざまな機能を実行します: + +* `"collect"`:完全なガベージコレクションサイクルを実行します。これがデフォルトオプションです。 +* `"stop"`:ガベージコレクタの自動実行を停止します。コレクタは明示的に呼び出された場合にのみ実行され、再起動の呼び出しまで続きます。 +* `"restart"`:ガベージコレクタの自動実行を再開します。 +* `"count"`:Lua が使用しているメモリの合計(キロバイト単位)と、メモリの総バイト数を 1024 で割った余りを示す 2 番目の値を返します。最初の値には小数部分があるため、次の等式は常に真です: + ```lua + k, b = collectgarbage("count") + assert(k*1024 == math.floor(k)*1024 + b) + ``` + (Lua が数値に非浮動小数点型でコンパイルされている場合、2 番目の結果が役立ちます。) +* `"step"`:ガベージコレクションステップを実行します。ステップの「サイズ」は arg によって制御されます(より大きな値はより多くのステップを意味します)が、具体的な方法は規定されていません。ステップサイズを制御したい場合は、arg の値を実験的に調整する必要があります。ステップが収集サイクルを完了した場合、true を返します。 +* `"setpause"`:arg をコレクタの一時停止の新しい値として設定します(§2.5 参照)。一時停止の以前の値を返します。 +* `"setstepmul"`:arg をコレクタのステップ乗数の新しい値として設定します(§2.5 参照)。ステップ乗数の以前の値を返します。 +* `"isrunning"`:コレクタが実行中かどうか(つまり、停止されていないか)を示すブール値を返します。 +* `"generational"`:コレクタを世代別モードに変更します。これは実験的な機能です(§2.5 参照)。 +* `"incremental"`:コレクタをインクリメンタルモードに変更します。これがデフォルトモードです。 +]] + +collectgarbage53 = +[[ +この関数はガベージコレクタへの汎用インターフェースです。最初の引数 opt に応じて、さまざまな機能を実行します: + +* `"collect"`:完全なガベージコレクションサイクルを実行します。これがデフォルトオプションです。 +* `"stop"`:ガベージコレクタの自動実行を停止します。コレクタは明示的に呼び出された場合にのみ実行され、再起動の呼び出しまで続きます。 +* `"restart"`:ガベージコレクタの自動実行を再開します。 +* `"count"`:Lua が使用しているメモリの合計をキロバイト単位で返します。値には小数部分があり、1024 を掛けると Lua が使用している正確なバイト数が得られます(オーバーフローを除く)。 +* `"step"`:ガベージコレクションステップを実行します。ステップの「サイズ」は arg によって制御されます。値がゼロの場合、コレクタは 1 つの基本(不可分な)ステップを実行します。ゼロ以外の値の場合、コレクタはその量のメモリ(キロバイト単位)が Lua によって割り当てられたかのように動作します。ステップが収集サイクルを完了した場合、true を返します。 +* `"setpause"`:arg をコレクタの一時停止の新しい値として設定します(§2.5 参照)。一時停止の以前の値を返します。 +* `"setstepmul"`:arg をコレクタのステップ乗数の新しい値として設定します(§2.5 参照)。ステップ乗数の以前の値を返します。 +* "isrunning"`:コレクタが実行中かどうか(つまり、停止されていないか)を示すブール値を返します。 +]] + +collectgarbage54 = +[[ +この関数はガベージコレクタへの汎用インターフェースです。最初の引数 opt に応じて、さまざまな機能を実行します: + +* `"collect"`:完全なガベージコレクションサイクルを実行します。これがデフォルトオプションです。 +* `"stop"`:ガベージコレクタの自動実行を停止します。コレクタは明示的に呼び出された場合にのみ実行され、再起動の呼び出しまで続きます。 +* `"restart"`:ガベージコレクタの自動実行を再開します。 +* `"count"`:Lua が使用しているメモリの合計をキロバイト単位で返します。値には小数部分があり、1024 を掛けると Lua が使用している正確なバイト数が得られます。 +* `"step"`:ガベージコレクションステップを実行します。ステップの「サイズ」は arg によって制御されます。値がゼロの場合、コレクタは 1 つの基本(不可分な)ステップを実行します。ゼロ以外の値の場合、コレクタはその量のメモリ(キロバイト単位)が Lua によって割り当てられたかのように動作します。ステップが収集サイクルを完了した場合、true を返します。 +* `"isrunning"`:コレクタが実行中かどうか(つまり、停止されていないか)を示すブール値を返します。 +* `"incremental"`:コレクタモードをインクリメンタルに変更します。このオプションの後には 3 つの数値を続けることができます:ガベージコレクタの一時停止、ステップ乗数、およびステップサイズ(§2.5.1 参照)。ゼロはその値を変更しないことを意味します。 +* `"generational"`:コレクタモードを世代別に変更します。このオプションの後には 2 つの数値を続けることができます:ガベージコレクタのマイナー乗数とメジャー乗数(§2.5.2 参照)。ゼロはその値を変更しないことを意味します。 +ガベージコレクションとこれらのオプションの一部の詳細については、§2.5 を参照してください。 + +この関数はファイナライザから呼び出すべきではありません。 +]] + +collectgarbage55 = +[[ +この関数はガベージコレクタへの汎用インターフェースです。最初の引数 opt に応じて、さまざまな機能を実行します: + +* `"collect"`:完全なガベージコレクションサイクルを実行します。これがデフォルトオプションです。 +* `"stop"`:ガベージコレクタの自動実行を停止します。コレクタは明示的に呼び出された場合にのみ実行され、再起動の呼び出しまで続きます。 +* `"restart"`:ガベージコレクタの自動実行を再開します。 +* `"count"`:Lua が使用しているメモリの合計をキロバイト単位で返します。値には小数部分があり、1024 を掛けると Lua が使用している正確なバイト数が得られます。 +* `"step"`:ガベージコレクションステップを実行します。このオプションの後には、ステップサイズを示す整数の追加引数を続けることができます。 + + サイズが正の n の場合、コレクタは n 個の新しいバイトが割り当てられたかのように動作します。サイズがゼロの場合、コレクタは基本ステップを実行します。インクリメンタルモードでは、基本ステップは現在のステップサイズに対応します。世代別モードでは、基本ステップは完全なマイナーコレクション、またはコレクタがスケジュールしている場合はインクリメンタルステップを実行します。 + + インクリメンタルモードでは、ステップが収集サイクルを完了した場合、関数は true を返します。世代別モードでは、ステップがメジャーコレクションを完了した場合、関数は true を返します。 + +* `"isrunning"`:コレクタが実行中かどうか(つまり、停止されていないか)を示すブール値を返します。 +* `"incremental"`:コレクタモードをインクリメンタルに変更し、以前のモードを返します。 +* `"generational"`:コレクタモードを世代別に変更し、以前のモードを返します。 +* `"param"`:コレクタのパラメータの値を変更および/または取得します。このオプションの後には、1 つまたは 2 つの追加引数を続ける必要があります:変更または取得されるパラメータの名前(文字列)と、そのパラメータのオプションの新しい値([0,100000] の範囲の整数)。最初の引数は次のいずれかの値である必要があります: + * `"minormul"`:マイナー乗数。 + * `"majorminor"`:メジャー-マイナー乗数。 + * `"minormajor"`:マイナー-メジャー乗数。 + * `"pause"`:ガベージコレクタの一時停止。 + * `"stepmul"`:ステップ乗数。 + * `"stepsize"`:ステップサイズ。 + + 呼び出しは常にパラメータの以前の値を返します。呼び出しが新しい値を提供しない場合、値は変更されません。 + + Lua はこれらの値を圧縮形式で保存するため、以前の値として返される値は、最後に設定された値と完全には一致しない場合があります。 + +ガベージコレクションとこれらのオプションの一部の詳細については、§2.5 を参照してください。 + +この関数はファイナライザから呼び出すべきではありません。 ]] dofile = @@ -681,6 +718,10 @@ string.dump = '指定した関数をバイナリ形式(*バイナリコードブロック*)で表した文字列を返す。' string.find = '文字列の中から `pattern` に最初にマッチした部分を探す(§6.4.1 を参照)。マッチしたものが見つかった場合、マッチした部分の最初と最後のインデックスを返す。見つからなかった場合、`nil` を返す。' +string.find['>5.2'] = +'文字列中で `pattern`(§6.4.1 参照)に最初にマッチする部分を探します。' +string.find['=5.1'] = +'文字列中で `pattern`(§5.4.1 参照)に最初にマッチする部分を探します。' string.format = '第一引数で指定されたフォーマットに沿って、可変数の引数を成形したものを返す。' string.gmatch = @@ -697,6 +738,34 @@ string.gmatch = ]] string.gsub = '文字列 `s` の中の `pattern` にマッチした部分をすべて `repl` に置き換えた文字列を返す(§6.4.1 を参照)。`n` が指定された場合、最初にマッチした `n` 個の部分のみを置き換える。' +string.gmatch['>5.2'] = +[[ +呼び出されるたびに、文字列 `s` の中で `pattern`(§6.4.1 参照)に次にマッチするキャプチャを返すイテレータ関数を返します。 + +例として、次のループは文字列 `s` 内のすべての単語を走査し、1行ずつ出力します: +```lua + s = "hello world from Lua" + for w in string.gmatch(s, "%a+") do + print(w) + end +``` +]] +string.gmatch['=5.1'] = +[[ +呼び出されるたびに、文字列 `s` の中で `pattern`(§5.4.1 参照)に次にマッチするキャプチャを返すイテレータ関数を返します。 + +例として、次のループは文字列 `s` 内のすべての単語を走査し、1行ずつ出力します: +```lua + s = "hello world from Lua" + for w in string.gmatch(s, "%a+") do + print(w) + end +``` +]] +string.gsub['>5.2'] = +'文字列 `s` の中で `pattern`(§6.4.1 参照)にマッチした部分をすべて(または `n` を指定した場合は先頭 `n` 件)`repl` で置き換えた文字列を返します。' +string.gsub['=5.1'] = +'文字列 `s` の中で `pattern`(§5.4.1 参照)にマッチした部分をすべて(または `n` を指定した場合は先頭 `n` 件)`repl` で置き換えた文字列を返します。' string.len = '文字列の長さを返す。' string.lower = @@ -707,6 +776,14 @@ string.pack = '第一引数で指定されたフォーマットに沿って、可変数の引数をバイナリ文字列にシリアライズしたものを返す(§6.4.2 を参照)。' string.packsize = '指定されたフォーマットを用いて`string.pack`によって生成された文字列の長さを返す。フォーマット文字列には可変長オプション `s` または `z` を含めることはできない(§6.4.2 を参照)。' +string.match['>5.2'] = +'文字列中で `pattern`(§6.4.1 参照)に最初にマッチする部分を探します。' +string.match['=5.1'] = +'文字列中で `pattern`(§5.4.1 参照)に最初にマッチする部分を探します。' +string.pack['>5.2'] = +'フォーマット文字列 `fmt`(§6.4.2 参照)に従って値 `v1`, `v2` などをバイナリ文字列としてシリアライズして返します。' +string.packsize['>5.2'] = +'指定したフォーマット `fmt`(§6.4.2 参照)で `string.pack` が生成する文字列のサイズを返します。' string.rep['>5.2'] = '`n` 個の文字列 `s` を文字列 `sep` で区切って連結した文字列を返す。デフォルトの `sep` は空文字列。`n` が正数でない場合は空文字列を返す。' string.rep['<5.1'] = @@ -764,18 +841,18 @@ table.foreachi = ]] table.getn = 'テーブルの長さを返す。`#list` と同等。' -table.new = -- TODO: need translate! -[[This creates a pre-sized table, just like the C API equivalent `lua_createtable()`. This is useful for big tables if the final table size is known and automatic table resizing is too expensive. `narray` parameter specifies the number of array-like items, and `nhash` parameter specifies the number of hash-like items. The function needs to be required before use. +table.new = +[[C API の `lua_createtable()` と同様に、事前サイズ指定のテーブルを作成します。最終サイズが分かっていて自動リサイズがコスト高な大きなテーブルに有効です。`narray` は配列部分の要素数ヒント、`nhash` はハッシュ部分の要素数ヒントです。使用前に require が必要です。 ```lua require("table.new") ``` ]] -table.clear = -- TODO: need translate! -[[This clears all keys and values from a table, but preserves the allocated array/hash sizes. This is useful when a table, which is linked from multiple places, needs to be cleared and/or when recycling a table for use by the same context. This avoids managing backlinks, saves an allocation and the overhead of incremental array/hash part growth. The function needs to be required before use. +table.clear = +[[テーブルの全キーと値を消去しますが、割り当て済みの配列/ハッシュ領域は保持します。複数箇所から参照されるテーブルをクリアする場合や、同じコンテキストで再利用する場合に有用で、バックリンク管理や再割り当て・漸増拡張のオーバーヘッドを避けられます。使用前に require が必要です。 ```lua require("table.clear"). ``` -Please note this function is meant for very specific situations. In most cases it's better to replace the (usually single) link with a new table and let the GC do its work. +この関数はごく限られたケース向けです。多くの場合はリンク先を新しいテーブルに置き換え、GC に任せる方が適切です。 ]] utf8 = diff --git a/locale/ja-jp/script.lua b/locale/ja-jp/script.lua index 36c8265c8..36fc0a741 100644 --- a/locale/ja-jp/script.lua +++ b/locale/ja-jp/script.lua @@ -44,6 +44,13 @@ DIAG_AMBIGUITY_1 = '`{}` は優先的に評価されます。括弧を追加する必要があるかもしれません。' DIAG_LOWERCASE_GLOBAL = '小文字で始まるグローバル変数です。`local` を忘れているか、スペルミスがある可能性があります。' + +ASSIGN_CONST_GLOBAL = +'定数グローバル変数 `{}` に代入できません。' + +VARIABLE_NOT_DECLARED = +'変数 `{}` は宣言されていません(グローバル宣言が有効です)。' + DIAG_EMPTY_BLOCK = '空のコードブロックです。' DIAG_DIAGNOSTICS = @@ -377,6 +384,8 @@ HOVER_DOCUMENT_LUA53 = 'http://www.lua.org/manual/5.3/manual.html#{}' HOVER_DOCUMENT_LUA54 = 'http://www.lua.org/manual/5.4/manual.html#{}' +HOVER_DOCUMENT_LUA55 = +'https://www.lua.org/manual/5.5/manual.html#{}' HOVER_DOCUMENT_LUAJIT = 'http://www.lua.org/manual/5.1/manual.html#{}' HOVER_NATIVE_DOCUMENT_LUA51 = @@ -387,6 +396,8 @@ HOVER_NATIVE_DOCUMENT_LUA53 = 'command:extension.lua.doc?["en-us/53/manual.html/{}"]' HOVER_NATIVE_DOCUMENT_LUA54 = 'command:extension.lua.doc?["en-us/54/manual.html/{}"]' +HOVER_NATIVE_DOCUMENT_LUA55 = +'command:extension.lua.doc?["en-us/55/manual.html/{}"]' HOVER_NATIVE_DOCUMENT_LUAJIT = 'command:extension.lua.doc?["en-us/51/manual.html/{}"]' HOVER_MULTI_PROTOTYPE = @@ -663,6 +674,8 @@ CLI_CHECK_SUCCESS = '診断が完了しました。問題は見つかりませんでした' CLI_CHECK_PROGRESS = '{} ファイルに渡り、{} 個の問題が発見されました' +CLI_CHECK_RESULTS= +'診断が完了しました。{} 個の問題が見つかりました。{} を参照してください' CLI_CHECK_RESULTS_OUTPATH = '診断が完了しました。{} 個の問題が発見されました。詳しくは {} をご確認ください' CLI_CHECK_RESULTS_PRETTY = @@ -677,8 +690,8 @@ CLI_DOC_DONE = 元データ: {} Markdown(例): {} ]] -CLI_DOC_WORKING = -- TODO: need translate! -'Building docs...' +CLI_DOC_WORKING = +'ドキュメントを生成しています...' TYPE_ERROR_ENUM_GLOBAL_DISMATCH = 'タイプ `{child}` は `{parent}` の列挙型に一致しません' diff --git a/locale/ja-jp/setting.lua b/locale/ja-jp/setting.lua index d9d2031ea..250676365 100644 --- a/locale/ja-jp/setting.lua +++ b/locale/ja-jp/setting.lua @@ -1,139 +1,94 @@ ---@diagnostic disable: undefined-global -config.addonManager.enable = -- TODO: need translate! -"Whether the addon manager is enabled or not." -config.addonManager.repositoryBranch = -- TODO: need translate! -"Specifies the git branch used by the addon manager." -config.addonManager.repositoryPath = -- TODO: need translate! -"Specifies the git path used by the addon manager." -config.addonRepositoryPath = -- TODO: need translate! -"Specifies the addon repository path (not related to the addon manager)." -config.runtime.version = -- TODO: need translate! -"Lua runtime version." -config.runtime.path = -- TODO: need translate! +config.addonManager.enable = +"アドオンマネージャーを有効にするかどうか。" +config.addonManager.repositoryBranch = +"アドオンマネージャーが使用するgitブランチを指定します。" +config.addonManager.repositoryPath = +"アドオンマネージャーが使用するgitパスを指定します。" +config.develop.enable = +'開発者モード。パフォーマンスに影響するため有効にしないでください。' +config.develop.debuggerPort = +'デバッガーの待ち受けポート。' +config.develop.debuggerWait = +'デバッガー接続前に停止します。' +config.intelliSense.searchDepth = +'IntelliSenseの検索深度を設定します。この値を上げると精度が上がりますが、パフォーマンスが低下します。ワークスペースごとに適切な値を調整してください。' +config.intelliSense.fastGlobal = +'グローバル変数補完および `_G` ホバー表示を高速化します。型推論の精度がわずかに低下しますが、多数のグローバルを使うプロジェクトでは大きく改善します。' +config.window.statusBar = +'ステータスバーに拡張機能のステータスを表示します。' +config.window.progressBar = +'ステータスバーに進行状況バーを表示します。' +config.hint.enable = +'インレイヒントを有効にします。' +config.hint.paramType = +'関数のパラメータに型ヒントを表示します。' +config.hint.setType = +'代入操作で型ヒントを表示します。' +config.hint.paramName = +'関数呼び出し時にパラメータ名のヒントを表示します。' +config.hint.paramName.All = +'すべての型のパラメータを表示します。' +config.hint.paramName.Literal = +'リテラル型のパラメータのみを表示します。' +config.hint.paramName.Disable = +'パラメータヒントを無効にします。' +config.hint.arrayIndex = +'テーブル構築時に配列インデックスのヒントを表示します。' +config.hint.arrayIndex.Enable = +'すべてのテーブルでヒントを表示します。' +config.hint.arrayIndex.Auto = +'テーブルが3要素を超える、または混在テーブルの場合のみヒントを表示します。' +config.hint.arrayIndex.Disable = +'配列インデックスのヒントを無効にします。' +config.hint.await = +'呼び出す関数に `---@async` が付いている場合、呼び出し箇所で `await` を提案します。' +config.hint.awaitPropagate = +'`await` の伝播を有効にします。`---@async` が付いた関数を呼び出す関数は、自動的に `---@async` とマークされます。' +config.hint.semicolon = +'文末にセミコロンがない場合に仮想セミコロンを表示します。' +config.hint.semicolon.All = +'すべての文で仮想セミコロンを表示します。' +config.hint.semicolon.SameLine = +'同じ行に2つの文がある場合、その間にセミコロンを表示します。' +config.hint.semicolon.Disable = +'仮想セミコロンを無効にします。' +config.codeLens.enable = +'コードレンズを有効にします。' +config.format.enable = +'コードフォーマッタを有効にします。' +config.format.defaultConfig = [[ -When using `require`, how to find the file based on the input name. -Setting this config to `?/init.lua` means that when you enter `require 'myfile'`, `${workspace}/myfile/init.lua` will be searched from the loaded files. -if `runtime.pathStrict` is `false`, `${workspace}/**/myfile/init.lua` will also be searched. -If you want to load files outside the workspace, you need to set `Lua.workspace.library` first. +デフォルトのフォーマット設定。ワークスペース内の`.editorconfig`ファイルより優先度が低くなります。 +[formatter docs](https://github.com/CppCXY/EmmyLuaCodeStyle/tree/master/docs) を参照してください。 ]] -config.runtime.pathStrict = -- TODO: need translate! -'When enabled, `runtime.path` will only search the first level of directories, see the description of `runtime.path`.' -config.runtime.special = -- TODO: need translate! -[[The custom global variables are regarded as some special built-in variables, and the language server will provide special support -The following example shows that 'include' is treated as' require '. -```json -"Lua.runtime.special" : { - "include" : "require" -} -``` -]] -config.runtime.unicodeName = -- TODO: need translate! -"Allows Unicode characters in name." -config.runtime.nonstandardSymbol = -- TODO: need translate! -"Supports non-standard symbols. Make sure that your runtime environment supports these symbols." -config.runtime.plugin = -- TODO: need translate! -"Plugin path. Please read [wiki](https://luals.github.io/wiki/plugins) to learn more." -config.runtime.pluginArgs = -- TODO: need translate! -"Additional arguments for the plugin." -config.runtime.fileEncoding = -- TODO: need translate! -"File encoding. The `ansi` option is only available under the `Windows` platform." -config.runtime.builtin = -- TODO: need translate! -[[ -Adjust the enabled state of the built-in library. You can disable (or redefine) the non-existent library according to the actual runtime environment. - -* `default`: Indicates that the library will be enabled or disabled according to the runtime version -* `enable`: always enable -* `disable`: always disable -]] -config.runtime.meta = -- TODO: need translate! -'Format of the directory name of the meta files.' -config.diagnostics.enable = -- TODO: need translate! -"Enable diagnostics." -config.diagnostics.disable = -- TODO: need translate! -"Disabled diagnostic (Use code in hover brackets)." -config.diagnostics.globals = -- TODO: need translate! -"Defined global variables." -config.diagnostics.globalsRegex = -- TODO: need translate! -"Find defined global variables using regex." -config.diagnostics.severity = -- TODO: need translate! -[[ -Modify the diagnostic severity. - -End with `!` means override the group setting `diagnostics.groupSeverity`. -]] -config.diagnostics.neededFileStatus = -- TODO: need translate! -[[ -* Opened: only diagnose opened files -* Any: diagnose all files -* None: disable this diagnostic - -End with `!` means override the group setting `diagnostics.groupFileStatus`. -]] -config.diagnostics.groupSeverity = -- TODO: need translate! +config.spell.dict = +'スペルチェック用のカスタム単語。' +config.nameStyle.config = [[ -Modify the diagnostic severity in a group. -`Fallback` means that diagnostics in this group are controlled by `diagnostics.severity` separately. -Other settings will override individual settings without end of `!`. +命名スタイル設定。 +[formatter docs](https://github.com/CppCXY/EmmyLuaCodeStyle/tree/master/docs) を参照してください。 ]] -config.diagnostics.groupFileStatus = -- TODO: need translate! +config.telemetry.enable = [[ -Modify the diagnostic needed file status in a group. - -* Opened: only diagnose opened files -* Any: diagnose all files -* None: disable this diagnostic - -`Fallback` means that diagnostics in this group are controlled by `diagnostics.neededFileStatus` separately. -Other settings will override individual settings without end of `!`. +テレメトリを有効にし、エディタ情報とエラーログをネットワーク経由で送信します。プライバシーポリシーは[こちら](https://luals.github.io/privacy/#language-server)。 ]] -config.diagnostics.workspaceEvent = -- TODO: need translate! -"Set the time to trigger workspace diagnostics." -config.diagnostics.workspaceEvent.OnChange = -- TODO: need translate! -"Trigger workspace diagnostics when the file is changed." -config.diagnostics.workspaceEvent.OnSave = -- TODO: need translate! -"Trigger workspace diagnostics when the file is saved." -config.diagnostics.workspaceEvent.None = -- TODO: need translate! -"Disable workspace diagnostics." -config.diagnostics.workspaceDelay = -- TODO: need translate! -"Latency (milliseconds) for workspace diagnostics." -config.diagnostics.workspaceRate = -- TODO: need translate! -"Workspace diagnostics run rate (%). Decreasing this value reduces CPU usage, but also reduces the speed of workspace diagnostics. The diagnosis of the file you are currently editing is always done at full speed and is not affected by this setting." -config.diagnostics.libraryFiles = -- TODO: need translate! -"How to diagnose files loaded via `Lua.workspace.library`." -config.diagnostics.libraryFiles.Enable = -- TODO: need translate! -"Always diagnose these files." -config.diagnostics.libraryFiles.Opened = -- TODO: need translate! -"Only when these files are opened will it be diagnosed." -config.diagnostics.libraryFiles.Disable = -- TODO: need translate! -"These files are not diagnosed." -config.diagnostics.ignoredFiles = -- TODO: need translate! -"How to diagnose ignored files." -config.diagnostics.ignoredFiles.Enable = -- TODO: need translate! -"Always diagnose these files." -config.diagnostics.ignoredFiles.Opened = -- TODO: need translate! -"Only when these files are opened will it be diagnosed." -config.diagnostics.ignoredFiles.Disable = -- TODO: need translate! -"These files are not diagnosed." -config.diagnostics.disableScheme = -- TODO: need translate! -'Do not diagnose Lua files that use the following scheme.' -config.diagnostics.unusedLocalExclude = -- TODO: need translate! -'Do not diagnose `unused-local` when the variable name matches the following pattern.' -config.workspace.ignoreDir = -- TODO: need translate! -"Ignored files and directories (Use `.gitignore` grammar)."-- .. example.ignoreDir, -config.workspace.ignoreSubmodules = -- TODO: need translate! -"Ignore submodules." -config.workspace.useGitIgnore = -- TODO: need translate! -"Ignore files list in `.gitignore` ." -config.workspace.maxPreload = -- TODO: need translate! -"Max preloaded files." -config.workspace.preloadFileSize = -- TODO: need translate! -"Skip files larger than this value (KB) when preloading." -config.workspace.library = -- TODO: need translate! -"In addition to the current workspace, which directories will load files from. The files in these directories will be treated as externally provided code libraries, and some features (such as renaming fields) will not modify these files." -config.workspace.checkThirdParty = -- TODO: need translate! +config.misc.parameters = +'VSCode で言語サーバーを起動するときの[コマンドライン引数](https://github.com/LuaLS/lua-telemetry-server/tree/master/method)。' +config.misc.executablePath = +'VSCodeでの実行可能ファイルのパスを指定します。' +config.language.fixIndent = +'(VSCodeのみ) 誤った自動インデントを修正します。例えば、"function" を含む文字列内で改行したときの不正なインデントなど。' +config.language.completeAnnotation = +'(VSCodeのみ) 注釈行の改行後に自動で "---@ " を挿入します。' +config.workspace.preloadFileSize = +"プリロード時にこの値(KB)より大きいファイルをスキップします。" +config.workspace.library = +"現在のワークスペースに加えて、どのディレクトリからファイルをロードするか。これらのディレクトリ内のファイルは外部提供のコードライブラリとして扱われ、一部の機能(フィールド名の変更など)はこれらのファイルを変更しません。" +config.workspace.checkThirdParty = [[ -Automatic detection and adaptation of third-party libraries, currently supported libraries are: +サードパーティライブラリの自動検出と適応。現在サポートされているライブラリ: * OpenResty * Cocos4.0 @@ -142,339 +97,264 @@ Automatic detection and adaptation of third-party libraries, currently supported * skynet * Jass ]] -config.workspace.userThirdParty = -- TODO: need translate! -'Add private third-party library configuration file paths here, please refer to the built-in [configuration file path](https://github.com/LuaLS/lua-language-server/tree/master/meta/3rd)' -config.workspace.supportScheme = -- TODO: need translate! -'Provide language server for the Lua files of the following scheme.' -config.completion.enable = -- TODO: need translate! -'Enable completion.' -config.completion.callSnippet = -- TODO: need translate! -'Shows function call snippets.' -config.completion.callSnippet.Disable = -- TODO: need translate! -"Only shows `function name`." -config.completion.callSnippet.Both = -- TODO: need translate! -"Shows `function name` and `call snippet`." -config.completion.callSnippet.Replace = -- TODO: need translate! -"Only shows `call snippet.`" -config.completion.keywordSnippet = -- TODO: need translate! -'Shows keyword syntax snippets.' -config.completion.keywordSnippet.Disable = -- TODO: need translate! -"Only shows `keyword`." -config.completion.keywordSnippet.Both = -- TODO: need translate! -"Shows `keyword` and `syntax snippet`." -config.completion.keywordSnippet.Replace = -- TODO: need translate! -"Only shows `syntax snippet`." -config.completion.displayContext = -- TODO: need translate! -"Previewing the relevant code snippet of the suggestion may help you understand the usage of the suggestion. The number set indicates the number of intercepted lines in the code fragment. If it is set to `0`, this feature can be disabled." -config.completion.workspaceWord = -- TODO: need translate! -"Whether the displayed context word contains the content of other files in the workspace." -config.completion.showWord = -- TODO: need translate! -"Show contextual words in suggestions." -config.completion.showWord.Enable = -- TODO: need translate! -"Always show context words in suggestions." -config.completion.showWord.Fallback = -- TODO: need translate! -"Contextual words are only displayed when suggestions based on semantics cannot be provided." -config.completion.showWord.Disable = -- TODO: need translate! -"Do not display context words." -config.completion.autoRequire = -- TODO: need translate! -"When the input looks like a file name, automatically `require` this file." -config.completion.showParams = -- TODO: need translate! -"Display parameters in completion list. When the function has multiple definitions, they will be displayed separately." -config.completion.requireSeparator = -- TODO: need translate! -"The separator used when `require`." -config.completion.postfix = -- TODO: need translate! -"The symbol used to trigger the postfix suggestion." -config.color.mode = -- TODO: need translate! -"Color mode." -config.color.mode.Semantic = -- TODO: need translate! -"Semantic color. You may need to set `editor.semanticHighlighting.enabled` to `true` to take effect." -config.color.mode.SemanticEnhanced = -- TODO: need translate! -"Enhanced semantic color. Like `Semantic`, but with additional analysis which might be more computationally expensive." -config.color.mode.Grammar = -- TODO: need translate! -"Grammar color." -config.semantic.enable = -- TODO: need translate! -"Enable semantic color. You may need to set `editor.semanticHighlighting.enabled` to `true` to take effect." -config.semantic.variable = -- TODO: need translate! -"Semantic coloring of variables/fields/parameters." -config.semantic.annotation = -- TODO: need translate! -"Semantic coloring of type annotations." -config.semantic.keyword = -- TODO: need translate! -"Semantic coloring of keywords/literals/operators. You only need to enable this feature if your editor cannot do syntax coloring." -config.signatureHelp.enable = -- TODO: need translate! -"Enable signature help." -config.hover.enable = -- TODO: need translate! -"Enable hover." -config.hover.viewString = -- TODO: need translate! -"Hover to view the contents of a string (only if the literal contains an escape character)." -config.hover.viewStringMax = -- TODO: need translate! -"The maximum length of a hover to view the contents of a string." -config.hover.viewNumber = -- TODO: need translate! -"Hover to view numeric content (only if literal is not decimal)." -config.hover.fieldInfer = -- TODO: need translate! -"When hovering to view a table, type infer will be performed for each field. When the accumulated time of type infer reaches the set value (MS), the type infer of subsequent fields will be skipped." -config.hover.previewFields = -- TODO: need translate! -"When hovering to view a table, limits the maximum number of previews for fields." -config.hover.enumsLimit = -- TODO: need translate! -"When the value corresponds to multiple types, limit the number of types displaying." -config.hover.expandAlias = -- TODO: need translate! -[[ -Whether to expand the alias. For example, expands `---@alias myType boolean|number` appears as `boolean|number`, otherwise it appears as `myType'. -]] -config.develop.enable = -- TODO: need translate! -'Developer mode. Do not enable, performance will be affected.' -config.develop.debuggerPort = -- TODO: need translate! -'Listen port of debugger.' -config.develop.debuggerWait = -- TODO: need translate! -'Suspend before debugger connects.' -config.intelliSense.searchDepth = -- TODO: need translate! -'Set the search depth for IntelliSense. Increasing this value increases accuracy, but decreases performance. Different workspace have different tolerance for this setting. Please adjust it to the appropriate value.' -config.intelliSense.fastGlobal = -- TODO: need translate! -'In the global variable completion, and view `_G` suspension prompt. This will slightly reduce the accuracy of type speculation, but it will have a significant performance improvement for projects that use a lot of global variables.' -config.window.statusBar = -- TODO: need translate! -'Show extension status in status bar.' -config.window.progressBar = -- TODO: need translate! -'Show progress bar in status bar.' -config.hint.enable = -- TODO: need translate! -'Enable inlay hint.' -config.hint.paramType = -- TODO: need translate! -'Show type hints at the parameter of the function.' -config.hint.setType = -- TODO: need translate! -'Show hints of type at assignment operation.' -config.hint.paramName = -- TODO: need translate! -'Show hints of parameter name at the function call.' -config.hint.paramName.All = -- TODO: need translate! -'All types of parameters are shown.' -config.hint.paramName.Literal = -- TODO: need translate! -'Only literal type parameters are shown.' -config.hint.paramName.Disable = -- TODO: need translate! -'Disable parameter hints.' -config.hint.arrayIndex = -- TODO: need translate! -'Show hints of array index when constructing a table.' -config.hint.arrayIndex.Enable = -- TODO: need translate! -'Show hints in all tables.' -config.hint.arrayIndex.Auto = -- TODO: need translate! -'Show hints only when the table is greater than 3 items, or the table is a mixed table.' -config.hint.arrayIndex.Disable = -- TODO: need translate! -'Disable hints of array index.' -config.hint.await = -- TODO: need translate! -'If the called function is marked `---@async`, prompt `await` at the call.' -config.hint.awaitPropagate = -- TODO: need translate! -'Enable the propagation of `await`. When a function calls a function marked `---@async`,\z -it will be automatically marked as `---@async`.' -config.hint.semicolon = -- TODO: need translate! -'If there is no semicolon at the end of the statement, display a virtual semicolon.' -config.hint.semicolon.All = -- TODO: need translate! -'All statements display virtual semicolons.' -config.hint.semicolon.SameLine = -- TODO: need translate! -'When two statements are on the same line, display a semicolon between them.' -config.hint.semicolon.Disable = -- TODO: need translate! -'Disable virtual semicolons.' -config.codeLens.enable = -- TODO: need translate! -'Enable code lens.' -config.format.enable = -- TODO: need translate! -'Enable code formatter.' -config.format.defaultConfig = -- TODO: need translate! -[[ -The default format configuration. Has a lower priority than `.editorconfig` file in the workspace. -Read [formatter docs](https://github.com/CppCXY/EmmyLuaCodeStyle/tree/master/docs) to learn usage. -]] -config.spell.dict = -- TODO: need translate! -'Custom words for spell checking.' -config.nameStyle.config = -- TODO: need translate! -[[ -Set name style config. -Read [formatter docs](https://github.com/CppCXY/EmmyLuaCodeStyle/tree/master/docs) to learn usage. -]] -config.telemetry.enable = -- TODO: need translate! +config.workspace.userThirdParty = +'プライベートサードパーティライブラリの設定ファイルパスをここに追加してください。組み込みの[設定ファイルパス](https://github.com/LuaLS/lua-language-server/tree/master/meta/3rd)を参照してください。' +config.workspace.supportScheme = +'次のスキームのLuaファイルに言語サーバーを提供します。' +config.completion.enable = +'補完を有効にします。' +config.completion.callSnippet = +'関数呼び出しスニペットを表示します。' +config.completion.callSnippet.Disable = +"関数名のみを表示します。" +config.completion.callSnippet.Both = +"関数名と呼び出しスニペットを表示します。" +config.completion.callSnippet.Replace = +"呼び出しスニペットのみを表示します。" +config.completion.keywordSnippet = +'キーワード構文スニペットを表示します。' +config.completion.keywordSnippet.Disable = +"キーワードのみを表示します。" +config.completion.keywordSnippet.Both = +"キーワードと構文スニペットを表示します。" +config.completion.keywordSnippet.Replace = +"構文スニペットのみを表示します。" +config.completion.displayContext = +"提案の関連コードスニペットをプレビューすることで、提案の使用法を理解しやすくなります。設定された数値は、コードフラグメント内で切り取られる行数を示します。`0`に設定すると、この機能を無効にできます。" +config.completion.workspaceWord = +"表示されるコンテキストワードにワークスペース内の他のファイルの内容を含めるかどうか。" +config.completion.showWord = +"提案内にコンテキストワードを表示します。" +config.completion.showWord.Enable = +"常に提案内にコンテキストワードを表示します。" +config.completion.showWord.Fallback = +"セマンティックスに基づく提案を提供できない場合のみ、コンテキストワードを表示します。" +config.completion.showWord.Disable = +"コンテキストワードを表示しません。" +config.completion.autoRequire = +"入力がファイル名のように見える場合、自動的にこのファイルを`require`します。" +config.completion.maxSuggestCount = +"補完用に分析するフィールドの最大数。オブジェクトがこの制限より多くのフィールドを持つ場合、補完が表示されるにはより具体的な入力が必要になります。" +config.completion.showParams = +"補完リストにパラメータを表示します。関数に複数の定義がある場合、個別に表示されます。" +config.completion.requireSeparator = +"`require`時に使用される区切り文字。" +config.completion.postfix = +"後置提案をトリガーするために使用されるシンボル。" +config.color.mode = +"カラーモード。" +config.color.mode.Semantic = +"セマンティックカラー。効果を発揮するために`editor.semanticHighlighting.enabled`を`true`に設定する必要があるかもしれません。" +config.color.mode.SemanticEnhanced = +"強化されたセマンティックカラー。`Semantic`に似ていますが、追加の分析が行われるため、計算コストが高くなる可能性があります。" +config.color.mode.Grammar = +"文法カラー。" +config.semantic.enable = +"セマンティックカラーを有効にします。効果を発揮するために`editor.semanticHighlighting.enabled`を`true`に設定する必要があるかもしれません。" +config.semantic.variable = +"変数/フィールド/パラメータのセマンティックカラーリング。" +config.semantic.annotation = +"型注釈のセマンティックカラーリング。" +config.semantic.keyword = +"キーワード/リテラル/演算子のセマンティックカラーリング。エディタが構文カラーリングをできない場合のみ、この機能を有効にする必要があります。" +config.signatureHelp.enable = +"シグネチャヘルプを有効にします。" +config.hover.enable = +"ホバーを有効にします。" +config.hover.viewString = +"ホバーで文字列の内容を表示します(リテラルにエスケープ文字が含まれている場合のみ)。" +config.hover.viewStringMax = +"ホバーで表示する文字列内容の最大長。" +config.hover.viewNumber = +"ホバーで数値内容を表示します(リテラルが10進数でない場合のみ)。" +config.hover.fieldInfer = +"テーブルをホバーで表示する際、各フィールドに対して型推論が実行されます。型推論の累積時間が設定値(ミリ秒)に達すると、後続のフィールドの型推論はスキップされます。" +config.hover.previewFields = +"テーブルをホバーで表示する際、フィールドのプレビューの最大数を制限します。" +config.hover.enumsLimit = +"値が複数の型に対応する場合、表示される型の数を制限します。" +config.hover.expandAlias = [[ -Enable telemetry to send your editor information and error logs over the network. Read our privacy policy [here](https://luals.github.io/privacy/#language-server). +エイリアスを展開するかどうか。たとえば、`---@alias myType boolean|number`を展開すると`boolean|number`として表示され、そうでない場合は`myType`として表示されます。 ]] -config.misc.parameters = -- TODO: need translate! -'[Command line parameters](https://github.com/LuaLS/lua-telemetry-server/tree/master/method) when starting the language server in VSCode.' -config.misc.executablePath = -- TODO: need translate! -'Specify the executable path in VSCode.' -config.language.fixIndent = -- TODO: need translate! -'(VSCode only) Fix incorrect auto-indentation, such as incorrect indentation when line breaks occur within a string containing the word "function."' -config.language.completeAnnotation = -- TODO: need translate! -'(VSCode only) Automatically insert "---@ " after a line break following a annotation.' -config.type.castNumberToInteger = -- TODO: need translate! -'Allowed to assign the `number` type to the `integer` type.' -config.type.weakUnionCheck = -- TODO: need translate! +config.type.castNumberToInteger = +'`number` 型を `integer` 型に代入することを許可します。' +config.type.weakUnionCheck = [[ -Once one subtype of a union type meets the condition, the union type also meets the condition. +共用体型のどれか1つのサブタイプが条件を満たせば、共用体全体も条件を満たします。 -When this setting is `false`, the `number|boolean` type cannot be assigned to the `number` type. It can be with `true`. +この設定が`false`の場合、`number|boolean`型は`number`型に代入できません。`true`の場合は可能です。 ]] -config.type.weakNilCheck = -- TODO: need translate! +config.type.weakNilCheck = [[ -When checking the type of union type, ignore the `nil` in it. +共用体型のチェック時に、その中の`nil`を無視します。 -When this setting is `false`, the `number|nil` type cannot be assigned to the `number` type. It can be with `true`. +この設定が`false`の場合、`number|nil`型は`number`型に代入できません。`true`の場合は可能です。 ]] -config.type.inferParamType = -- TODO: need translate! +config.type.inferParamType = [[ -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. +この設定が`false`の場合、注釈がないパラメータの型は`any`になります。 ]] -config.type.checkTableShape = -- TODO: need translate! +config.type.checkTableShape = [[ -Strictly check the shape of the table. +テーブルの形状を厳密にチェックします。 ]] -config.type.inferTableSize = -- TODO: need translate! -'Maximum number of table fields analyzed during type inference.' -config.doc.privateName = -- TODO: need translate! -'Treat specific field names as private, e.g. `m_*` means `XXX.m_id` and `XXX.m_type` are private, witch can only be accessed in the class where the definition is located.' -config.doc.protectedName = -- TODO: need translate! -'Treat specific field names as protected, e.g. `m_*` means `XXX.m_id` and `XXX.m_type` are protected, witch can only be accessed in the class where the definition is located and its subclasses.' -config.doc.packageName = -- TODO: need translate! -'Treat specific field names as package, e.g. `m_*` means `XXX.m_id` and `XXX.m_type` are package, witch can only be accessed in the file where the definition is located.' -config.doc.regengine = -- TODO: need translate! -'The regular expression engine used for matching documentation scope names.' -config.doc.regengine.glob = -- TODO: need translate! -'The default lightweight pattern syntax.' -config.doc.regengine.lua = -- TODO: need translate! -'Full Lua-style regular expressions.' -config.docScriptPath = -- TODO: need translate! -'The regular expression engine used for matching documentation scope names.' -config.diagnostics['unused-local'] = -- TODO: need translate! -'Enable unused local variable diagnostics.' -config.diagnostics['unused-function'] = -- TODO: need translate! -'Enable unused function diagnostics.' -config.diagnostics['undefined-global'] = -- TODO: need translate! -'Enable undefined global variable diagnostics.' -config.diagnostics['global-in-nil-env'] = -- TODO: need translate! -'Enable cannot use global variables ( `_ENV` is set to `nil`) diagnostics.' -config.diagnostics['unused-label'] = -- TODO: need translate! -'Enable unused label diagnostics.' -config.diagnostics['unused-vararg'] = -- TODO: need translate! -'Enable unused vararg diagnostics.' -config.diagnostics['trailing-space'] = -- TODO: need translate! -'Enable trailing space diagnostics.' -config.diagnostics['redefined-local'] = -- TODO: need translate! -'Enable redefined local variable diagnostics.' -config.diagnostics['newline-call'] = -- TODO: need translate! -'Enable newline call diagnostics. Is\'s raised when a line starting with `(` is encountered, which is syntactically parsed as a function call on the previous line.' -config.diagnostics['newfield-call'] = -- TODO: need translate! -'Enable newfield call diagnostics. It is raised when the parenthesis of a function call appear on the following line when defining a field in a table.' -config.diagnostics['redundant-parameter'] = -- TODO: need translate! -'Enable redundant function parameter diagnostics.' -config.diagnostics['ambiguity-1'] = -- TODO: need translate! -'Enable ambiguous operator precedence diagnostics. For example, the `num or 0 + 1` expression will be suggested `(num or 0) + 1` instead.' -config.diagnostics['lowercase-global'] = -- TODO: need translate! -'Enable lowercase global variable definition diagnostics.' -config.diagnostics['undefined-env-child'] = -- TODO: need translate! -'Enable undefined environment variable diagnostics. It\'s raised when `_ENV` table is set to a new literal table, but the used global variable is no longer present in the global environment.' -config.diagnostics['duplicate-index'] = -- TODO: need translate! -'Enable duplicate table index diagnostics.' -config.diagnostics['empty-block'] = -- TODO: need translate! -'Enable empty code block diagnostics.' -config.diagnostics['redundant-value'] = -- TODO: need translate! -'Enable the redundant values assigned diagnostics. It\'s raised during assignment operation, when the number of values is higher than the number of objects being assigned.' -config.diagnostics['assign-type-mismatch'] = -- TODO: need translate! -'Enable diagnostics for assignments in which the value\'s type does not match the type of the assigned variable.' -config.diagnostics['await-in-sync'] = -- TODO: need translate! -'Enable diagnostics for calls of asynchronous functions within a synchronous function.' -config.diagnostics['cast-local-type'] = -- TODO: need translate! -'Enable diagnostics for casts of local variables where the target type does not match the defined type.' -config.diagnostics['cast-type-mismatch'] = -- TODO: need translate! -'Enable diagnostics for casts where the target type does not match the initial type.' -config.diagnostics['circular-doc-class'] = -- TODO: need translate! -'Enable diagnostics for two classes inheriting from each other introducing a circular relation.' -config.diagnostics['close-non-object'] = -- TODO: need translate! -'Enable diagnostics for attempts to close a variable with a non-object.' -config.diagnostics['code-after-break'] = -- TODO: need translate! -'Enable diagnostics for code placed after a break statement in a loop.' -config.diagnostics['codestyle-check'] = -- TODO: need translate! -'Enable diagnostics for incorrectly styled lines.' -config.diagnostics['count-down-loop'] = -- TODO: need translate! -'Enable diagnostics for `for` loops which will never reach their max/limit because the loop is incrementing instead of decrementing.' -config.diagnostics['deprecated'] = -- TODO: need translate! -'Enable diagnostics to highlight deprecated API.' -config.diagnostics['different-requires'] = -- TODO: need translate! -'Enable diagnostics for files which are required by two different paths.' -config.diagnostics['discard-returns'] = -- TODO: need translate! -'Enable diagnostics for calls of functions annotated with `---@nodiscard` where the return values are ignored.' -config.diagnostics['doc-field-no-class'] = -- TODO: need translate! -'Enable diagnostics to highlight a field annotation without a defining class annotation.' -config.diagnostics['duplicate-doc-alias'] = -- TODO: need translate! -'Enable diagnostics for a duplicated alias annotation name.' -config.diagnostics['duplicate-doc-field'] = -- TODO: need translate! -'Enable diagnostics for a duplicated field annotation name.' -config.diagnostics['duplicate-doc-param'] = -- TODO: need translate! -'Enable diagnostics for a duplicated param annotation name.' -config.diagnostics['duplicate-set-field'] = -- TODO: need translate! -'Enable diagnostics for setting the same field in a class more than once.' -config.diagnostics['incomplete-signature-doc'] = -- TODO: need translate! -'Incomplete @param or @return annotations for functions.' -config.diagnostics['invisible'] = -- TODO: need translate! -'Enable diagnostics for accesses to fields which are invisible.' -config.diagnostics['missing-global-doc'] = -- TODO: need translate! -'Missing annotations for globals! Global functions must have a comment and annotations for all parameters and return values.' -config.diagnostics['missing-local-export-doc'] = -- TODO: need translate! -'Missing annotations for exported locals! Exported local functions must have a comment and annotations for all parameters and return values.' -config.diagnostics['missing-parameter'] = -- TODO: need translate! -'Enable diagnostics for function calls where the number of arguments is less than the number of annotated function parameters.' -config.diagnostics['missing-return'] = -- TODO: need translate! -'Enable diagnostics for functions with return annotations which have no return statement.' -config.diagnostics['missing-return-value'] = -- TODO: need translate! -'Enable diagnostics for return statements without values although the containing function declares returns.' -config.diagnostics['need-check-nil'] = -- TODO: need translate! -'Enable diagnostics for variable usages if `nil` or an optional (potentially `nil`) value was assigned to the variable before.' -config.diagnostics['unnecessary-assert'] = -- TODO: need translate! -'Enable diagnostics for redundant assertions on truthy values.' -config.diagnostics['no-unknown'] = -- TODO: need translate! -'Enable diagnostics for cases in which the type cannot be inferred.' -config.diagnostics['not-yieldable'] = -- TODO: need translate! -'Enable diagnostics for calls to `coroutine.yield()` when it is not permitted.' -config.diagnostics['param-type-mismatch'] = -- TODO: need translate! -'Enable diagnostics for function calls where the type of a provided parameter does not match the type of the annotated function definition.' -config.diagnostics['redundant-return'] = -- TODO: need translate! -'Enable diagnostics for return statements which are not needed because the function would exit on its own.' -config.diagnostics['redundant-return-value']= -- TODO: need translate! -'Enable diagnostics for return statements which return an extra value which is not specified by a return annotation.' -config.diagnostics['return-type-mismatch'] = -- TODO: need translate! -'Enable diagnostics for return values whose type does not match the type declared in the corresponding return annotation.' -config.diagnostics['spell-check'] = -- TODO: need translate! -'Enable diagnostics for typos in strings.' -config.diagnostics['name-style-check'] = -- TODO: need translate! -'Enable diagnostics for name style.' -config.diagnostics['unbalanced-assignments']= -- TODO: need translate! -'Enable diagnostics on multiple assignments if not all variables obtain a value (e.g., `local x,y = 1`).' -config.diagnostics['undefined-doc-class'] = -- TODO: need translate! -'Enable diagnostics for class annotations in which an undefined class is referenced.' -config.diagnostics['undefined-doc-name'] = -- TODO: need translate! -'Enable diagnostics for type annotations referencing an undefined type or alias.' -config.diagnostics['undefined-doc-param'] = -- TODO: need translate! -'Enable diagnostics for cases in which a parameter annotation is given without declaring the parameter in the function definition.' -config.diagnostics['undefined-field'] = -- TODO: need translate! -'Enable diagnostics for cases in which an undefined field of a variable is read.' -config.diagnostics['unknown-cast-variable'] = -- TODO: need translate! -'Enable diagnostics for casts of undefined variables.' -config.diagnostics['unknown-diag-code'] = -- TODO: need translate! -'Enable diagnostics in cases in which an unknown diagnostics code is entered.' -config.diagnostics['unknown-operator'] = -- TODO: need translate! -'Enable diagnostics for unknown operators.' -config.diagnostics['unreachable-code'] = -- TODO: need translate! -'Enable diagnostics for unreachable code.' -config.diagnostics['global-element'] = -- TODO: need translate! -'Enable diagnostics to warn about global elements.' -config.typeFormat.config = -- TODO: need translate! -'Configures the formatting behavior while typing Lua code.' -config.typeFormat.config.auto_complete_end = -- TODO: need translate! -'Controls if `end` is automatically completed at suitable positions.' -config.typeFormat.config.auto_complete_table_sep = -- TODO: need translate! -'Controls if a separator is automatically appended at the end of a table declaration.' -config.typeFormat.config.format_line = -- TODO: need translate! -'Controls if a line is formatted at all.' +config.type.inferTableSize = +'型推論時に解析するテーブルフィールドの最大数。' +config.doc.privateName = +'特定のフィールド名をプライベートとして扱います。例: `m_*` は `XXX.m_id` や `XXX.m_type` がプライベートであり、定義されているクラス内でのみアクセス可能です。' +config.doc.protectedName = +'特定のフィールド名をプロテクトとして扱います。例: `m_*` は `XXX.m_id` や `XXX.m_type` がプロテクトであり、定義クラスおよびそのサブクラスでのみアクセス可能です。' +config.doc.packageName = +'特定のフィールド名をパッケージとして扱います。例: `m_*` は `XXX.m_id` や `XXX.m_type` がパッケージであり、定義されているファイル内でのみアクセス可能です。' +config.doc.regengine = +'ドキュメントスコープ名のマッチに使用する正規表現エンジン。' +config.doc.regengine.glob = +'デフォルトの軽量パターン構文。' +config.doc.regengine.lua = +'Luaスタイルの正規表現(フル機能)。' +config.docScriptPath = +'ドキュメントスコープ名のマッチに使用する正規表現エンジン。' +config.diagnostics['unused-local'] = +'未使用のローカル変数の診断を有効にします。' +config.diagnostics['unused-function'] = +'未使用の関数の診断を有効にします。' +config.diagnostics['undefined-global'] = +'未定義のグローバル変数の診断を有効にします。' +config.diagnostics['global-in-nil-env'] = +'グローバル変数を使用できない(`_ENV` が `nil`)場合の診断を有効にします。' +config.diagnostics['unused-label'] = +'未使用ラベルの診断を有効にします。' +config.diagnostics['unused-vararg'] = +'未使用の可変引数の診断を有効にします。' +config.diagnostics['trailing-space'] = +'行末の余分な空白の診断を有効にします。' +config.diagnostics['redefined-local'] = +'ローカル変数の再定義診断を有効にします。' +config.diagnostics['newline-call'] = +'改行呼び出しの診断を有効にします。`(` で始まる行が前の行への関数呼び出しとして構文解析される場合に発生します。' +config.diagnostics['newfield-call'] = +'newfield 呼び出しの診断を有効にします。テーブル定義中に関数呼び出しの括弧が次の行に現れる場合に発生します。' +config.diagnostics['redundant-parameter'] = +'冗長な関数パラメータの診断を有効にします。' +config.diagnostics['ambiguity-1'] = +'演算子優先順位のあいまいさ診断を有効にします。例: `num or 0 + 1` には `(num or 0) + 1` を推奨します。' +config.diagnostics['lowercase-global'] = +'先頭小文字のグローバル変数定義の診断を有効にします。' +config.diagnostics['undefined-env-child'] = +'未定義環境変数の診断を有効にします。`_ENV` を新しいリテラルテーブルに設定した結果、使用中のグローバルが存在しない場合に発生します。' +config.diagnostics['duplicate-index'] = +'重複したテーブルインデックスの診断を有効にします。' +config.diagnostics['empty-block'] = +'空のコードブロック診断を有効にします。' +config.diagnostics['redundant-value'] = +'代入時の余分な値の診断を有効にします。値の数が変数の数を超える場合に発生します。' +config.diagnostics['assign-type-mismatch'] = +'値の型が代入先の型と一致しない代入の診断を有効にします。' +config.diagnostics['await-in-sync'] = +'同期関数内で非同期関数を呼び出す場合の診断を有効にします。' +config.diagnostics['cast-local-type'] = +'ローカル変数のキャスト先の型が定義と一致しない場合の診断を有効にします。' +config.diagnostics['cast-type-mismatch'] = +'キャスト先の型が元の型と一致しない場合の診断を有効にします。' +config.diagnostics['circular-doc-class'] = +'クラス同士が継承し合う循環関係の診断を有効にします。' +config.diagnostics['close-non-object'] = +'オブジェクト以外を閉じようとする場合の診断を有効にします。' +config.diagnostics['code-after-break'] = +'ループ内で`break`の後に配置されたコードの診断を有効にします。' +config.diagnostics['codestyle-check'] = +'スタイルに合わない行の診断を有効にします。' +config.diagnostics['count-down-loop'] = +'減少しないため上限に到達しない `for` ループの診断を有効にします。' +config.diagnostics['deprecated'] = +'非推奨APIを強調する診断を有効にします。' +config.diagnostics['different-requires'] = +'異なるパスで同じファイルをrequireする場合の診断を有効にします。' +config.diagnostics['discard-returns'] = +'`---@nodiscard` が付いた関数の戻り値を無視した呼び出しの診断を有効にします。' +config.diagnostics['doc-field-no-class'] = +'クラス注釈なしでフィールド注釈がある場合の診断を有効にします。' +config.diagnostics['duplicate-doc-alias'] = +'エイリアス注釈名の重複診断を有効にします。' +config.diagnostics['duplicate-doc-field'] = +'フィールド注釈名の重複診断を有効にします。' +config.diagnostics['duplicate-doc-param'] = +'パラメータ注釈名の重複診断を有効にします。' +config.diagnostics['duplicate-set-field'] = +'クラス内で同じフィールドを複数回設定する診断を有効にします。' +config.diagnostics['incomplete-signature-doc'] = +'関数の @param または @return 注釈が不完全な場合の診断。' +config.diagnostics['invisible'] = +'不可視フィールドへのアクセス診断を有効にします。' +config.diagnostics['missing-global-doc'] = +'グローバル関数の注釈不足の診断。コメントと全パラメータ・戻り値の注釈が必要です。' +config.diagnostics['missing-local-export-doc'] = +'エクスポートされたローカル関数の注釈不足の診断。' +config.diagnostics['missing-parameter'] = +'注釈パラメータ数より少ない引数で関数を呼び出した場合の診断を有効にします。' +config.diagnostics['missing-return'] = +'戻り注釈があるのにreturn文がない場合の診断を有効にします。' +config.diagnostics['missing-return-value'] = +'戻り値を宣言しているのに値を返さないreturn文の診断を有効にします。' +config.diagnostics['need-check-nil'] = +'以前に`nil`または任意型が代入された変数を使用する際のnilチェック診断を有効にします。' +config.diagnostics['unnecessary-assert'] = +'真値に対する冗長なassertの診断を有効にします。' +config.diagnostics['no-unknown'] = +'型を推論できない場合の診断を有効にします。' +config.diagnostics['not-yieldable'] = +'許可されない場所での`coroutine.yield()`呼び出しの診断を有効にします。' +config.diagnostics['param-type-mismatch'] = +'注釈の型と一致しない引数を渡した場合の診断を有効にします。' +config.diagnostics['redundant-return'] = +'不要なreturn文の診断を有効にします。' +config.diagnostics['redundant-return-value']= +'注釈にない追加の戻り値を返すreturn文の診断を有効にします。' +config.diagnostics['return-type-mismatch'] = +'戻り値の型が注釈と一致しない場合の診断を有効にします。' +config.diagnostics['spell-check'] = +'文字列内のタイポ診断を有効にします。' +config.diagnostics['name-style-check'] = +'名前スタイルの診断を有効にします。' +config.diagnostics['unbalanced-assignments']= +'多重代入で一部の変数が値を得られない場合の診断を有効にします(例: `local x,y = 1`)。' +config.diagnostics['undefined-doc-class'] = +'未定義クラスを参照するクラス注釈の診断を有効にします。' +config.diagnostics['undefined-doc-name'] = +'未定義の型またはエイリアスを参照する注釈の診断を有効にします。' +config.diagnostics['undefined-doc-param'] = +'関数定義に存在しないパラメータへの注釈の診断を有効にします。' +config.diagnostics['undefined-field'] = +'未定義フィールドを参照する場合の診断を有効にします。' +config.diagnostics['unknown-cast-variable'] = +'未定義変数へのキャスト診断を有効にします。' +config.diagnostics['unknown-diag-code'] = +'不明な診断コードが入力された場合の診断を有効にします。' +config.diagnostics['unknown-operator'] = +'不明な演算子の診断を有効にします。' +config.diagnostics['unreachable-code'] = +'到達不能コードの診断を有効にします。' +config.diagnostics['global-element'] = +'グローバル要素に関する警告診断を有効にします。' +config.typeFormat.config = +'Luaコード入力中のフォーマット動作を設定します。' +config.typeFormat.config.auto_complete_end = +'適切な位置で`end`を自動補完するかを制御します。' +config.typeFormat.config.auto_complete_table_sep = +'テーブル宣言末尾にセパレータを自動付与するかを制御します。' +config.typeFormat.config.format_line = +'行を自動整形するかどうかを制御します。' -command.exportDocument = -- TODO: need translate! -'Lua: Export Document ...' -command.addon_manager.open = -- TODO: need translate! -'Lua: Open Addon Manager ...' -command.reloadFFIMeta = -- TODO: need translate! -'Lua: Reload luajit ffi meta' -command.startServer = -- TODO: need translate! -'Lua: Restart Language Server' -command.stopServer = -- TODO: need translate! -'Lua: Stop Language Server' +command.exportDocument = +'Lua: ドキュメントをエクスポート...' +command.addon_manager.open = +'Lua: アドオンマネージャーを開く...' +command.reloadFFIMeta = +'Lua: luajit ffi メタを再読み込み' +command.startServer = +'Lua: 言語サーバーを再起動' +command.stopServer = +'Lua: 言語サーバーを停止' diff --git a/locale/pt-br/meta.lua b/locale/pt-br/meta.lua index 3d185402b..7aa064675 100644 --- a/locale/pt-br/meta.lua +++ b/locale/pt-br/meta.lua @@ -6,66 +6,103 @@ arg = assert = 'Emite um erro se o valor de seu argumento v for falso (i.e., `nil` ou `false`); caso contrário, devolve todos os seus argumentos. Em caso de erro, `message` é o objeto de erro que, quando ausente, por padrão é `"assertion failed!"`' -cgopt.collect = -'Realiza um ciclo completo de coleta de lixo (i.e., garbage-collection cycle).' -cgopt.stop = -'Interrompe a execução automática.' -cgopt.restart = -'Reinicia a execução automática.' -cgopt.count = -'Retorna, em Kbytes, a quantidade total de memória utilizada pela linguagem Lua.' -cgopt.step = -[[ -Executa um passo do coletor de lixo. Esta opção pode ser seguida por um inteiro `size`. -Se `size` for um n positivo, o coletor age como se n novos bytes tivessem sido alocados; se `size` for zero, o coletor executa um passo básico. -No modo incremental, um passo básico corresponde ao tamanho de passo atual; no modo geracional, um passo básico executa uma coleta menor completa, -ou um passo incremental, se o coletor tiver agendado um. -No modo incremental, a função retorna `true` se o passo terminou um ciclo de coleta; no modo geracional, retorna `true` se o passo terminou uma coleta maior. -]] -cgopt.setpause = -'Estabelece pausa. Defina via `arg` o intervalo de pausa do coletor de lixo (i.e., garbage-collection).' -cgopt.setstepmul = -'Estabelece um multiplicador para etapa de coleta de lixo (i.e., garbage-collection). Defina via `arg` o valor multiplicador.' -cgopt.incremental = -'Altera o modo do coletor para incremental e retorna o modo anterior (ou `"generational"` ou `"incremental"`).' -cgopt.generational = -'Altera o modo do coletor para geracional e retorna o modo anterior (ou `"generational"` ou `"incremental"`).' -cgopt.param = -[[ -Altera e/ou recupera os valores de um parâmetro do coletor. Esta opção deve ser seguida por um ou dois argumentos extras: -o nome do parâmetro (uma string) e um novo valor opcional (um inteiro no intervalo [0,100000]). -A chamada sempre retorna o valor anterior do parâmetro; se nenhum novo valor for dado, o valor permanece inalterado. -O Lua armazena esses valores em um formato compactado, portanto o valor retornado como anterior pode não ser exatamente o último valor definido. -]] - -gcparam.minormul = -'O multiplicador menor.' -gcparam.majorminor = -'O multiplicador maior-menor.' -gcparam.minormajor = -'O multiplicador menor-maior.' -gcparam.pause = -'A pausa do coletor de lixo.' -gcparam.stepmul = -'O multiplicador de passo.' -gcparam.stepsize = -'O tamanho do passo.' - -cgopt.isrunning = -'Retorna um valor booleano indicando se o coletor de lixo (i.e., garbage-collection) está em execução.' - -collectgarbage = -[[ -Interface genérica para o coletor de lixo. De acordo com o primeiro argumento `opt`, executa: -• `"collect"`: Executa um ciclo completo de coleta de lixo (opção padrão). -• `"stop"`: Para a execução automática; o coletor só roda quando invocado explicitamente, até `"restart"`. -• `"restart"`: Reinicia a execução automática. -• `"count"`: Retorna a memória total usada pelo Lua em Kbytes (fracionário; multiplique por 1024 para bytes). -• `"step"`: Executa um passo de coleta; inteiro opcional `size` controla comportamento e retorno (veja `cgopt.step`). -• `"isrunning"`: Retorna se o coletor está rodando (ou seja, não parado). -• `"incremental"`: Altera para modo incremental e retorna o modo anterior. -• `"generational"`: Altera para modo geracional e retorna o modo anterior. -• `"param"`: Altera/lê parâmetros do coletor (veja `gcparam.*`), sempre retorna o valor anterior. +collectgarbage51 = +[[ +Esta função é uma interface genérica para o coletor de lixo. Ela executa diferentes funções de acordo com seu primeiro argumento, opt: + +* `"collect"`: executa um ciclo completo de coleta de lixo. Esta é a opção padrão. +* `"stop"`: para o coletor de lixo. +* `"restart"`: reinicia o coletor de lixo. +* `"count"`: retorna a memória total em uso pelo Lua (em Kbytes). +* `"step"`: executa uma etapa de coleta de lixo. O "tamanho" da etapa é controlado por arg (valores maiores significam mais etapas) de uma maneira não especificada. Se você quiser controlar o tamanho da etapa, deve ajustar experimentalmente o valor de arg. Retorna true se a etapa terminou um ciclo de coleta. +* `"setpause"`: define arg como o novo valor para a pausa do coletor (ver §2.10). Retorna o valor anterior da pausa. +* `"setstepmul"`: define arg como o novo valor para o multiplicador de etapa do coletor (ver §2.10). Retorna o valor anterior do multiplicador de etapa. +]] + +collectgarbage52 = +[[ +Esta função é uma interface genérica para o coletor de lixo. Ela executa diferentes funções de acordo com seu primeiro argumento, opt: + +* `"collect"`: executa um ciclo completo de coleta de lixo. Esta é a opção padrão. +* `"stop"`: para a execução automática do coletor de lixo. O coletor só será executado quando invocado explicitamente, até uma chamada para reiniciá-lo. +* `"restart"`: reinicia a execução automática do coletor de lixo. +* `"count"`: retorna a memória total em uso pelo Lua (em Kbytes) e um segundo valor com a memória total em bytes módulo 1024. O primeiro valor tem uma parte fracionária, então a seguinte igualdade é sempre verdadeira: + ```lua + k, b = collectgarbage("count") + assert(k*1024 == math.floor(k)*1024 + b) + ``` + (O segundo resultado é útil quando Lua é compilado com um tipo não flutuante para números.) +* `"step"`: executa uma etapa de coleta de lixo. O "tamanho" da etapa é controlado por arg (valores maiores significam mais etapas) de uma maneira não especificada. Se você quiser controlar o tamanho da etapa, deve ajustar experimentalmente o valor de arg. Retorna true se a etapa terminou um ciclo de coleta. +* `"setpause"`: define arg como o novo valor para a pausa do coletor (ver §2.5). Retorna o valor anterior da pausa. +* `"setstepmul"`: define arg como o novo valor para o multiplicador de etapa do coletor (ver §2.5). Retorna o valor anterior do multiplicador de etapa. +* `"isrunning"`: retorna um booleano que indica se o coletor está em execução (ou seja, não parado). +* `"generational"`: muda o coletor para o modo geracional. Este é um recurso experimental (ver §2.5). +* `"incremental"`: muda o coletor para o modo incremental. Este é o modo padrão. +]] + +collectgarbage53 = +[[ +Esta função é uma interface genérica para o coletor de lixo. Ela executa diferentes funções de acordo com seu primeiro argumento, opt: + +* `"collect"`: executa um ciclo completo de coleta de lixo. Esta é a opção padrão. +* `"stop"`: para a execução automática do coletor de lixo. O coletor só será executado quando invocado explicitamente, até uma chamada para reiniciá-lo. +* `"restart"`: reinicia a execução automática do coletor de lixo. +* `"count"`: retorna a memória total em uso pelo Lua em Kbytes. O valor tem uma parte fracionária, de modo que multiplicado por 1024 fornece o número exato de bytes em uso pelo Lua (exceto por estouros). +* `"step"`: executa uma etapa de coleta de lixo. O "tamanho" da etapa é controlado por arg. Com um valor zero, o coletor executará uma etapa básica (indivisível). Para valores diferentes de zero, o coletor se comportará como se essa quantidade de memória (em KBytes) tivesse sido alocada pelo Lua. Retorna true se a etapa terminou um ciclo de coleta. +* `"setpause"`: define arg como o novo valor para a pausa do coletor (ver §2.5). Retorna o valor anterior da pausa. +* `"setstepmul"`: define arg como o novo valor para o multiplicador de etapa do coletor (ver §2.5). Retorna o valor anterior do multiplicador de etapa. +* "isrunning"`: retorna um booleano que indica se o coletor está em execução (ou seja, não parado). +]] + +collectgarbage54 = +[[ +Esta função é uma interface genérica para o coletor de lixo. Ela executa diferentes funções de acordo com seu primeiro argumento, opt: + +* `"collect"`: Executa um ciclo completo de coleta de lixo. Esta é a opção padrão. +* `"stop"`: Para a execução automática do coletor de lixo. O coletor só será executado quando invocado explicitamente, até uma chamada para reiniciá-lo. +* `"restart"`: Reinicia a execução automática do coletor de lixo. +* `"count"`: Retorna a memória total em uso pelo Lua em Kbytes. O valor tem uma parte fracionária, de modo que multiplicado por 1024 fornece o número exato de bytes em uso pelo Lua. +* `"step"`: Executa uma etapa de coleta de lixo. O "tamanho" da etapa é controlado por arg. Com um valor zero, o coletor executará uma etapa básica (indivisível). Para valores diferentes de zero, o coletor se comportará como se essa quantidade de memória (em Kbytes) tivesse sido alocada pelo Lua. Retorna true se a etapa terminou um ciclo de coleta. +* `"isrunning"`: Retorna um booleano que indica se o coletor está em execução (ou seja, não parado). +* `"incremental"`: Muda o modo do coletor para incremental. Esta opção pode ser seguida por três números: a pausa do coletor de lixo, o multiplicador de etapa e o tamanho da etapa (ver §2.5.1). Um zero significa não alterar esse valor. +* `"generational"`: Muda o modo do coletor para geracional. Esta opção pode ser seguida por dois números: o multiplicador menor do coletor de lixo e o multiplicador maior (ver §2.5.2). Um zero significa não alterar esse valor. +Veja §2.5 para mais detalhes sobre coleta de lixo e algumas dessas opções. + +Esta função não deve ser chamada por um finalizador. +]] + +collectgarbage55 = +[[ +Esta função é uma interface genérica para o coletor de lixo. Ela executa diferentes funções de acordo com seu primeiro argumento, opt: + +* `"collect"`: Executa um ciclo completo de coleta de lixo. Esta é a opção padrão. +* `"stop"`: Para a execução automática do coletor de lixo. O coletor só será executado quando invocado explicitamente, até uma chamada para reiniciá-lo. +* `"restart"`: Reinicia a execução automática do coletor de lixo. +* `"count"`: Retorna a memória total em uso pelo Lua em Kbytes. O valor tem uma parte fracionária, de modo que multiplicado por 1024 fornece o número exato de bytes em uso pelo Lua. +* `"step"`: Executa uma etapa de coleta de lixo. Esta opção pode ser seguida por um argumento extra, um inteiro com o tamanho da etapa. + + Se o tamanho for um n positivo, o coletor age como se n novos bytes tivessem sido alocados. Se o tamanho for zero, o coletor executa uma etapa básica. No modo incremental, uma etapa básica corresponde ao tamanho de etapa atual. No modo geracional, uma etapa básica executa uma coleta menor completa ou uma etapa incremental, se o coletor tiver agendado uma. + + No modo incremental, a função retorna true se a etapa terminou um ciclo de coleta. No modo geracional, a função retorna true se a etapa terminou uma coleta maior. + +* `"isrunning"`: Retorna um booleano que indica se o coletor está em execução (ou seja, não parado). +* `"incremental"`: Muda o modo do coletor para incremental e retorna o modo anterior. +* `"generational"`: Muda o modo do coletor para geracional e retorna o modo anterior. +* `"param"`: Altera e/ou recupera os valores de um parâmetro do coletor. Esta opção deve ser seguida por um ou dois argumentos extras: O nome do parâmetro sendo alterado ou recuperado (uma string) e um novo valor opcional para esse parâmetro, um inteiro no intervalo [0,100000]. O primeiro argumento deve ter um dos seguintes valores: + * `"minormul"`: O multiplicador menor. + * `"majorminor"`: O multiplicador maior-menor. + * `"minormajor"`: O multiplicador menor-maior. + * `"pause"`: A pausa do coletor de lixo. + * `"stepmul"`: O multiplicador de etapa. + * `"stepsize"`: O tamanho da etapa. + + A chamada sempre retorna o valor anterior do parâmetro. Se a chamada não fornecer um novo valor, o valor permanece inalterado. + + Lua armazena esses valores em um formato compactado, então, o valor retornado como o valor anterior pode não ser exatamente o último valor definido. + +Veja §2.5 para mais detalhes sobre coleta de lixo e algumas dessas opções. + +Esta função não deve ser chamada por um finalizador. ]] dofile = @@ -687,6 +724,10 @@ string.dump = 'Retorna uma string contendo uma representação binária (i.e., *binary chunk*) da função dada.' string.find = 'Procura a primeira correspondencia de `pattern` (veja §6.4.1) na string.' +string.find['>5.2'] = +'Procura a primeira correspondência de `pattern` (veja §6.4.1) na string.' +string.find['=5.1'] = +'Procura a primeira correspondência de `pattern` (veja §5.4.1) na string.' string.format = 'Retorna uma versão formatada de seu número variável de argumentos após a descrição dada em seu primeiro argumento.' string.gmatch = @@ -704,6 +745,36 @@ Por exemplo, o loop a seguir irá iterar em todas as palavras da string *s*, imp ]] string.gsub = 'Retorna uma cópia da *s* em que todas ou, caso fornecido, as primeiras `n` ocorrências de `pattern` (veja §6.4.1) que tiverem sido substituídas por uma string de substituição especificada por `repl`.' +string.gmatch['>5.2'] = +[[ +Retorna uma função iteradora que, a cada vez que é chamada, retorna as próximas capturas de `pattern` (veja §6.4.1) sobre a string s. + +Por exemplo, o loop a seguir irá iterar em todas as palavras da string s, imprimindo cada palavra por linha: +```lua + s = +"hello world from Lua" + for w in string.gmatch(s, "%a+") do + print(w) + end +``` +]] +string.gmatch['=5.1'] = +[[ +Retorna uma função iteradora que, a cada vez que é chamada, retorna as próximas capturas de `pattern` (veja §5.4.1) sobre a string s. + +Por exemplo, o loop a seguir irá iterar em todas as palavras da string s, imprimindo cada palavra por linha: +```lua + s = +"hello world from Lua" + for w in string.gmatch(s, "%a+") do + print(w) + end +``` +]] +string.gsub['>5.2'] = +'Retorna uma cópia de s em que todas ou, caso fornecido, as primeiras `n` ocorrências de `pattern` (veja §6.4.1) que tiverem sido substituídas por uma string de substituição especificada por `repl`.' +string.gsub['=5.1'] = +'Retorna uma cópia de s em que todas ou, caso fornecido, as primeiras `n` ocorrências de `pattern` (veja §5.4.1) que tiverem sido substituídas por uma string de substituição especificada por `repl`.' string.len = 'Retorna o comprimento da string.' string.lower = @@ -714,6 +785,14 @@ string.pack = 'Retorna uma string binária contendo os valores `V1`, `v2`, etc. empacotados (isto é, serializado de forma binário) de acordo com o formato da string `fmt` fornecida (veja §6.4.2).' string.packsize = 'Retorna o tamanho de uma string resultante de `string.pack` com o formato da string `fmt` fornecida (veja §6.4.2).' +string.match['>5.2'] = +'Procura a primeira ocorrência do `pattern` (veja §6.4.1) na string.' +string.match['=5.1'] = +'Procura a primeira ocorrência do `pattern` (veja §5.4.1) na string.' +string.pack['>5.2'] = +'Retorna uma string binária contendo os valores `v1`, `v2`, etc. empacotados (isto é, serializados em formato binário) de acordo com a string de formato `fmt` (veja §6.4.2).' +string.packsize['>5.2'] = +'Retorna o tamanho de uma string resultante de `string.pack` com a string de formato `fmt` fornecida (veja §6.4.2).' string.rep['>5.2'] = 'Retorna uma string que é a concatenação de `n` cópias da string `s` separadas pela string `sep`.' string.rep['<5.1'] = @@ -760,24 +839,24 @@ Retorna os elementos da lista fornecida. Esta função é equivalente a ``` Por padrão, `i` é `1` e `j` é `#list`. ]] -table.foreach = -- TODO: need translate! -'Executes the given f over all elements of table. For each element, f is called with the index and respective value as arguments. If f returns a non-nil value, then the loop is broken, and this value is returned as the final value of foreach.' -table.foreachi = -- TODO: need translate! -'Executes the given f over the numerical indices of table. For each index, f is called with the index and respective value as arguments. Indices are visited in sequential order, from 1 to n, where n is the size of the table. If f returns a non-nil value, then the loop is broken and this value is returned as the result of foreachi.' -table.getn = -- TODO: need translate! -'Returns the number of elements in the table. This function is equivalent to `#list`.' -table.new = -- TODO: need translate! -[[This creates a pre-sized table, just like the C API equivalent `lua_createtable()`. This is useful for big tables if the final table size is known and automatic table resizing is too expensive. `narray` parameter specifies the number of array-like items, and `nhash` parameter specifies the number of hash-like items. The function needs to be required before use. +table.foreach = +'Executa a função f fornecida sobre todos os elementos da tabela. Para cada elemento, f é chamada com o índice e o valor respectivo como argumentos. Se f retornar um valor não-nil, o loop é interrompido e esse valor é retornado como valor final de foreach.' +table.foreachi = +'Executa a função f fornecida sobre os índices numéricos da tabela. Para cada índice, f é chamada com o índice e o valor respectivo como argumentos. Índices são visitados em ordem sequencial, de 1 a n, onde n é o tamanho da tabela. Se f retornar um valor não-nil, o loop é interrompido e esse valor é retornado como resultado de foreachi.' +table.getn = +'Retorna o número de elementos na tabela. Esta função é equivalente a `#list`.' +table.new = +[[Cria uma tabela pré-dimensionada, assim como o equivalente da C API `lua_createtable()`. É útil para tabelas grandes se o tamanho final for conhecido e o redimensionamento automático for muito custoso. O parâmetro `narray` especifica o número de itens tipo array, e o parâmetro `nhash` especifica o número de itens tipo hash. A função precisa ser requerida antes do uso. ```lua require("table.new") ``` ]] -table.clear = -- TODO: need translate! -[[This clears all keys and values from a table, but preserves the allocated array/hash sizes. This is useful when a table, which is linked from multiple places, needs to be cleared and/or when recycling a table for use by the same context. This avoids managing backlinks, saves an allocation and the overhead of incremental array/hash part growth. The function needs to be required before use. +table.clear = +[[Limpa todas as chaves e valores de uma tabela, mas preserva os tamanhos alocados das partes array/hash. É útil quando uma tabela, que está vinculada de vários lugares, precisa ser limpa e/ou quando se recicla uma tabela para uso pelo mesmo contexto. Evita gerenciar backlinks, economiza uma alocação e o custo de crescimento incremental das partes array/hash. A função precisa ser requerida antes do uso. ```lua require("table.clear"). ``` -Please note this function is meant for very specific situations. In most cases it's better to replace the (usually single) link with a new table and let the GC do its work. +Observe que esta função é destinada a situações muito específicas. Na maioria dos casos, é melhor substituir o link (único geralmente) por uma nova tabela e deixar o GC fazer seu trabalho. ]] utf8 = diff --git a/locale/pt-br/script.lua b/locale/pt-br/script.lua index 64fbf40f9..ada7e398a 100644 --- a/locale/pt-br/script.lua +++ b/locale/pt-br/script.lua @@ -44,6 +44,13 @@ DIAG_AMBIGUITY_1 = 'Calcule primeiro `{}`. Você pode precisar adicionar colchetes.' DIAG_LOWERCASE_GLOBAL = 'Variável global com inicial minúscula, você esqueceu o `local` ou digitou errado?' + +ASSIGN_CONST_GLOBAL = +'Não é possível atribuir à variável global `{}`.' + +VARIABLE_NOT_DECLARED = +'Variável `{}` não declarada (declarações globais ativas).' + DIAG_EMPTY_BLOCK = 'Bloco vazio.' DIAG_DIAGNOSTICS = @@ -104,8 +111,8 @@ DIAG_CIRCLE_DOC_CLASS = 'Classes com herança cíclica.' DIAG_DOC_FIELD_NO_CLASS = 'O campo deve ser definido após a classe.' -DIAG_DUPLICATE_DOC_ALIAS = -- TODO: need translate! -'Duplicate defined alias `{}`.' +DIAG_DUPLICATE_DOC_ALIAS = +'Alias `{}` definido de forma duplicada.' DIAG_DUPLICATE_DOC_FIELD = 'Campos definidos duplicados `{}`.' DIAG_DUPLICATE_DOC_PARAM = @@ -116,68 +123,68 @@ DIAG_UNDEFINED_DOC_NAME = 'Tipo ou alias indefinido `{}`.' DIAG_UNDEFINED_DOC_PARAM = 'Parâmetro indefinido `{}`.' -DIAG_MISSING_GLOBAL_DOC_COMMENT = -- TODO: need translate! -'Missing comment for global function `{}`.' -DIAG_MISSING_GLOBAL_DOC_PARAM = -- TODO: need translate! -'Missing @param annotation for parameter `{}` in global function `{}`.' -DIAG_MISSING_GLOBAL_DOC_RETURN = -- TODO: need translate! -'Missing @return annotation at index `{}` in global function `{}`.' -DIAG_MISSING_LOCAL_EXPORT_DOC_COMMENT = -- TODO: need translate! -'Missing comment for exported local function `{}`.' -DIAG_MISSING_LOCAL_EXPORT_DOC_PARAM = -- TODO: need translate! -'Missing @param annotation for parameter `{}` in exported local function `{}`.' -DIAG_MISSING_LOCAL_EXPORT_DOC_RETURN = -- TODO: need translate! -'Missing @return annotation at index `{}` in exported local function `{}`.' -DIAG_INCOMPLETE_SIGNATURE_DOC_PARAM = -- TODO: need translate! -'Incomplete signature. Missing @param annotation for parameter `{}`.' -DIAG_INCOMPLETE_SIGNATURE_DOC_RETURN = -- TODO: need translate! -'Incomplete signature. Missing @return annotation at index `{}`.' -DIAG_UNKNOWN_DIAG_CODE = -- TODO: need translate! +DIAG_MISSING_GLOBAL_DOC_COMMENT = +'Comentário ausente para função global `{}`.' +DIAG_MISSING_GLOBAL_DOC_PARAM = +'Anotação @param ausente para parâmetro `{}` na função global `{}`.' +DIAG_MISSING_GLOBAL_DOC_RETURN = +'Anotação @return ausente no índice `{}` na função global `{}`.' +DIAG_MISSING_LOCAL_EXPORT_DOC_COMMENT = +'Comentário ausente para função local exportada `{}`.' +DIAG_MISSING_LOCAL_EXPORT_DOC_PARAM = +'Anotação @param ausente para parâmetro `{}` na função local exportada `{}`.' +DIAG_MISSING_LOCAL_EXPORT_DOC_RETURN = +'Anotação @return ausente no índice `{}` na função local exportada `{}`.' +DIAG_INCOMPLETE_SIGNATURE_DOC_PARAM = +'Assinatura incompleta. Anotação @param ausente para parâmetro `{}`.' +DIAG_INCOMPLETE_SIGNATURE_DOC_RETURN = +'Assinatura incompleta. Anotação @return ausente no índice `{}`.' +DIAG_UNKNOWN_DIAG_CODE = 'Código de diagnóstico desconhecido `{}`.' -DIAG_CAST_LOCAL_TYPE = -- TODO: need translate! -'This variable is defined as type `{def}`. Cannot convert its type to `{ref}`.' -DIAG_CAST_FIELD_TYPE = -- TODO: need translate! -'This field is defined as type `{def}`. Cannot convert its type to `{ref}`.' -DIAG_ASSIGN_TYPE_MISMATCH = -- TODO: need translate! -'Cannot assign `{ref}` to `{def}`.' -DIAG_PARAM_TYPE_MISMATCH = -- TODO: need translate! -'Cannot assign `{ref}` to parameter `{def}`.' -DIAG_UNKNOWN_CAST_VARIABLE = -- TODO: need translate! -'Unknown type conversion variable `{}`.' -DIAG_CAST_TYPE_MISMATCH = -- TODO: need translate! -'Cannot convert `{ref}` to `{def}`。' -DIAG_MISSING_RETURN_VALUE = -- TODO: need translate! -'At least {min} return values are required, but here only {rmax} values are returned.' -DIAG_MISSING_RETURN_VALUE_RANGE = -- TODO: need translate! -'At least {min} return values are required, but here only {rmin} to {rmax} values are returned.' -DIAG_REDUNDANT_RETURN_VALUE = -- TODO: need translate! -'At most {max} values returned, but the {rmax}th value was returned here.' -DIAG_REDUNDANT_RETURN_VALUE_RANGE = -- TODO: need translate! -'At most {max} values returned, but {rmin}th to {rmax}th values were returned here.' -DIAG_MISSING_RETURN = -- TODO: need translate! -'Return value is required here.' -DIAG_RETURN_TYPE_MISMATCH = -- TODO: need translate! -'The type of the {index} return value is `{def}`, but the actual return is `{ref}`.\n{err}' -DIAG_UNKNOWN_OPERATOR = -- TODO: need translate! -'Unknown operator `{}`.' -DIAG_UNREACHABLE_CODE = -- TODO: need translate! -'Unreachable code.' -DIAG_INVISIBLE_PRIVATE = -- TODO: need translate! -'Field `{field}` is private, it can only be accessed in class `{class}`.' -DIAG_INVISIBLE_PROTECTED = -- TODO: need translate! -'Field `{field}` is protected, it can only be accessed in class `{class}` and its subclasses.' -DIAG_INVISIBLE_PACKAGE = -- TODO: need translate! -'Field `{field}` can only be accessed in same file `{uri}`.' -DIAG_GLOBAL_ELEMENT = -- TODO: need translate! -'Element is global.' -DIAG_MISSING_FIELDS = -- TODO: need translate! -'Missing required fields in type `{1}`: {2}' -DIAG_INJECT_FIELD = -- TODO: need translate! -'Fields cannot be injected into the reference of `{class}` for `{field}`. {fix}' -DIAG_INJECT_FIELD_FIX_CLASS = -- TODO: need translate! -'To do so, use `---@class` for `{node}`.' -DIAG_INJECT_FIELD_FIX_TABLE = -- TODO: need translate! -'如要允许注入,请在定义中添加 `{fix}` 。' +DIAG_CAST_LOCAL_TYPE = +'Esta variável é definida como tipo `{def}`. Não é possível converter seu tipo para `{ref}`.' +DIAG_CAST_FIELD_TYPE = +'Este campo é definido como tipo `{def}`. Não é possível converter seu tipo para `{ref}`.' +DIAG_ASSIGN_TYPE_MISMATCH = +'Não é possível atribuir `{ref}` a `{def}`.' +DIAG_PARAM_TYPE_MISMATCH = +'Não é possível atribuir `{ref}` ao parâmetro `{def}`.' +DIAG_UNKNOWN_CAST_VARIABLE = +'Variável de conversão de tipo desconhecida `{}`.' +DIAG_CAST_TYPE_MISMATCH = +'Não é possível converter `{ref}` para `{def}`。' +DIAG_MISSING_RETURN_VALUE = +'Pelo menos {min} valores de retorno são necessários, mas aqui apenas {rmax} valores são retornados.' +DIAG_MISSING_RETURN_VALUE_RANGE = +'Pelo menos {min} valores de retorno são necessários, mas aqui apenas {rmin} a {rmax} valores são retornados.' +DIAG_REDUNDANT_RETURN_VALUE = +'No máximo {max} valores retornados, mas o {rmax}º valor foi retornado aqui.' +DIAG_REDUNDANT_RETURN_VALUE_RANGE = +'No máximo {max} valores retornados, mas {rmin}º a {rmax}º valores foram retornados aqui.' +DIAG_MISSING_RETURN = +'Valor de retorno é necessário aqui.' +DIAG_RETURN_TYPE_MISMATCH = +'O tipo do {index}º valor de retorno é `{def}`, mas o retorno real é `{ref}`.\n{err}' +DIAG_UNKNOWN_OPERATOR = +'Operador desconhecido `{}`.' +DIAG_UNREACHABLE_CODE = +'Código inalcançável.' +DIAG_INVISIBLE_PRIVATE = +'Campo `{field}` é privado, pode ser acessado apenas na classe `{class}`.' +DIAG_INVISIBLE_PROTECTED = +'Campo `{field}` é protegido, pode ser acessado apenas na classe `{class}` e suas subclasses.' +DIAG_INVISIBLE_PACKAGE = +'Campo `{field}` pode ser acessado apenas no mesmo arquivo `{uri}`.' +DIAG_GLOBAL_ELEMENT = +'Elemento é global.' +DIAG_MISSING_FIELDS = +'Campos obrigatórios ausentes no tipo `{1}`: {2}' +DIAG_INJECT_FIELD = +'Campos não podem ser injetados na referência de `{class}` para `{field}`. {fix}' +DIAG_INJECT_FIELD_FIX_CLASS = +'Para fazer isso, use `---@class` para `{node}`.' +DIAG_INJECT_FIELD_FIX_TABLE = +'Para permitir injeção, adicione `{fix}` na definição.' MWS_NOT_SUPPORT = '{} não é suportado múltiplos espaços de trabalho por enquanto, posso precisar reiniciar para estabelecer um novo espaço de trabalho ...' @@ -206,8 +213,8 @@ WORKSPACE_SKIP_HUGE_FILE = 'Por motivos de desempenho, a análise deste arquivo foi interrompida: {}' WORKSPACE_NOT_ALLOWED = 'Seu espaço de trabalho foi definido para `{}`. Servidor da linguagem Lua recusou o carregamneto neste diretório. Por favor, cheque sua configuração. [aprenda mais aqui](https://luals.github.io/wiki/faq#why-is-the-server-scanning-the-wrong-folder)' -WORKSPACE_SCAN_TOO_MUCH = -- TODO: need translate! -'Mais do que {} arquivos foram escaneados. O diretório atual escaneado é `{}`. Please see the [FAQ](https://luals.github.io/wiki/faq#how-can-i-improve-startup-speeds) to see how you can include fewer files. It is also possible that your [configuration is incorrect](https://luals.github.io/wiki/faq#why-is-the-server-scanning-the-wrong-folder).' +WORKSPACE_SCAN_TOO_MUCH = +'Mais de {} arquivos foram escaneados. O diretório atual escaneado é `{}`. Por favor, veja o [FAQ](https://luals.github.io/wiki/faq#how-can-i-improve-startup-speeds) para saber como incluir menos arquivos. Também é possível que sua [configuração esteja incorreta](https://luals.github.io/wiki/faq#why-is-the-server-scanning-the-wrong-folder).' PARSER_CRASH = 'Parser quebrou! Últimas palavras: {}' @@ -309,14 +316,14 @@ PARSER_INDEX_IN_FUNC_NAME = 'A forma `[name]` não pode ser usada em nome de uma função nomeada.' PARSER_UNKNOWN_ATTRIBUTE = 'Atributo local deve ser `const` ou `close`' -PARSER_AMBIGUOUS_SYNTAX = -- TODO: need translate! -'In Lua 5.1, the left brackets called by the function must be in the same line as the function.' -PARSER_NEED_PAREN = -- TODO: need translate! -'需要添加一对括号。' -PARSER_NESTING_LONG_MARK = -- TODO: need translate! -'Nesting of `[[...]]` is not allowed in Lua 5.1 .' -PARSER_LOCAL_LIMIT = -- TODO: need translate! -'Only 200 active local variables and upvalues can be existed at the same time.' +PARSER_AMBIGUOUS_SYNTAX = +'Em Lua 5.1, os colchetes esquerdos chamados pela função devem estar na mesma linha da função.' +PARSER_NEED_PAREN = +'É necessário adicionar um par de parênteses.' +PARSER_NESTING_LONG_MARK = +'Aninhamento de `[[...]]` não é permitido em Lua 5.1.' +PARSER_LOCAL_LIMIT = +'Apenas 200 variáveis locais ativas e upvalues podem existir ao mesmo tempo.' PARSER_VARIABLE_NOT_DECLARED = 'Variável `{name}` não foi declarada. (Use `global *` para permitir variáveis indefinidas, ou declare com `global {name}`)' PARSER_ENV_IS_GLOBAL = @@ -377,6 +384,8 @@ HOVER_DOCUMENT_LUA53 = 'http://www.lua.org/manual/5.3/manual.html#{}' HOVER_DOCUMENT_LUA54 = 'http://www.lua.org/manual/5.4/manual.html#{}' +HOVER_DOCUMENT_LUA55 = +'https://www.lua.org/manual/5.5/manual.html#{}' HOVER_DOCUMENT_LUAJIT = 'http://www.lua.org/manual/5.1/manual.html#{}' HOVER_NATIVE_DOCUMENT_LUA51 = @@ -387,6 +396,8 @@ HOVER_NATIVE_DOCUMENT_LUA53 = 'command:extension.lua.doc?["en-us/53/manual.html/{}"]' HOVER_NATIVE_DOCUMENT_LUA54 = 'command:extension.lua.doc?["en-us/54/manual.html/{}"]' +HOVER_NATIVE_DOCUMENT_LUA55 = +'command:extension.lua.doc?["en-us/55/manual.html/{}"]' HOVER_NATIVE_DOCUMENT_LUAJIT = 'command:extension.lua.doc?["en-us/51/manual.html/{}"]' HOVER_MULTI_PROTOTYPE = @@ -468,10 +479,10 @@ ACTION_MARK_ASYNC = 'Marque a função atual como assíncrona' ACTION_ADD_DICT = 'Adicione \'{}\' ao seu espaço de trabalho no ' -ACTION_FIX_ADD_PAREN = -- TODO: need translate! -'添加括号。' -ACTION_AUTOREQUIRE = -- TODO: need translate! -"Import '{}' as {}" +ACTION_FIX_ADD_PAREN = +'Adicionar parênteses.' +ACTION_AUTOREQUIRE = +"Importar '{}' como {}" COMMAND_DISABLE_DIAG = 'Desativar diagnósticos.' @@ -493,8 +504,8 @@ COMMAND_JSON_TO_LUA_FAILED = 'Converção de JSON para Lua falhou: {}.' COMMAND_ADD_DICT = 'Adicione uma palavra ao dicionário' -COMMAND_REFERENCE_COUNT = -- TODO: need translate! -'{} references' +COMMAND_REFERENCE_COUNT = +'{} referências' COMPLETION_IMPORT_FROM = 'Importa de {}.' @@ -536,8 +547,8 @@ WINDOW_PROCESSING_SEMANTIC_RANGE = 'Processando tokens semânticas incrementais...' WINDOW_PROCESSING_HINT = 'Processando dicas de lina...' -WINDOW_PROCESSING_BUILD_META = -- TODO: need translate! -'Processing build meta...' +WINDOW_PROCESSING_BUILD_META = +'Processando meta de construção...' WINDOW_INCREASE_UPPER_LIMIT = 'Aumente o limite superior' WINDOW_CLOSE = @@ -593,16 +604,16 @@ WINDOW_APPLY_WHITOUT_SETTING = 'Aplicar mas não modificar configurações' WINDOW_ASK_APPLY_LIBRARY = 'Você precisa configurar seu ambiente de trabalho como `{}`?' -WINDOW_SEARCHING_IN_FILES = -- TODO: need translate! +WINDOW_SEARCHING_IN_FILES = 'Procurando nos arquivos...' -WINDOW_CONFIG_LUA_DEPRECATED = -- TODO: need translate! -'`config.lua` is deprecated, please use `config.json` instead.' -WINDOW_CONVERT_CONFIG_LUA = -- TODO: need translate! -'Convert to `config.json`' -WINDOW_MODIFY_REQUIRE_PATH = -- TODO: need translate! -'Do you want to modify the require path?' -WINDOW_MODIFY_REQUIRE_OK = -- TODO: need translate! -'Modify' +WINDOW_CONFIG_LUA_DEPRECATED = +'`config.lua` está obsoleto, por favor use `config.json` em vez disso.' +WINDOW_CONVERT_CONFIG_LUA = +'Converter para `config.json`' +WINDOW_MODIFY_REQUIRE_PATH = +'Deseja modificar o caminho do require?' +WINDOW_MODIFY_REQUIRE_OK = +'Modificar' CONFIG_LOAD_FAILED = 'Não é possível ler o arquivo de configurações: {}' @@ -610,22 +621,22 @@ CONFIG_LOAD_ERROR = 'Configurando o erro de carregamento do arquivo: {}' CONFIG_TYPE_ERROR = 'O arquivo de configuração deve estar no formato LUA ou JSON: {}' -CONFIG_MODIFY_FAIL_SYNTAX_ERROR = -- TODO: need translate! -'Failed to modify settings, there are syntax errors in the settings file: {}' -CONFIG_MODIFY_FAIL_NO_WORKSPACE = -- TODO: need translate! +CONFIG_MODIFY_FAIL_SYNTAX_ERROR = +'Falha ao modificar configurações, há erros de sintaxe no arquivo de configurações: {}' +CONFIG_MODIFY_FAIL_NO_WORKSPACE = [[ -Failed to modify settings: -* The current mode is single-file mode, server cannot create `.luarc.json` without workspace. -* The language client does not support modifying settings from the server side. +Falha ao modificar configurações: +* O modo atual é modo de arquivo único, o servidor não pode criar `.luarc.json` sem espaço de trabalho. +* O cliente de linguagem não suporta modificar configurações do lado do servidor. -Please modify following settings manually: +Por favor, modifique as seguintes configurações manualmente: {} ]] -CONFIG_MODIFY_FAIL = -- TODO: need translate! +CONFIG_MODIFY_FAIL = [[ -Failed to modify settings +Falha ao modificar configurações -Please modify following settings manually: +Por favor, modifique as seguintes configurações manualmente: {} ]] @@ -660,83 +671,85 @@ CLI_CHECK_INITING = 'Inicializando ...' CLI_CHECK_SUCCESS = 'Diagnóstico completo, nenhum problema encontrado' -CLI_CHECK_PROGRESS = -- TODO: need translate! -'Found {} problems in {} files' +CLI_CHECK_PROGRESS = +'Encontrados {} problemas em {} arquivos' +CLI_CHECK_RESULTS= +'Diagnóstico concluído, {} problema(s) encontrado(s), veja {}' CLI_CHECK_RESULTS_OUTPATH = 'Diagnóstico completo, {} problemas encontrados, veja {}' CLI_CHECK_RESULTS_PRETTY = 'Diagnóstico completo, {} problemas encontrados' -CLI_CHECK_MULTIPLE_WORKERS = -- TODO: need translate! -'Starting {} worker tasks, progress output will be disabled. This may take a few minutes.' -CLI_DOC_INITING = -- TODO: need translate! -'Loading documents ...' +CLI_CHECK_MULTIPLE_WORKERS = +'Iniciando {} tarefas de trabalho, saída de progresso será desabilitada. Isso pode levar alguns minutos.' +CLI_DOC_INITING = +'Carregando documentos...' CLI_DOC_DONE = 'Documentos exportados:' CLI_DOC_WORKING = 'Construindo docs...' -TYPE_ERROR_ENUM_GLOBAL_DISMATCH = -- TODO: need translate! -'Type `{child}` cannot match enumeration type of `{parent}`' -TYPE_ERROR_ENUM_GENERIC_UNSUPPORTED = -- TODO: need translate! -'Cannot use generic `{child}` in enumeration' -TYPE_ERROR_ENUM_LITERAL_DISMATCH = -- TODO: need translate! -'Literal `{child}` cannot match the enumeration value of `{parent}`' -TYPE_ERROR_ENUM_OBJECT_DISMATCH = -- TODO: need translate! -'The object `{child}` cannot match the enumeration value of `{parent}`. They must be the same object' -TYPE_ERROR_ENUM_NO_OBJECT = -- TODO: need translate! -'The passed in enumeration value `{child}` is not recognized' -TYPE_ERROR_INTEGER_DISMATCH = -- TODO: need translate! -'Literal `{child}` cannot match integer `{parent}`' -TYPE_ERROR_STRING_DISMATCH = -- TODO: need translate! -'Literal `{child}` cannot match string `{parent}`' -TYPE_ERROR_BOOLEAN_DISMATCH = -- TODO: need translate! -'Literal `{child}` cannot match boolean `{parent}`' -TYPE_ERROR_TABLE_NO_FIELD = -- TODO: need translate! -'Field `{key}` does not exist in the table' -TYPE_ERROR_TABLE_FIELD_DISMATCH = -- TODO: need translate! -'The type of field `{key}` is `{child}`, which cannot match `{parent}`' -TYPE_ERROR_CHILD_ALL_DISMATCH = -- TODO: need translate! -'All subtypes in `{child}` cannot match `{parent}`' -TYPE_ERROR_PARENT_ALL_DISMATCH = -- TODO: need translate! -'`{child}` cannot match any subtypes in `{parent}`' -TYPE_ERROR_UNION_DISMATCH = -- TODO: need translate! -'`{child}` cannot match `{parent}`' -TYPE_ERROR_OPTIONAL_DISMATCH = -- TODO: need translate! -'Optional type cannot match `{parent}`' -TYPE_ERROR_NUMBER_LITERAL_TO_INTEGER = -- TODO: need translate! -'The number `{child}` cannot be converted to an integer' -TYPE_ERROR_NUMBER_TYPE_TO_INTEGER = -- TODO: need translate! -'Cannot convert number type to integer type' -TYPE_ERROR_DISMATCH = -- TODO: need translate! -'Type `{child}` cannot match `{parent}`' - -LUADOC_DESC_CLASS = -- TODO: need translate! +TYPE_ERROR_ENUM_GLOBAL_DISMATCH = +'Tipo `{child}` não pode corresponder ao tipo de enumeração de `{parent}`' +TYPE_ERROR_ENUM_GENERIC_UNSUPPORTED = +'Não é possível usar genérico `{child}` em enumeração' +TYPE_ERROR_ENUM_LITERAL_DISMATCH = +'Literal `{child}` não pode corresponder ao valor de enumeração de `{parent}`' +TYPE_ERROR_ENUM_OBJECT_DISMATCH = +'O objeto `{child}` não pode corresponder ao valor de enumeração de `{parent}`. Eles devem ser o mesmo objeto' +TYPE_ERROR_ENUM_NO_OBJECT = +'O valor de enumeração `{child}` passado não é reconhecido' +TYPE_ERROR_INTEGER_DISMATCH = +'Literal `{child}` não pode corresponder ao inteiro `{parent}`' +TYPE_ERROR_STRING_DISMATCH = +'Literal `{child}` não pode corresponder à string `{parent}`' +TYPE_ERROR_BOOLEAN_DISMATCH = +'Literal `{child}` não pode corresponder ao booleano `{parent}`' +TYPE_ERROR_TABLE_NO_FIELD = +'Campo `{key}` não existe na tabela' +TYPE_ERROR_TABLE_FIELD_DISMATCH = +'O tipo do campo `{key}` é `{child}`, que não pode corresponder a `{parent}`' +TYPE_ERROR_CHILD_ALL_DISMATCH = +'Todos os subtipos em `{child}` não podem corresponder a `{parent}`' +TYPE_ERROR_PARENT_ALL_DISMATCH = +'`{child}` não pode corresponder a nenhum subtipo em `{parent}`' +TYPE_ERROR_UNION_DISMATCH = +'`{child}` não pode corresponder a `{parent}`' +TYPE_ERROR_OPTIONAL_DISMATCH = +'Tipo opcional não pode corresponder a `{parent}`' +TYPE_ERROR_NUMBER_LITERAL_TO_INTEGER = +'O número `{child}` não pode ser convertido para um inteiro' +TYPE_ERROR_NUMBER_TYPE_TO_INTEGER = +'Não é possível converter tipo número para tipo inteiro' +TYPE_ERROR_DISMATCH = +'Tipo `{child}` não pode corresponder a `{parent}`' + +LUADOC_DESC_CLASS = [=[ -Defines a class/table structure -## Syntax -`---@class [: [, ]...]` -## Usage +Define uma estrutura de classe/tabela +## Sintaxe +`---@class [: [, ]...]` +## Uso ``` ---@class Manager: Person, Human Manager = {} ``` --- -[View Wiki](https://luals.github.io/wiki/annotations#class) +[Ver Wiki](https://luals.github.io/wiki/annotations#class) ]=] -LUADOC_DESC_TYPE = -- TODO: need translate! +LUADOC_DESC_TYPE = [=[ -Specify the type of a certain variable +Especifica o tipo de uma determinada variável -Default types: `nil`, `any`, `boolean`, `string`, `number`, `integer`, +Tipos padrão: `nil`, `any`, `boolean`, `string`, `number`, `integer`, `function`, `table`, `thread`, `userdata`, `lightuserdata` -(Custom types can be provided using `@alias`) +(Tipos personalizados podem ser fornecidos usando `@alias`) -## Syntax -`---@type [| [type]...` +## Sintaxe +`---@type [| [tipo]...` -## Usage -### General +## Uso +### Geral ``` ---@type nil|table|myClass local Example = nil @@ -754,7 +767,7 @@ local phoneNumbers = {} local color = "" ``` -### Tables +### Tabelas ``` ---@type table local settings = { @@ -763,52 +776,52 @@ local settings = { } ---@type { [string]: true } -local x --x[""] is true +local x --x[""] é true ``` -### Functions +### Funções ``` ---@type fun(mode?: "r"|"w"): string local myFunction ``` --- -[View Wiki](https://luals.github.io/wiki/annotations#type) +[Ver Wiki](https://luals.github.io/wiki/annotations#type) ]=] -LUADOC_DESC_ALIAS = -- TODO: need translate! +LUADOC_DESC_ALIAS = [=[ -Create your own custom type that can be used with `@param`, `@type`, etc. +Crie seu próprio tipo personalizado que pode ser usado com `@param`, `@type`, etc. -## Syntax -`---@alias [description]`\ -or +## Sintaxe +`---@alias [descrição]`\ +ou ``` ----@alias ----| 'value' [# comment] ----| 'value2' [# comment] +---@alias +---| 'valor' [# comentário] +---| 'valor2' [# comentário] ... ``` -## Usage -### Expand to other type +## Uso +### Expandir para outro tipo ``` ----@alias filepath string Path to a file +---@alias filepath string Caminho para um arquivo ----@param path filepath Path to the file to search in +---@param path filepath Caminho para o arquivo a pesquisar function find(path, pattern) end ``` ### Enums ``` ---@alias font-style ----| '"underlined"' # Underline the text ----| '"bold"' # Bolden the text ----| '"italic"' # Make the text italicized +---| '"underlined"' # Sublinhar o texto +---| '"bold"' # Negrito no texto +---| '"italic"' # Italicizar o texto ----@param style font-style Style to apply +---@param style font-style Estilo a aplicar function setFontStyle(style) end ``` -### Literal Enum +### Enum Literal ``` local enums = { READ = 0, @@ -822,328 +835,328 @@ local enums = { ---| `enums.CLOSE` ``` --- -[View Wiki](https://luals.github.io/wiki/annotations#alias) +[Ver Wiki](https://luals.github.io/wiki/annotations#alias) ]=] -LUADOC_DESC_PARAM = -- TODO: need translate! +LUADOC_DESC_PARAM = [=[ -Declare a function parameter +Declara um parâmetro de função -## Syntax -`@param [?] [comment]` +## Sintaxe +`@param [?] [comentário]` -## Usage -### General +## Uso +### Geral ``` ----@param url string The url to request ----@param headers? table HTTP headers to send ----@param timeout? number Timeout in seconds +---@param url string A url para solicitar +---@param headers? table Cabeçalhos HTTP a enviar +---@param timeout? number Tempo limite em segundos function get(url, headers, timeout) end ``` -### Variable Arguments +### Argumentos Variáveis ``` ----@param base string The base to concat to ----@param ... string The values to concat +---@param base string A base para concatenar +---@param ... string Os valores a concatenar function concat(base, ...) end ``` --- -[View Wiki](https://luals.github.io/wiki/annotations#param) +[Ver Wiki](https://luals.github.io/wiki/annotations#param) ]=] -LUADOC_DESC_RETURN = -- TODO: need translate! +LUADOC_DESC_RETURN = [=[ -Declare a return value +Declara um valor de retorno -## Syntax -`@return [name] [description]`\ -or\ -`@return [# description]` +## Sintaxe +`@return [nome] [descrição]`\ +ou\ +`@return [# descrição]` -## Usage -### General +## Uso +### Geral ``` ---@return number ----@return number # The green component ----@return number b The blue component +---@return number # O componente verde +---@return number b O componente azul function hexToRGB(hex) end ``` -### Type & name only +### Apenas tipo e nome ``` ---@return number x, number y function getCoords() end ``` -### Type only +### Apenas tipo ``` ---@return string, string function getFirstLast() end ``` -### Return variable values +### Retornar valores variáveis ``` ----@return string ... The tags of the item +---@return string ... As tags do item function getTags(item) end ``` --- -[View Wiki](https://luals.github.io/wiki/annotations#return) +[Ver Wiki](https://luals.github.io/wiki/annotations#return) ]=] -LUADOC_DESC_FIELD = -- TODO: need translate! +LUADOC_DESC_FIELD = [=[ -Declare a field in a class/table. This allows you to provide more in-depth -documentation for a table. As of `v3.6.0`, you can mark a field as `private`, -`protected`, `public`, or `package`. +Declara um campo em uma classe/tabela. Isso permite fornecer documentação mais detalhada +para uma tabela. A partir da versão `v3.6.0`, você pode marcar um campo como `private`, +`protected`, `public`, ou `package`. -## Syntax -`---@field [description]` +## Sintaxe +`---@field [descrição]` -## Usage +## Uso ``` ---@class HTTP_RESPONSE ---@field status HTTP_STATUS ----@field headers table The headers of the response +---@field headers table Os cabeçalhos da resposta ---@class HTTP_STATUS ----@field code number The status code of the response ----@field message string A message reporting the status +---@field code number O código de status da resposta +---@field message string Uma mensagem informando o status ----@return HTTP_RESPONSE response The response from the server +---@return HTTP_RESPONSE response A resposta do servidor function get(url) end ---This response variable has all of the fields defined above +--Esta variável response tem todos os campos definidos acima response = get("localhost") ---Extension provided intellisense for the below assignment +--Intellisense fornecido pela extensão para a atribuição abaixo statusCode = response.status.code ``` --- -[View Wiki](https://luals.github.io/wiki/annotations#field) +[Ver Wiki](https://luals.github.io/wiki/annotations#field) ]=] -LUADOC_DESC_GENERIC = -- TODO: need translate! +LUADOC_DESC_GENERIC = [=[ -Simulates generics. Generics can allow types to be re-used as they help define -a "generic shape" that can be used with different types. +Simula genéricos. Genéricos podem permitir que os tipos sejam reutilizados, pois ajudam a definir +uma "forma genérica" que pode ser usada com diferentes tipos. -## Syntax -`---@generic [:parent_type] [, [:parent_type]]` +## Sintaxe +`---@generic [:tipo_pai] [, [:tipo_pai]]` -## Usage -### General +## Uso +### Geral ``` ---@generic T ----@param value T The value to return ----@return T value The exact same value +---@param value T O valor a retornar +---@return T value O mesmo valor exato function echo(value) return value end --- Type is string +-- Tipo é string s = echo("e") --- Type is number +-- Tipo é number n = echo(10) --- Type is boolean +-- Tipo é boolean b = echo(true) --- We got all of this info from just using --- @generic rather than manually specifying --- each allowed type +-- Obtivemos todas essas informações apenas usando +-- @generic em vez de especificar manualmente +-- cada tipo permitido ``` -### Capture name of generic type +### Capturar nome do tipo genérico ``` ---@class Foo local Foo = {} function Foo:Bar() end ---@generic T ----@param name `T` # the name generic type is captured here ----@return T # generic type is returned +---@param name `T` # o nome do tipo genérico é capturado aqui +---@return T # tipo genérico é retornado function Generic(name) end -local v = Generic("Foo") -- v is an object of Foo +local v = Generic("Foo") -- v é um objeto de Foo ``` -### How Lua tables use generics +### Como as tabelas Lua usam genéricos ``` ---@class table: { [K]: V } --- This is what allows us to create a table --- and intellisense keeps track of any type --- we give for key (K) or value (V) +-- Isso é o que nos permite criar uma tabela +-- e o intellisense mantém o controle de qualquer tipo +-- que damos para chave (K) ou valor (V) ``` --- -[View Wiki](https://luals.github.io/wiki/annotations/#generic) +[Ver Wiki](https://luals.github.io/wiki/annotations/#generic) ]=] -LUADOC_DESC_VARARG = -- TODO: need translate! +LUADOC_DESC_VARARG = [=[ -Primarily for legacy support for EmmyLua annotations. `@vararg` does not -provide typing or allow descriptions. +Principalmente para suporte legado de anotações EmmyLua. `@vararg` não +fornece tipagem ou permite descrições. -**You should instead use `@param` when documenting parameters (variable or not).** +**Você deve usar `@param` ao documentar parâmetros (variáveis ou não).** -## Syntax -`@vararg ` +## Sintaxe +`@vararg ` -## Usage +## Uso ``` ----Concat strings together +---Concatenar strings ---@vararg string function concat(...) end ``` --- -[View Wiki](https://luals.github.io/wiki/annotations#vararg) +[Ver Wiki](https://luals.github.io/wiki/annotations#vararg) ]=] -LUADOC_DESC_OVERLOAD = -- TODO: need translate! +LUADOC_DESC_OVERLOAD = [=[ -Allows defining of multiple function signatures. +Permite a definição de múltiplas assinaturas de função. -## Syntax -`---@overload fun([: ] [, [: ]]...)[: [, ]...]` +## Sintaxe +`---@overload fun([: ] [, [: ]]...)[: [, ]...]` -## Usage +## Uso ``` ---@overload fun(t: table, value: any): number function table.insert(t, position, value) end ``` --- -[View Wiki](https://luals.github.io/wiki/annotations#overload) +[Ver Wiki](https://luals.github.io/wiki/annotations#overload) ]=] -LUADOC_DESC_DEPRECATED = -- TODO: need translate! +LUADOC_DESC_DEPRECATED = [=[ -Marks a function as deprecated. This results in any deprecated function calls -being ~~struck through~~. +Marca uma função como obsoleta. Isso resulta em quaisquer chamadas de função obsoletas +sendo ~~riscadas~~. -## Syntax +## Sintaxe `---@deprecated` --- -[View Wiki](https://luals.github.io/wiki/annotations#deprecated) +[Ver Wiki](https://luals.github.io/wiki/annotations#deprecated) ]=] -LUADOC_DESC_META = -- TODO: need translate! +LUADOC_DESC_META = [=[ -Indicates that this is a meta file and should be used for definitions and intellisense only. +Indica que este é um arquivo meta e deve ser usado apenas para definições e intellisense. -There are 3 main distinctions to note with meta files: -1. There won't be any context-based intellisense in a meta file -2. Hovering a `require` filepath in a meta file shows `[meta]` instead of an absolute path -3. The `Find Reference` function will ignore meta files +Há 3 distinções principais a observar com arquivos meta: +1. Não haverá intellisense baseado em contexto em um arquivo meta +2. Passar o mouse sobre um caminho de arquivo `require` em um arquivo meta mostra `[meta]` em vez de um caminho absoluto +3. A função `Localizar Referência` ignorará arquivos meta -## Syntax +## Sintaxe `---@meta` --- -[View Wiki](https://luals.github.io/wiki/annotations#meta) +[Ver Wiki](https://luals.github.io/wiki/annotations#meta) ]=] -LUADOC_DESC_VERSION = -- TODO: need translate! +LUADOC_DESC_VERSION = [=[ -Specifies Lua versions that this function is exclusive to. +Especifica as versões Lua às quais esta função é exclusiva. -Lua versions: `5.1`, `5.2`, `5.3`, `5.4`, `JIT`. +Versões Lua: `5.1`, `5.2`, `5.3`, `5.4`, `JIT`. -Requires configuring the `Diagnostics: Needed File Status` setting. +Requer configurar a configuração `Diagnostics: Needed File Status`. -## Syntax -`---@version [, ]...` +## Sintaxe +`---@version [, ]...` -## Usage -### General +## Uso +### Geral ``` ---@version JIT function onlyWorksInJIT() end ``` -### Specify multiple versions +### Especificar múltiplas versões ``` ---@version <5.2,JIT function oldLuaOnly() end ``` --- -[View Wiki](https://luals.github.io/wiki/annotations#version) +[Ver Wiki](https://luals.github.io/wiki/annotations#version) ]=] -LUADOC_DESC_SEE = -- TODO: need translate! +LUADOC_DESC_SEE = [=[ -Define something that can be viewed for more information +Define algo que pode ser visualizado para mais informações -## Syntax -`---@see ` +## Sintaxe +`---@see ` --- -[View Wiki](https://luals.github.io/wiki/annotations#see) +[Ver Wiki](https://luals.github.io/wiki/annotations#see) ]=] -LUADOC_DESC_DIAGNOSTIC = -- TODO: need translate! +LUADOC_DESC_DIAGNOSTIC = [=[ -Enable/disable diagnostics for error/warnings/etc. +Habilitar/desabilitar diagnósticos para erros/avisos/etc. -Actions: `disable`, `enable`, `disable-line`, `disable-next-line` +Ações: `disable`, `enable`, `disable-line`, `disable-next-line` -[Names](https://github.com/LuaLS/lua-language-server/blob/cbb6e6224094c4eb874ea192c5f85a6cba099588/script/proto/define.lua#L54) +[Nomes](https://github.com/LuaLS/lua-language-server/blob/cbb6e6224094c4eb874ea192c5f85a6cba099588/script/proto/define.lua#L54) -## Syntax -`---@diagnostic [: ]` +## Sintaxe +`---@diagnostic [: ]` -## Usage -### Disable next line +## Uso +### Desabilitar próxima linha ``` ---@diagnostic disable-next-line: undefined-global ``` -### Manually toggle +### Alternar manualmente ``` ---@diagnostic disable: unused-local local unused = "hello world" ---@diagnostic enable: unused-local ``` --- -[View Wiki](https://luals.github.io/wiki/annotations#diagnostic) +[Ver Wiki](https://luals.github.io/wiki/annotations#diagnostic) ]=] -LUADOC_DESC_MODULE = -- TODO: need translate! +LUADOC_DESC_MODULE = [=[ -Provides the semantics of `require`. +Fornece a semântica de `require`. -## Syntax -`---@module <'module_name'>` +## Sintaxe +`---@module <'nome_modulo'>` -## Usage +## Uso ``` ---@module 'string.utils' local stringUtils --- This is functionally the same as: +-- Isso é funcionalmente o mesmo que: local module = require('string.utils') ``` --- -[View Wiki](https://luals.github.io/wiki/annotations#module) +[Ver Wiki](https://luals.github.io/wiki/annotations#module) ]=] -LUADOC_DESC_ASYNC = -- TODO: need translate! +LUADOC_DESC_ASYNC = [=[ -Marks a function as asynchronous. +Marca uma função como assíncrona. -## Syntax +## Sintaxe `---@async` --- -[View Wiki](https://luals.github.io/wiki/annotations#async) +[Ver Wiki](https://luals.github.io/wiki/annotations#async) ]=] -LUADOC_DESC_NODISCARD = -- TODO: need translate! +LUADOC_DESC_NODISCARD = [=[ -Prevents this function's return values from being discarded/ignored. -This will raise the `discard-returns` warning should the return values -be ignored. +Impede que os valores de retorno desta função sejam descartados/ignorados. +Isso levantará o aviso `discard-returns` caso os valores de retorno +sejam ignorados. -## Syntax +## Sintaxe `---@nodiscard` --- -[View Wiki](https://luals.github.io/wiki/annotations#nodiscard) +[Ver Wiki](https://luals.github.io/wiki/annotations#nodiscard) ]=] -LUADOC_DESC_CAST = -- TODO: need translate! +LUADOC_DESC_CAST = [=[ -Allows type casting (type conversion). +Permite conversão de tipo (type casting). -## Syntax -`@cast <[+|-]type>[, <[+|-]type>]...` +## Sintaxe +`@cast <[+|-]tipo>[, <[+|-]tipo>]...` -## Usage -### Overwrite type +## Uso +### Sobrescrever tipo ``` ---@type integer local x --> integer @@ -1151,7 +1164,7 @@ local x --> integer ---@cast x string print(x) --> string ``` -### Add Type +### Adicionar tipo ``` ---@type string local x --> string @@ -1159,7 +1172,7 @@ local x --> string ---@cast x +boolean, +number print(x) --> string|boolean|number ``` -### Remove Type +### Remover tipo ``` ---@type string|table local x --> string|table @@ -1168,17 +1181,17 @@ local x --> string|table print(x) --> table ``` --- -[View Wiki](https://luals.github.io/wiki/annotations#cast) +[Ver Wiki](https://luals.github.io/wiki/annotations#cast) ]=] -LUADOC_DESC_OPERATOR = -- TODO: need translate! +LUADOC_DESC_OPERATOR = [=[ -Provide type declaration for [operator metamethods](http://lua-users.org/wiki/MetatableEvents). +Fornecer declaração de tipo para [metamethods de operador](http://lua-users.org/wiki/MetatableEvents). -## Syntax -`@operator [(input_type)]:` +## Sintaxe +`@operator [(tipo_entrada)]:` -## Usage -### Vector Add Metamethod +## Uso +### Metamethod de adição de vetor ``` ---@class Vector ---@operator add(Vector):Vector @@ -1189,7 +1202,7 @@ vB = Vector.new(10, 20, 30) vC = vA + vB --> Vector ``` -### Unary Minus +### Menos unário ``` ---@class Passcode ---@operator unm:integer @@ -1198,18 +1211,17 @@ pA = Passcode.new(1234) pB = -pA --> integer ``` -[View Request](https://github.com/LuaLS/lua-language-server/issues/599) +[Ver Solicitação](https://github.com/LuaLS/lua-language-server/issues/599) ]=] -LUADOC_DESC_ENUM = -- TODO: need translate! +LUADOC_DESC_ENUM = [=[ -Mark a table as an enum. If you want an enum but can't define it as a Lua -table, take a look at the [`@alias`](https://luals.github.io/wiki/annotations#alias) -tag. +Marca uma tabela como um enum. Se você deseja um enum mas não pode defini-lo como uma +tabela Lua, veja a tag [`@alias`](https://luals.github.io/wiki/annotations#alias). -## Syntax -`@enum ` +## Sintaxe +`@enum ` -## Usage +## Uso ``` ---@enum colors local colors = { @@ -1223,67 +1235,67 @@ local colors = { ---@param color colors local function setColor(color) end --- Completion and hover is provided for the below param +-- Completion e hover são fornecidos para o parâmetro abaixo setColor(colors.green) ``` ]=] -LUADOC_DESC_SOURCE = -- TODO: need translate! +LUADOC_DESC_SOURCE = [=[ -Provide a reference to some source code which lives in another file. When -searching for the definition of an item, its `@source` will be used. +Fornecer uma referência a algum código-fonte que reside em outro arquivo. Ao +pesquisar a definição de um item, seu `@source` será usado. -## Syntax -`@source ` +## Sintaxe +`@source ` -## Usage +## Uso ``` ----You can use absolute paths +---Você pode usar caminhos absolutos ---@source C:/Users/me/Documents/program/myFile.c local a ----Or URIs +---Ou URIs ---@source file:///C:/Users/me/Documents/program/myFile.c:10 local b ----Or relative paths +---Ou caminhos relativos ---@source local/file.c local c ----You can also include line and char numbers +---Você também pode incluir números de linha e caractere ---@source local/file.c:10:8 local d ``` ]=] -LUADOC_DESC_PACKAGE = -- TODO: need translate! +LUADOC_DESC_PACKAGE = [=[ -Mark a function as private to the file it is defined in. A packaged function -cannot be accessed from another file. +Marca uma função como privada ao arquivo em que é definida. Uma função empacotada +não pode ser acessada de outro arquivo. -## Syntax +## Sintaxe `@package` -## Usage +## Uso ``` ---@class Animal ---@field private eyes integer local Animal = {} ---@package ----This cannot be accessed in another file +---Isso não pode ser acessado em outro arquivo function Animal:eyesCount() return self.eyes end ``` ]=] -LUADOC_DESC_PRIVATE = -- TODO: need translate! +LUADOC_DESC_PRIVATE = [=[ -Mark a function as private to a @class. Private functions can be accessed only -from within their class and are not accessible from child classes. +Marca uma função como privada a uma @class. Funções privadas podem ser acessadas apenas +dentro de sua classe e não são acessíveis a partir de classes filhas. -## Syntax +## Sintaxe `@private` -## Usage +## Uso ``` ---@class Animal ---@field private eyes integer @@ -1297,19 +1309,19 @@ end ---@class Dog:Animal local myDog = {} ----NOT PERMITTED! +---NÃO PERMITIDO! myDog:eyesCount(); ``` ]=] -LUADOC_DESC_PROTECTED = -- TODO: need translate! +LUADOC_DESC_PROTECTED = [=[ -Mark a function as protected within a @class. Protected functions can be -accessed only from within their class or from child classes. +Marca uma função como protegida dentro de uma @class. Funções protegidas podem ser +acessadas apenas de dentro de sua classe ou de classes filhas. -## Syntax +## Sintaxe `@protected` -## Usage +## Uso ``` ---@class Animal ---@field private eyes integer @@ -1323,7 +1335,7 @@ end ---@class Dog:Animal local myDog = {} ----Permitted because function is protected, not private. +---Permitido porque a função é protegida, não privada. myDog:eyesCount(); ``` ]=] diff --git a/locale/pt-br/setting.lua b/locale/pt-br/setting.lua index 037340ec1..b2777a6b9 100644 --- a/locale/pt-br/setting.lua +++ b/locale/pt-br/setting.lua @@ -1,139 +1,143 @@ ---@diagnostic disable: undefined-global -config.addonManager.enable = -- TODO: need translate! -"Whether the addon manager is enabled or not." -config.addonManager.repositoryBranch = -- TODO: need translate! -"Specifies the git branch used by the addon manager." -config.addonManager.repositoryPath = -- TODO: need translate! -"Specifies the git path used by the addon manager." -config.addonRepositoryPath = -- TODO: need translate! -"Specifies the addon repository path (not related to the addon manager)." -config.runtime.version = -- TODO: need translate! -"Lua runtime version." -config.runtime.path = -- TODO: need translate! +config.addonManager.enable = +"Habilita ou desabilita o gerenciador de add-ons." +config.addonManager.repositoryBranch = +"Define o branch Git usado pelo gerenciador de add-ons." +config.addonManager.repositoryPath = +"Define o caminho Git usado pelo gerenciador de add-ons." +config.addonRepositoryPath = +"Define o caminho do repositório de add-ons (não relacionado ao gerenciador de add-ons)." +config.runtime.version = +"Versão do runtime Lua." +config.runtime.path = [[ -When using `require`, how to find the file based on the input name. -Setting this config to `?/init.lua` means that when you enter `require 'myfile'`, `${workspace}/myfile/init.lua` will be searched from the loaded files. -if `runtime.pathStrict` is `false`, `${workspace}/**/myfile/init.lua` will also be searched. -If you want to load files outside the workspace, you need to set `Lua.workspace.library` first. +Ao usar `require`, define como encontrar o arquivo baseado no nome fornecido. +Definir esta configuração como `?/init.lua` significa que ao executar `require 'myfile'`, será buscado `${workspace}/myfile/init.lua` nos arquivos carregados. +Se `runtime.pathStrict` for `false`, `${workspace}/**/myfile/init.lua` também será buscado. +Para carregar arquivos fora da workspace, primeiro configure `Lua.workspace.library`. ]] -config.runtime.pathStrict = -- TODO: need translate! -'When enabled, `runtime.path` will only search the first level of directories, see the description of `runtime.path`.' -config.runtime.special = -- TODO: need translate! -[[The custom global variables are regarded as some special built-in variables, and the language server will provide special support -The following example shows that 'include' is treated as' require '. +config.runtime.pathStrict = +'Quando habilitado, `runtime.path` buscará apenas o primeiro nível de diretórios; veja a descrição de `runtime.path`.' +config.runtime.special = +[[Variáveis globais personalizadas são tratadas como variáveis especiais internas, e o servidor fornecerá suporte especial. +O exemplo a seguir mostra que 'include' é tratado como 'require'. ```json "Lua.runtime.special" : { "include" : "require" } ``` ]] -config.runtime.unicodeName = -- TODO: need translate! -"Allows Unicode characters in name." -config.runtime.nonstandardSymbol = -- TODO: need translate! -"Supports non-standard symbols. Make sure that your runtime environment supports these symbols." -config.runtime.plugin = -- TODO: need translate! -"Plugin path. Please read [wiki](https://luals.github.io/wiki/plugins) to learn more." -config.runtime.pluginArgs = -- TODO: need translate! -"Additional arguments for the plugin." -config.runtime.fileEncoding = -- TODO: need translate! -"File encoding. The `ansi` option is only available under the `Windows` platform." -config.runtime.builtin = -- TODO: need translate! +config.runtime.unicodeName = +"Permite caracteres Unicode em nomes." +config.runtime.nonstandardSymbol = +"Suporta símbolos não-padrão. Certifique-se de que seu ambiente de runtime suporta esses símbolos." +config.runtime.plugin = +"Caminho do plugin. Leia a [wiki](https://luals.github.io/wiki/plugins) para saber mais." +config.runtime.pluginArgs = +"Argumentos adicionais para o plugin." +config.runtime.fileEncoding = +"Codificação de arquivo. A opção `ansi` está disponível apenas na plataforma `Windows`." +config.runtime.builtin = [[ -Adjust the enabled state of the built-in library. You can disable (or redefine) the non-existent library according to the actual runtime environment. +Ajusta o estado de habilitação das bibliotecas internas. Você pode desabilitar (ou redefinir) bibliotecas inexistentes conforme o ambiente de execução real. -* `default`: Indicates that the library will be enabled or disabled according to the runtime version -* `enable`: always enable -* `disable`: always disable +* `default`: a biblioteca será habilitada ou desabilitada conforme a versão do runtime +* `enable`: sempre habilitar +* `disable`: sempre desabilitar ]] -config.runtime.meta = -- TODO: need translate! -'Format of the directory name of the meta files.' -config.diagnostics.enable = -- TODO: need translate! -"Enable diagnostics." -config.diagnostics.disable = -- TODO: need translate! -"Disabled diagnostic (Use code in hover brackets)." -config.diagnostics.globals = -- TODO: need translate! -"Defined global variables." -config.diagnostics.globalsRegex = -- TODO: need translate! -"Find defined global variables using regex." -config.diagnostics.severity = -- TODO: need translate! +config.runtime.meta = +'Formato do nome do diretório dos arquivos meta.' +config.diagnostics.enable = +"Habilita diagnósticos." +config.diagnostics.disable = +"Diagnósticos desabilitados (use o código nos colchetes do hover)." +config.diagnostics.globals = +"Variáveis globais definidas." +config.diagnostics.globalsRegex = +"Encontra variáveis globais definidas usando regex." +config.diagnostics.severity = [[ -Modify the diagnostic severity. +Modifica a gravidade do diagnóstico. -End with `!` means override the group setting `diagnostics.groupSeverity`. +Terminar com `!` significa sobrescrever a configuração de grupo `diagnostics.groupSeverity`. ]] -config.diagnostics.neededFileStatus = -- TODO: need translate! +config.diagnostics.neededFileStatus = [[ -* Opened: only diagnose opened files -* Any: diagnose all files -* None: disable this diagnostic +* Opened: diagnosticar apenas arquivos abertos +* Any: diagnosticar todos os arquivos +* None: desabilitar este diagnóstico -End with `!` means override the group setting `diagnostics.groupFileStatus`. +Terminar com `!` significa sobrescrever a configuração de grupo `diagnostics.groupFileStatus`. ]] -config.diagnostics.groupSeverity = -- TODO: need translate! +config.diagnostics.groupSeverity = [[ -Modify the diagnostic severity in a group. -`Fallback` means that diagnostics in this group are controlled by `diagnostics.severity` separately. -Other settings will override individual settings without end of `!`. +Modifica a gravidade do diagnóstico em um grupo. +`Fallback` significa que os diagnósticos deste grupo são controlados por `diagnostics.severity` separadamente. +Outras configurações sobrescreverão configurações individuais sem terminar com `!`. ]] -config.diagnostics.groupFileStatus = -- TODO: need translate! +config.diagnostics.groupFileStatus = [[ -Modify the diagnostic needed file status in a group. +Modifica o status de arquivo necessário para diagnóstico em um grupo. -* Opened: only diagnose opened files -* Any: diagnose all files -* None: disable this diagnostic +* Opened: diagnosticar apenas arquivos abertos +* Any: diagnosticar todos os arquivos +* None: desabilitar este diagnóstico -`Fallback` means that diagnostics in this group are controlled by `diagnostics.neededFileStatus` separately. -Other settings will override individual settings without end of `!`. +`Fallback` significa que os diagnósticos deste grupo são controlados por `diagnostics.neededFileStatus` separadamente. +Outras configurações sobrescreverão configurações individuais sem terminar com `!`. ]] -config.diagnostics.workspaceEvent = -- TODO: need translate! -"Set the time to trigger workspace diagnostics." -config.diagnostics.workspaceEvent.OnChange = -- TODO: need translate! -"Trigger workspace diagnostics when the file is changed." -config.diagnostics.workspaceEvent.OnSave = -- TODO: need translate! -"Trigger workspace diagnostics when the file is saved." -config.diagnostics.workspaceEvent.None = -- TODO: need translate! -"Disable workspace diagnostics." -config.diagnostics.workspaceDelay = -- TODO: need translate! -"Latency (milliseconds) for workspace diagnostics." -config.diagnostics.workspaceRate = -- TODO: need translate! -"Workspace diagnostics run rate (%). Decreasing this value reduces CPU usage, but also reduces the speed of workspace diagnostics. The diagnosis of the file you are currently editing is always done at full speed and is not affected by this setting." -config.diagnostics.libraryFiles = -- TODO: need translate! -"How to diagnose files loaded via `Lua.workspace.library`." -config.diagnostics.libraryFiles.Enable = -- TODO: need translate! -"Always diagnose these files." -config.diagnostics.libraryFiles.Opened = -- TODO: need translate! -"Only when these files are opened will it be diagnosed." -config.diagnostics.libraryFiles.Disable = -- TODO: need translate! -"These files are not diagnosed." -config.diagnostics.ignoredFiles = -- TODO: need translate! -"How to diagnose ignored files." -config.diagnostics.ignoredFiles.Enable = -- TODO: need translate! -"Always diagnose these files." -config.diagnostics.ignoredFiles.Opened = -- TODO: need translate! -"Only when these files are opened will it be diagnosed." -config.diagnostics.ignoredFiles.Disable = -- TODO: need translate! -"These files are not diagnosed." -config.diagnostics.disableScheme = -- TODO: need translate! -'Do not diagnose Lua files that use the following scheme.' -config.diagnostics.unusedLocalExclude = -- TODO: need translate! -'Do not diagnose `unused-local` when the variable name matches the following pattern.' -config.workspace.ignoreDir = -- TODO: need translate! -"Ignored files and directories (Use `.gitignore` grammar)."-- .. example.ignoreDir, -config.workspace.ignoreSubmodules = -- TODO: need translate! -"Ignore submodules." -config.workspace.useGitIgnore = -- TODO: need translate! -"Ignore files list in `.gitignore` ." -config.workspace.maxPreload = -- TODO: need translate! -"Max preloaded files." -config.workspace.preloadFileSize = -- TODO: need translate! -"Skip files larger than this value (KB) when preloading." -config.workspace.library = -- TODO: need translate! -"In addition to the current workspace, which directories will load files from. The files in these directories will be treated as externally provided code libraries, and some features (such as renaming fields) will not modify these files." -config.workspace.checkThirdParty = -- TODO: need translate! +config.diagnostics.workspaceEvent = +"Define quando acionar diagnósticos da workspace." +config.diagnostics.workspaceEvent.OnChange = +"Aciona diagnósticos da workspace quando o arquivo é modificado." +config.diagnostics.workspaceEvent.OnSave = +"Aciona diagnósticos da workspace quando o arquivo é salvo." +config.diagnostics.workspaceEvent.None = +"Desabilita diagnósticos da workspace." +config.diagnostics.workspaceDelay = +"Latência (milissegundos) para diagnósticos da workspace." +config.diagnostics.workspaceRate = +"Taxa de execução dos diagnósticos da workspace (%). Diminuir este valor reduz o uso de CPU, mas também reduz a velocidade dos diagnósticos. O diagnóstico do arquivo que você está editando sempre é feito em velocidade total e não é afetado por esta configuração." +config.diagnostics.libraryFiles = +"Como diagnosticar arquivos carregados via `Lua.workspace.library`." +config.diagnostics.libraryFiles.Enable = +"Sempre diagnosticar esses arquivos." +config.diagnostics.libraryFiles.Opened = +"Diagnosticar esses arquivos apenas quando estiverem abertos." +config.diagnostics.libraryFiles.Disable = +"Esses arquivos não são diagnosticados." +config.diagnostics.ignoredFiles = +"Como diagnosticar arquivos ignorados." +config.diagnostics.ignoredFiles.Enable = +"Sempre diagnosticar esses arquivos." +config.diagnostics.ignoredFiles.Opened = +"Diagnosticar esses arquivos apenas quando estiverem abertos." +config.diagnostics.ignoredFiles.Disable = +"Esses arquivos não são diagnosticados." +config.diagnostics.disableScheme = +'Não diagnosticar arquivos Lua que usam os seguintes schemes.' +config.diagnostics.validScheme = +'Habilita diagnósticos para arquivos Lua que usam os seguintes schemes.' +config.diagnostics.unusedLocalExclude = +'Não diagnosticar `unused-local` quando o nome da variável corresponder ao padrão a seguir.' +config.diagnostics.validScheme = +'Habilita diagnósticos para arquivos Lua que usam os seguintes schemes.' +config.workspace.ignoreDir = +"Arquivos e diretórios ignorados (usa sintaxe `.gitignore`)."-- .. example.ignoreDir, +config.workspace.ignoreSubmodules = +"Ignorar submódulos." +config.workspace.useGitIgnore = +"Ignorar lista de arquivos em `.gitignore`." +config.workspace.maxPreload = +"Número máximo de arquivos pré-carregados." +config.workspace.preloadFileSize = +"Ignorar arquivos maiores que este valor (KB) ao pré-carregar." +config.workspace.library = +"Além da workspace atual, de quais diretórios carregar arquivos. Os arquivos nesses diretórios serão tratados como bibliotecas de código externas, e alguns recursos (como renomear campos) não modificarão esses arquivos." +config.workspace.checkThirdParty = [[ -Automatic detection and adaptation of third-party libraries, currently supported libraries are: +Detecção e adaptação automáticas de bibliotecas de terceiros; atualmente suportadas: * OpenResty * Cocos4.0 @@ -142,339 +146,340 @@ Automatic detection and adaptation of third-party libraries, currently supported * skynet * Jass ]] -config.workspace.userThirdParty = -- TODO: need translate! -'Add private third-party library configuration file paths here, please refer to the built-in [configuration file path](https://github.com/LuaLS/lua-language-server/tree/master/meta/3rd)' -config.workspace.supportScheme = -- TODO: need translate! -'Provide language server for the Lua files of the following scheme.' -config.completion.enable = -- TODO: need translate! -'Enable completion.' -config.completion.callSnippet = -- TODO: need translate! -'Shows function call snippets.' -config.completion.callSnippet.Disable = -- TODO: need translate! -"Only shows `function name`." -config.completion.callSnippet.Both = -- TODO: need translate! -"Shows `function name` and `call snippet`." -config.completion.callSnippet.Replace = -- TODO: need translate! -"Only shows `call snippet.`" -config.completion.keywordSnippet = -- TODO: need translate! -'Shows keyword syntax snippets.' -config.completion.keywordSnippet.Disable = -- TODO: need translate! -"Only shows `keyword`." -config.completion.keywordSnippet.Both = -- TODO: need translate! -"Shows `keyword` and `syntax snippet`." -config.completion.keywordSnippet.Replace = -- TODO: need translate! -"Only shows `syntax snippet`." -config.completion.displayContext = -- TODO: need translate! -"Previewing the relevant code snippet of the suggestion may help you understand the usage of the suggestion. The number set indicates the number of intercepted lines in the code fragment. If it is set to `0`, this feature can be disabled." -config.completion.workspaceWord = -- TODO: need translate! -"Whether the displayed context word contains the content of other files in the workspace." -config.completion.showWord = -- TODO: need translate! -"Show contextual words in suggestions." -config.completion.showWord.Enable = -- TODO: need translate! -"Always show context words in suggestions." -config.completion.showWord.Fallback = -- TODO: need translate! -"Contextual words are only displayed when suggestions based on semantics cannot be provided." -config.completion.showWord.Disable = -- TODO: need translate! -"Do not display context words." -config.completion.autoRequire = -- TODO: need translate! -"When the input looks like a file name, automatically `require` this file." -config.completion.showParams = -- TODO: need translate! -"Display parameters in completion list. When the function has multiple definitions, they will be displayed separately." -config.completion.requireSeparator = -- TODO: need translate! -"The separator used when `require`." -config.completion.postfix = -- TODO: need translate! -"The symbol used to trigger the postfix suggestion." -config.color.mode = -- TODO: need translate! -"Color mode." -config.color.mode.Semantic = -- TODO: need translate! -"Semantic color. You may need to set `editor.semanticHighlighting.enabled` to `true` to take effect." -config.color.mode.SemanticEnhanced = -- TODO: need translate! -"Enhanced semantic color. Like `Semantic`, but with additional analysis which might be more computationally expensive." -config.color.mode.Grammar = -- TODO: need translate! -"Grammar color." -config.semantic.enable = -- TODO: need translate! -"Enable semantic color. You may need to set `editor.semanticHighlighting.enabled` to `true` to take effect." -config.semantic.variable = -- TODO: need translate! -"Semantic coloring of variables/fields/parameters." -config.semantic.annotation = -- TODO: need translate! -"Semantic coloring of type annotations." -config.semantic.keyword = -- TODO: need translate! -"Semantic coloring of keywords/literals/operators. You only need to enable this feature if your editor cannot do syntax coloring." -config.signatureHelp.enable = -- TODO: need translate! -"Enable signature help." -config.hover.enable = -- TODO: need translate! -"Enable hover." -config.hover.viewString = -- TODO: need translate! -"Hover to view the contents of a string (only if the literal contains an escape character)." -config.hover.viewStringMax = -- TODO: need translate! -"The maximum length of a hover to view the contents of a string." -config.hover.viewNumber = -- TODO: need translate! -"Hover to view numeric content (only if literal is not decimal)." -config.hover.fieldInfer = -- TODO: need translate! -"When hovering to view a table, type infer will be performed for each field. When the accumulated time of type infer reaches the set value (MS), the type infer of subsequent fields will be skipped." -config.hover.previewFields = -- TODO: need translate! -"When hovering to view a table, limits the maximum number of previews for fields." -config.hover.enumsLimit = -- TODO: need translate! -"When the value corresponds to multiple types, limit the number of types displaying." -config.hover.expandAlias = -- TODO: need translate! +config.workspace.userThirdParty = +'Adicione aqui caminhos de configuração de bibliotecas de terceiros privadas; consulte o [caminho de configuração](https://github.com/LuaLS/lua-language-server/tree/master/meta/3rd) embutido.' +config.workspace.supportScheme = +'Fornece language server para arquivos Lua dos seguintes schemes.' +config.completion.enable = +'Habilita autocompletar.' +config.completion.callSnippet = +'Mostra snippets de chamada de função.' +config.completion.callSnippet.Disable = +"Mostra apenas o `nome da função`." +config.completion.callSnippet.Both = +"Mostra o `nome da função` e o `trecho de chamada`." +config.completion.callSnippet.Replace = +"Mostra apenas o `trecho de chamada`." +config.completion.keywordSnippet = +'Mostra snippets de sintaxe de palavras-chave.' +config.completion.keywordSnippet.Disable = +"Mostra apenas a `palavra-chave`." +config.completion.keywordSnippet.Both = +"Mostra a `palavra-chave` e o `trecho de sintaxe`." +config.completion.keywordSnippet.Replace = +"Mostra apenas o `trecho de sintaxe`." +config.completion.displayContext = +"Pré-visualizar o trecho de código relevante da sugestão pode ajudar a entender seu uso. O número define quantas linhas são interceptadas no fragmento; definir como `0` desabilita este recurso." +config.completion.workspaceWord = +"Define se as palavras de contexto exibidas incluem conteúdo de outros arquivos da workspace." +config.completion.showWord = +"Mostrar palavras de contexto nas sugestões." +config.completion.showWord.Enable = +"Sempre mostrar palavras de contexto nas sugestões." +config.completion.showWord.Fallback = +"Mostrar palavras de contexto somente quando não houver sugestões baseadas em semântica." +config.completion.showWord.Disable = +"Não mostrar palavras de contexto." +config.completion.autoRequire = +"Quando a entrada se parece com um nome de arquivo, fazer `require` desse arquivo automaticamente." +config.completion.maxSuggestCount = +"Número máximo de campos analisados para autocompletar. Se um objeto tiver mais campos que esse limite, serão necessárias entradas mais específicas para que as sugestões apareçam." +config.completion.showParams = +"Mostrar parâmetros na lista de conclusão. Se a função tiver várias definições, elas serão exibidas separadamente." +config.completion.requireSeparator = +"Separador usado em `require`." +config.completion.postfix = +"Símbolo usado para acionar sugestões de pós-fixo." +config.color.mode = +"Modo de colorização." +config.color.mode.Semantic = +"Colorização semântica. Pode ser necessário definir `editor.semanticHighlighting.enabled` como `true`." +config.color.mode.SemanticEnhanced = +"Colorização semântica aprimorada; semelhante a `Semantic`, mas com análise extra (mais custosa computacionalmente)." +config.color.mode.Grammar = +"Colorização sintática." +config.semantic.enable = +"Habilita colorização semântica. Pode ser necessário definir `editor.semanticHighlighting.enabled` como `true`." +config.semantic.variable = +"Colorização semântica de variáveis/campos/parâmetros." +config.semantic.annotation = +"Colorização semântica de anotações de tipo." +config.semantic.keyword = +"Colorização semântica de palavras-chave/literais/operadores. Só habilite se seu editor não oferecer colorização sintática." +config.signatureHelp.enable = +"Habilitar ajuda de assinatura." +config.hover.enable = +"Habilitar hover." +config.hover.viewString = +"No hover, mostrar o conteúdo da string (apenas se o literal tiver caracteres de escape)." +config.hover.viewStringMax = +"Comprimento máximo da string exibida no hover." +config.hover.viewNumber = +"No hover, mostrar conteúdo numérico (apenas se o literal não for decimal)." +config.hover.fieldInfer = +"Ao inspecionar uma tabela no hover, inferir o tipo de cada campo; se o tempo acumulado atingir o limite (ms), os campos restantes serão ignorados." +config.hover.previewFields = +"Ao inspecionar uma tabela, limita o número máximo de campos pré-visualizados." +config.hover.enumsLimit = +"Quando um valor corresponde a vários tipos, limita quantos tipos são exibidos." +config.hover.expandAlias = [[ -Whether to expand the alias. For example, expands `---@alias myType boolean|number` appears as `boolean|number`, otherwise it appears as `myType'. +Definir se aliases devem ser expandidos. Por exemplo, `---@alias myType boolean|number` aparecerá como `boolean|number`; caso contrário aparecerá como `myType`. ]] -config.develop.enable = -- TODO: need translate! -'Developer mode. Do not enable, performance will be affected.' -config.develop.debuggerPort = -- TODO: need translate! -'Listen port of debugger.' -config.develop.debuggerWait = -- TODO: need translate! -'Suspend before debugger connects.' -config.intelliSense.searchDepth = -- TODO: need translate! -'Set the search depth for IntelliSense. Increasing this value increases accuracy, but decreases performance. Different workspace have different tolerance for this setting. Please adjust it to the appropriate value.' -config.intelliSense.fastGlobal = -- TODO: need translate! -'In the global variable completion, and view `_G` suspension prompt. This will slightly reduce the accuracy of type speculation, but it will have a significant performance improvement for projects that use a lot of global variables.' -config.window.statusBar = -- TODO: need translate! -'Show extension status in status bar.' -config.window.progressBar = -- TODO: need translate! -'Show progress bar in status bar.' -config.hint.enable = -- TODO: need translate! -'Enable inlay hint.' -config.hint.paramType = -- TODO: need translate! -'Show type hints at the parameter of the function.' -config.hint.setType = -- TODO: need translate! -'Show hints of type at assignment operation.' -config.hint.paramName = -- TODO: need translate! -'Show hints of parameter name at the function call.' -config.hint.paramName.All = -- TODO: need translate! -'All types of parameters are shown.' -config.hint.paramName.Literal = -- TODO: need translate! -'Only literal type parameters are shown.' -config.hint.paramName.Disable = -- TODO: need translate! -'Disable parameter hints.' -config.hint.arrayIndex = -- TODO: need translate! -'Show hints of array index when constructing a table.' -config.hint.arrayIndex.Enable = -- TODO: need translate! -'Show hints in all tables.' -config.hint.arrayIndex.Auto = -- TODO: need translate! -'Show hints only when the table is greater than 3 items, or the table is a mixed table.' -config.hint.arrayIndex.Disable = -- TODO: need translate! -'Disable hints of array index.' -config.hint.await = -- TODO: need translate! -'If the called function is marked `---@async`, prompt `await` at the call.' -config.hint.awaitPropagate = -- TODO: need translate! -'Enable the propagation of `await`. When a function calls a function marked `---@async`,\z -it will be automatically marked as `---@async`.' -config.hint.semicolon = -- TODO: need translate! -'If there is no semicolon at the end of the statement, display a virtual semicolon.' -config.hint.semicolon.All = -- TODO: need translate! -'All statements display virtual semicolons.' -config.hint.semicolon.SameLine = -- TODO: need translate! -'When two statements are on the same line, display a semicolon between them.' -config.hint.semicolon.Disable = -- TODO: need translate! -'Disable virtual semicolons.' -config.codeLens.enable = -- TODO: need translate! -'Enable code lens.' -config.format.enable = -- TODO: need translate! -'Enable code formatter.' -config.format.defaultConfig = -- TODO: need translate! +config.develop.enable = +'Modo desenvolvedor. Não habilite; afeta o desempenho.' +config.develop.debuggerPort = +'Porta de escuta do depurador.' +config.develop.debuggerWait = +'Suspender antes de o depurador conectar.' +config.intelliSense.searchDepth = +'Define a profundidade de busca do IntelliSense. Aumentar melhora a precisão, mas reduz o desempenho. Ajuste conforme a tolerância da sua workspace.' +config.intelliSense.fastGlobal = +'Para completar globais e inspecionar `_G`, prioriza desempenho (ligeira perda de precisão de tipo); útil em projetos com muitas variáveis globais.' +config.window.statusBar = +'Mostrar status da extensão na barra de status.' +config.window.progressBar = +'Mostrar barra de progresso na barra de status.' +config.hint.enable = +'Habilitar inlay hints.' +config.hint.paramType = +'Mostrar dicas de tipo nos parâmetros da função.' +config.hint.setType = +'Mostrar dicas de tipo em atribuições.' +config.hint.paramName = +'Mostrar dicas com o nome do parâmetro na chamada de função.' +config.hint.paramName.All = +'Mostrar todos os tipos de parâmetros.' +config.hint.paramName.Literal = +'Mostrar apenas parâmetros de tipo literal.' +config.hint.paramName.Disable = +'Desativar dicas de nome de parâmetro.' +config.hint.arrayIndex = +'Mostrar dicas de índice de array ao construir uma tabela.' +config.hint.arrayIndex.Enable = +'Mostrar dicas em todas as tabelas.' +config.hint.arrayIndex.Auto = +'Mostrar dicas apenas quando a tabela tiver mais de 3 itens ou for uma tabela mista.' +config.hint.arrayIndex.Disable = +'Desativar dicas de índice de array.' +config.hint.await = +'Se a função chamada estiver marcada com `---@async`, sugerir `await` na chamada.' +config.hint.awaitPropagate = +'Habilita a propagação de `await`. Quando uma função chama outra marcada com `---@async`, ela será automaticamente marcada como `---@async`.' +config.hint.semicolon = +'Se não houver ponto e vírgula no fim da instrução, mostrar um ponto e vírgula virtual.' +config.hint.semicolon.All = +'Todas as instruções exibem ponto e vírgula virtual.' +config.hint.semicolon.SameLine = +'Quando duas instruções estiverem na mesma linha, mostrar um ponto e vírgula entre elas.' +config.hint.semicolon.Disable = +'Desativar pontos e vírgulas virtuais.' +config.codeLens.enable = +'Habilitar code lens.' +config.format.enable = +'Habilitar formatador de código.' +config.format.defaultConfig = [[ -The default format configuration. Has a lower priority than `.editorconfig` file in the workspace. -Read [formatter docs](https://github.com/CppCXY/EmmyLuaCodeStyle/tree/master/docs) to learn usage. +Configuração de formatação padrão; tem prioridade menor que o arquivo `.editorconfig` da workspace. +Consulte a [documentação do formatador](https://github.com/CppCXY/EmmyLuaCodeStyle/tree/master/docs) para uso. ]] -config.spell.dict = -- TODO: need translate! -'Custom words for spell checking.' -config.nameStyle.config = -- TODO: need translate! +config.spell.dict = +'Palavras personalizadas para verificação ortográfica.' +config.nameStyle.config = [[ -Set name style config. -Read [formatter docs](https://github.com/CppCXY/EmmyLuaCodeStyle/tree/master/docs) to learn usage. +Configurações de estilo de nomes. +Consulte a [documentação do formatador](https://github.com/CppCXY/EmmyLuaCodeStyle/tree/master/docs) para uso. ]] -config.telemetry.enable = -- TODO: need translate! +config.telemetry.enable = [[ -Enable telemetry to send your editor information and error logs over the network. Read our privacy policy [here](https://luals.github.io/privacy/#language-server). +Habilita telemetria para enviar informações do editor e logs de erro pela rede. Leia nossa política de privacidade [aqui](https://luals.github.io/privacy/#language-server). ]] -config.misc.parameters = -- TODO: need translate! -'[Command line parameters](https://github.com/LuaLS/lua-telemetry-server/tree/master/method) when starting the language service in VSCode.' -config.misc.executablePath = -- TODO: need translate! -'Specify the executable path in VSCode.' -config.language.fixIndent = -- TODO: need translate! -'(VSCode only) Fix incorrect auto-indentation, such as incorrect indentation when line breaks occur within a string containing the word "function."' -config.language.completeAnnotation = -- TODO: need translate! -'(VSCode only) Automatically insert "---@ " after a line break following a annotation.' -config.type.castNumberToInteger = -- TODO: need translate! -'Allowed to assign the `number` type to the `integer` type.' -config.type.weakUnionCheck = -- TODO: need translate! +config.misc.parameters = +'[Parâmetros de linha de comando](https://github.com/LuaLS/lua-telemetry-server/tree/master/method) ao iniciar o serviço de linguagem no VSCode.' +config.misc.executablePath = +'Especifica o caminho do executável no VSCode.' +config.language.fixIndent = +'(Somente VSCode) Corrige indentação automática incorreta, como quebras de linha dentro de uma string contendo a palavra "function".' +config.language.completeAnnotation = +'(Somente VSCode) Insere automaticamente "---@ " após uma quebra de linha seguinte a uma anotação.' +config.type.castNumberToInteger = +'Permitir atribuir o tipo `number` ao tipo `integer`.' +config.type.weakUnionCheck = [[ -Once one subtype of a union type meets the condition, the union type also meets the condition. +Quando um subtipo de uma união atende à condição, considera-se que a união inteira atende. -When this setting is `false`, the `number|boolean` type cannot be assigned to the `number` type. It can be with `true`. +Quando esta opção for `false`, `number|boolean` não pode ser atribuído a `number`; com `true`, pode. ]] -config.type.weakNilCheck = -- TODO: need translate! +config.type.weakNilCheck = [[ -When checking the type of union type, ignore the `nil` in it. +Ao verificar um tipo união, ignora o `nil` presente nele. -When this setting is `false`, the `number|nil` type cannot be assigned to the `number` type. It can be with `true`. +Quando esta opção for `false`, `number|nil` não pode ser atribuído a `number`; com `true`, pode. ]] -config.type.inferParamType = -- TODO: need translate! +config.type.inferParamType = [[ -When the parameter type is not annotated, the parameter type is inferred from the function's incoming parameters. +Quando o parâmetro não tiver anotação, inferir o tipo a partir dos argumentos de chamada. -When this setting is `false`, the type of the parameter is `any` when it is not annotated. +Quando esta opção for `false`, o tipo do parâmetro será `any` se não houver anotação. ]] -config.type.checkTableShape = -- TODO: need translate! +config.type.checkTableShape = [[ -对表的形状进行严格检查。 +Verificação rigorosa do formato das tabelas. ]] -config.type.inferTableSize = -- TODO: need translate! -'Maximum number of table fields analyzed during type inference.' -config.doc.privateName = -- TODO: need translate! -'Treat specific field names as private, e.g. `m_*` means `XXX.m_id` and `XXX.m_type` are private, witch can only be accessed in the class where the definition is located.' -config.doc.protectedName = -- TODO: need translate! -'Treat specific field names as protected, e.g. `m_*` means `XXX.m_id` and `XXX.m_type` are protected, witch can only be accessed in the class where the definition is located and its subclasses.' -config.doc.packageName = -- TODO: need translate! -'Treat specific field names as package, e.g. `m_*` means `XXX.m_id` and `XXX.m_type` are package, witch can only be accessed in the file where the definition is located.' -config.doc.regengine = -- TODO: need translate! -'The regular expression engine used for matching documentation scope names.' -config.doc.regengine.glob = -- TODO: need translate! -'The default lightweight pattern syntax.' -config.doc.regengine.lua = -- TODO: need translate! -'Full Lua-style regular expressions.' -config.docScriptPath = -- TODO: need translate! -'The regular expression engine used for matching documentation scope names.' -config.diagnostics['unused-local'] = -- TODO: need translate! -'未使用的局部变量' -config.diagnostics['unused-function'] = -- TODO: need translate! -'未使用的函数' -config.diagnostics['undefined-global'] = -- TODO: need translate! -'未定义的全局变量' -config.diagnostics['global-in-nil-env'] = -- TODO: need translate! -'不能使用全局变量( `_ENV` 被设置为了 `nil`)' -config.diagnostics['unused-label'] = -- TODO: need translate! -'未使用的标签' -config.diagnostics['unused-vararg'] = -- TODO: need translate! -'未使用的不定参数' -config.diagnostics['trailing-space'] = -- TODO: need translate! -'后置空格' -config.diagnostics['redefined-local'] = -- TODO: need translate! -'重复定义的局部变量' -config.diagnostics['newline-call'] = -- TODO: need translate! -'以 `(` 开始的新行,在语法上被解析为了上一行的函数调用' -config.diagnostics['newfield-call'] = -- TODO: need translate! -'在字面量表中,2行代码之间缺少分隔符,在语法上被解析为了一次索引操作' -config.diagnostics['redundant-parameter'] = -- TODO: need translate! -'函数调用时,传入了多余的参数' -config.diagnostics['ambiguity-1'] = -- TODO: need translate! -'优先级歧义,如:`num or 0 + 1`,推测用户的实际期望为 `(num or 0) + 1` ' -config.diagnostics['lowercase-global'] = -- TODO: need translate! -'首字母小写的全局变量定义' -config.diagnostics['undefined-env-child'] = -- TODO: need translate! -'`_ENV` 被设置为了新的字面量表,但是试图获取的全局变量不再这张表中' -config.diagnostics['duplicate-index'] = -- TODO: need translate! -'在字面量表中重复定义了索引' -config.diagnostics['empty-block'] = -- TODO: need translate! -'空代码块' -config.diagnostics['redundant-value'] = -- TODO: need translate! -'赋值操作时,值的数量比被赋值的对象多' -config.diagnostics['assign-type-mismatch'] = -- TODO: need translate! -'Enable diagnostics for assignments in which the value\'s type does not match the type of the assigned variable.' -config.diagnostics['await-in-sync'] = -- TODO: need translate! -'Enable diagnostics for calls of asynchronous functions within a synchronous function.' -config.diagnostics['cast-local-type'] = -- TODO: need translate! -'Enable diagnostics for casts of local variables where the target type does not match the defined type.' -config.diagnostics['cast-type-mismatch'] = -- TODO: need translate! -'Enable diagnostics for casts where the target type does not match the initial type.' -config.diagnostics['circular-doc-class'] = -- TODO: need translate! -'Enable diagnostics for two classes inheriting from each other introducing a circular relation.' -config.diagnostics['close-non-object'] = -- TODO: need translate! -'Enable diagnostics for attempts to close a variable with a non-object.' -config.diagnostics['code-after-break'] = -- TODO: need translate! -'Enable diagnostics for code placed after a break statement in a loop.' -config.diagnostics['codestyle-check'] = -- TODO: need translate! -'Enable diagnostics for incorrectly styled lines.' -config.diagnostics['count-down-loop'] = -- TODO: need translate! -'Enable diagnostics for `for` loops which will never reach their max/limit because the loop is incrementing instead of decrementing.' -config.diagnostics['deprecated'] = -- TODO: need translate! -'Enable diagnostics to highlight deprecated API.' -config.diagnostics['different-requires'] = -- TODO: need translate! -'Enable diagnostics for files which are required by two different paths.' -config.diagnostics['discard-returns'] = -- TODO: need translate! -'Enable diagnostics for calls of functions annotated with `---@nodiscard` where the return values are ignored.' -config.diagnostics['doc-field-no-class'] = -- TODO: need translate! -'Enable diagnostics to highlight a field annotation without a defining class annotation.' -config.diagnostics['duplicate-doc-alias'] = -- TODO: need translate! -'Enable diagnostics for a duplicated alias annotation name.' -config.diagnostics['duplicate-doc-field'] = -- TODO: need translate! -'Enable diagnostics for a duplicated field annotation name.' -config.diagnostics['duplicate-doc-param'] = -- TODO: need translate! -'Enable diagnostics for a duplicated param annotation name.' -config.diagnostics['duplicate-set-field'] = -- TODO: need translate! -'Enable diagnostics for setting the same field in a class more than once.' -config.diagnostics['incomplete-signature-doc'] = -- TODO: need translate! -'Incomplete @param or @return annotations for functions.' -config.diagnostics['invisible'] = -- TODO: need translate! -'Enable diagnostics for accesses to fields which are invisible.' -config.diagnostics['missing-global-doc'] = -- TODO: need translate! -'Missing annotations for globals! Global functions must have a comment and annotations for all parameters and return values.' -config.diagnostics['missing-local-export-doc'] = -- TODO: need translate! -'Missing annotations for exported locals! Exported local functions must have a comment and annotations for all parameters and return values.' -config.diagnostics['missing-parameter'] = -- TODO: need translate! -'Enable diagnostics for function calls where the number of arguments is less than the number of annotated function parameters.' -config.diagnostics['missing-return'] = -- TODO: need translate! -'Enable diagnostics for functions with return annotations which have no return statement.' -config.diagnostics['missing-return-value'] = -- TODO: need translate! -'Enable diagnostics for return statements without values although the containing function declares returns.' -config.diagnostics['need-check-nil'] = -- TODO: need translate! -'Enable diagnostics for variable usages if `nil` or an optional (potentially `nil`) value was assigned to the variable before.' -config.diagnostics['unnecessary-assert'] = -- TODO: need translate! -'Enable diagnostics for redundant assertions on truthy values.' -config.diagnostics['no-unknown'] = -- TODO: need translate! -'Enable diagnostics for cases in which the type cannot be inferred.' -config.diagnostics['not-yieldable'] = -- TODO: need translate! -'Enable diagnostics for calls to `coroutine.yield()` when it is not permitted.' -config.diagnostics['param-type-mismatch'] = -- TODO: need translate! -'Enable diagnostics for function calls where the type of a provided parameter does not match the type of the annotated function definition.' -config.diagnostics['redundant-return'] = -- TODO: need translate! -'Enable diagnostics for return statements which are not needed because the function would exit on its own.' -config.diagnostics['redundant-return-value']= -- TODO: need translate! -'Enable diagnostics for return statements which return an extra value which is not specified by a return annotation.' -config.diagnostics['return-type-mismatch'] = -- TODO: need translate! -'Enable diagnostics for return values whose type does not match the type declared in the corresponding return annotation.' -config.diagnostics['spell-check'] = -- TODO: need translate! -'Enable diagnostics for typos in strings.' -config.diagnostics['name-style-check'] = -- TODO: need translate! -'Enable diagnostics for name style.' -config.diagnostics['unbalanced-assignments']= -- TODO: need translate! -'Enable diagnostics on multiple assignments if not all variables obtain a value (e.g., `local x,y = 1`).' -config.diagnostics['undefined-doc-class'] = -- TODO: need translate! -'Enable diagnostics for class annotations in which an undefined class is referenced.' -config.diagnostics['undefined-doc-name'] = -- TODO: need translate! -'Enable diagnostics for type annotations referencing an undefined type or alias.' -config.diagnostics['undefined-doc-param'] = -- TODO: need translate! -'Enable diagnostics for cases in which a parameter annotation is given without declaring the parameter in the function definition.' -config.diagnostics['undefined-field'] = -- TODO: need translate! -'Enable diagnostics for cases in which an undefined field of a variable is read.' -config.diagnostics['unknown-cast-variable'] = -- TODO: need translate! -'Enable diagnostics for casts of undefined variables.' -config.diagnostics['unknown-diag-code'] = -- TODO: need translate! -'Enable diagnostics in cases in which an unknown diagnostics code is entered.' -config.diagnostics['unknown-operator'] = -- TODO: need translate! -'Enable diagnostics for unknown operators.' -config.diagnostics['unreachable-code'] = -- TODO: need translate! -'Enable diagnostics for unreachable code.' -config.diagnostics['global-element'] = -- TODO: need translate! -'Enable diagnostics to warn about global elements.' -config.typeFormat.config = -- TODO: need translate! -'Configures the formatting behavior while typing Lua code.' -config.typeFormat.config.auto_complete_end = -- TODO: need translate! -'Controls if `end` is automatically completed at suitable positions.' -config.typeFormat.config.auto_complete_table_sep = -- TODO: need translate! -'Controls if a separator is automatically appended at the end of a table declaration.' -config.typeFormat.config.format_line = -- TODO: need translate! -'Controls if a line is formatted at all.' +config.type.inferTableSize = +'Número máximo de campos de tabela analisados durante a inferência de tipo.' +config.doc.privateName = +'Tratar nomes de campos específicos como privados; ex.: `m_*` significa que `XXX.m_id` e `XXX.m_type` são privados e só podem ser acessados na classe onde foram definidos.' +config.doc.protectedName = +'Tratar nomes de campos específicos como protegidos; ex.: `m_*` significa que `XXX.m_id` e `XXX.m_type` são protegidos e só podem ser acessados na classe onde foram definidos e em subclasses.' +config.doc.packageName = +'Tratar nomes de campos específicos como de pacote; ex.: `m_*` significa que `XXX.m_id` e `XXX.m_type` são de pacote e só podem ser acessados no arquivo onde foram definidos.' +config.doc.regengine = +'Mecanismo de expressão regular usado para corresponder nomes de escopo de documentação.' +config.doc.regengine.glob = +'Sintaxe de padrão leve padrão.' +config.doc.regengine.lua = +'Expressões regulares completas no estilo Lua.' +config.docScriptPath = +'Mecanismo de expressão regular usado para corresponder nomes de escopo de documentação.' +config.diagnostics['unused-local'] = +'Variável local não utilizada' +config.diagnostics['unused-function'] = +'Função não utilizada' +config.diagnostics['undefined-global'] = +'Variável global não definida' +config.diagnostics['global-in-nil-env'] = +'Não é possível usar variáveis globais (`_ENV` foi definido como `nil`)' +config.diagnostics['unused-label'] = +'Rótulo não utilizado' +config.diagnostics['unused-vararg'] = +'Parâmetro vararg não utilizado' +config.diagnostics['trailing-space'] = +'Espaços à direita' +config.diagnostics['redefined-local'] = +'Variável local redefinida' +config.diagnostics['newline-call'] = +'Nova linha iniciando com `(` é analisada como chamada da linha anterior' +config.diagnostics['newfield-call'] = +'Em uma tabela literal, faltou um separador entre duas linhas; foi interpretado como uma operação de índice' +config.diagnostics['redundant-parameter'] = +'Chamada de função com parâmetros em excesso' +config.diagnostics['ambiguity-1'] = +'Ambiguidade de precedência, por exemplo `num or 0 + 1`; supõe-se que o esperado seja `(num or 0) + 1`' +config.diagnostics['lowercase-global'] = +'Definição de variável global com inicial minúscula' +config.diagnostics['undefined-env-child'] = +'`_ENV` foi definido como nova tabela literal, mas a variável global acessada não está nela' +config.diagnostics['duplicate-index'] = +'Índice duplicado em tabela literal' +config.diagnostics['empty-block'] = +'Bloco vazio' +config.diagnostics['redundant-value'] = +'Em uma atribuição, há mais valores que variáveis-alvo' +config.diagnostics['assign-type-mismatch'] = +'Habilita diagnóstico para atribuições em que o tipo do valor não corresponde ao tipo da variável alvo.' +config.diagnostics['await-in-sync'] = +'Habilita diagnóstico para chamadas de funções assíncronas dentro de uma função síncrona.' +config.diagnostics['cast-local-type'] = +'Habilita diagnóstico para coerções de variáveis locais em que o tipo alvo não corresponde ao tipo definido.' +config.diagnostics['cast-type-mismatch'] = +'Habilita diagnóstico para coerções em que o tipo alvo não corresponde ao tipo inicial.' +config.diagnostics['circular-doc-class'] = +'Habilita diagnóstico para classes que herdam entre si, formando relação circular.' +config.diagnostics['close-non-object'] = +'Habilita diagnóstico para tentativas de fechar uma variável que não é objeto.' +config.diagnostics['code-after-break'] = +'Habilita diagnóstico para código após um `break` em um loop.' +config.diagnostics['codestyle-check'] = +'Habilita diagnóstico para linhas que violam o estilo de código.' +config.diagnostics['count-down-loop'] = +'Habilita diagnóstico para laços `for` decrescentes que nunca atingem o limite porque são incrementados.' +config.diagnostics['deprecated'] = +'Habilita diagnóstico para APIs obsoletas.' +config.diagnostics['different-requires'] = +'Habilita diagnóstico para arquivos exigidos por dois caminhos diferentes.' +config.diagnostics['discard-returns'] = +'Habilita diagnóstico para chamadas de funções anotadas com `---@nodiscard` quando os retornos são ignorados.' +config.diagnostics['doc-field-no-class'] = +'Habilita diagnóstico para anotações de campo sem anotação de classe correspondente.' +config.diagnostics['duplicate-doc-alias'] = +'Habilita diagnóstico para nome de alias anotado duplicado.' +config.diagnostics['duplicate-doc-field'] = +'Habilita diagnóstico para nome de campo anotado duplicado.' +config.diagnostics['duplicate-doc-param'] = +'Habilita diagnóstico para nome de parâmetro anotado duplicado.' +config.diagnostics['duplicate-set-field'] = +'Habilita diagnóstico para definir o mesmo campo em uma classe mais de uma vez.' +config.diagnostics['incomplete-signature-doc'] = +'Anotações @param ou @return incompletas para funções.' +config.diagnostics['invisible'] = +'Habilita diagnóstico para acessos a campos invisíveis.' +config.diagnostics['missing-global-doc'] = +'Faltam anotações para globais! Funções globais devem ter comentário e anotações para todos os parâmetros e retornos.' +config.diagnostics['missing-local-export-doc'] = +'Faltam anotações para locais exportados! Funções locais exportadas devem ter comentário e anotações para todos os parâmetros e retornos.' +config.diagnostics['missing-parameter'] = +'Habilita diagnóstico para chamadas de função com menos argumentos que os parâmetros anotados.' +config.diagnostics['missing-return'] = +'Habilita diagnóstico para funções com anotação de retorno mas sem instrução return.' +config.diagnostics['missing-return-value'] = +'Habilita diagnóstico para retornos sem valores embora a função declare valores de retorno.' +config.diagnostics['need-check-nil'] = +'Habilita diagnóstico para uso de variável após ela receber `nil` ou valor opcional.' +config.diagnostics['unnecessary-assert'] = +'Habilita diagnóstico para asserts redundantes em valores verdadeiros.' +config.diagnostics['no-unknown'] = +'Habilita diagnóstico para casos em que o tipo não pode ser inferido.' +config.diagnostics['not-yieldable'] = +'Habilita diagnóstico para chamadas de `coroutine.yield()` quando não permitido.' +config.diagnostics['param-type-mismatch'] = +'Habilita diagnóstico para chamadas onde o tipo do parâmetro fornecido não corresponde à definição anotada.' +config.diagnostics['redundant-return'] = +'Habilita diagnóstico para retornos desnecessários porque a função já terminaria.' +config.diagnostics['redundant-return-value']= +'Habilita diagnóstico para retornos que entregam valor extra não especificado na anotação.' +config.diagnostics['return-type-mismatch'] = +'Habilita diagnóstico para retornos cujo tipo não corresponde ao tipo declarado.' +config.diagnostics['spell-check'] = +'Habilita diagnóstico para erros ortográficos em strings.' +config.diagnostics['name-style-check'] = +'Habilita diagnóstico para estilo de nomes.' +config.diagnostics['unbalanced-assignments']= +'Habilita diagnóstico em múltiplas atribuições se nem todas as variáveis recebem valor (ex.: `local x,y = 1`).' +config.diagnostics['undefined-doc-class'] = +'Habilita diagnóstico para anotações de classe que fazem referência a classe indefinida.' +config.diagnostics['undefined-doc-name'] = +'Habilita diagnóstico para anotações de tipo que referenciam tipo ou alias indefinido.' +config.diagnostics['undefined-doc-param'] = +'Habilita diagnóstico para anotações de parâmetro sem declaração correspondente na função.' +config.diagnostics['undefined-field'] = +'Habilita diagnóstico para leitura de campo indefinido de uma variável.' +config.diagnostics['unknown-cast-variable'] = +'Habilita diagnóstico para coerções de variáveis indefinidas.' +config.diagnostics['unknown-diag-code'] = +'Habilita diagnóstico quando um código de diagnóstico desconhecido é informado.' +config.diagnostics['unknown-operator'] = +'Habilita diagnóstico para operadores desconhecidos.' +config.diagnostics['unreachable-code'] = +'Habilita diagnóstico para código inalcançável.' +config.diagnostics['global-element'] = +'Habilita diagnóstico para avisar sobre elementos globais.' +config.typeFormat.config = +'Configura o comportamento de formatação enquanto digita código Lua.' +config.typeFormat.config.auto_complete_end = +'Controla se `end` é completado automaticamente em posições adequadas.' +config.typeFormat.config.auto_complete_table_sep = +'Controla se um separador é adicionado automaticamente ao final de uma declaração de tabela.' +config.typeFormat.config.format_line = +'Controla se uma linha deve ser formatada.' -command.exportDocument = -- TODO: need translate! -'Lua: Export Document ...' -command.addon_manager.open = -- TODO: need translate! -'Lua: Open Addon Manager ...' -command.reloadFFIMeta = -- TODO: need translate! -'Lua: Reload luajit ffi meta' -command.startServer = -- TODO: need translate! -'Lua: Restart Language Server' -command.stopServer = -- TODO: need translate! -'Lua: Stop Language Server' +command.exportDocument = +'Lua: Exportar Documento ...' +command.addon_manager.open = +'Lua: Abrir Gerenciador de Addon ...' +command.reloadFFIMeta = +'Lua: Recarregar metadados luajit ffi' +command.startServer = +'Lua: Reiniciar Language Server' +command.stopServer = +'Lua: Parar Language Server' diff --git a/locale/zh-cn/meta.lua b/locale/zh-cn/meta.lua index c0a9b6013..c243434c8 100644 --- a/locale/zh-cn/meta.lua +++ b/locale/zh-cn/meta.lua @@ -6,65 +6,103 @@ arg = assert = '如果其参数 `v` 的值为假(`nil` 或 `false`), 它就调用 $error; 否则,返回所有的参数。 在错误情况时, `message` 指那个错误对象; 如果不提供这个参数,参数默认为 `"assertion failed!"` 。' -cgopt.collect = -'做一次完整的垃圾收集循环。' -cgopt.stop = -'停止垃圾收集器的运行。' -cgopt.restart = -'重启垃圾收集器的自动运行。' -cgopt.count = -'以 K 字节数为单位返回 Lua 使用的总内存数。' -cgopt.step = +collectgarbage51 = [[ -执行一次垃圾收集的“步骤”。此选项后可以带一个额外参数 `size`(整数)。 -如果 `size` 为正的 n,收集器的行为就像新分配了 n 个字节;如果为 0,则执行一个“基本步骤”。 -在增量模式下,基本步骤对应当前的步进大小;在分代模式下,基本步骤会执行一次完整的次要收集, -或在收集器已安排增量步骤时执行该增量步骤。 -在增量模式下,如果该步骤完成了一个收集周期,函数返回 `true`;在分代模式下,如果该步骤完成了一个主要收集,返回 `true`。 -]] -cgopt.setpause = -'将 `arg` 设为收集器的 *间歇率* 。' -cgopt.setstepmul = -'将 `arg` 设为收集器的 *步进倍率* 。' -cgopt.incremental = -'将收集器模式改为“增量模式”,并返回之前的模式(可能是 `"generational"` 或 `"incremental"`)。' -cgopt.generational = -'将收集器模式改为“分代模式”,并返回之前的模式(可能是 `"generational"` 或 `"incremental"`)。' -cgopt.isrunning = -'返回表示收集器是否在工作的布尔值。' -cgopt.param = +此函数是垃圾收集器的通用接口。根据其第一个参数 opt 执行不同的功能: + +* `"collect"`:执行一个完整的垃圾收集周期。这是默认选项。 +* `"stop"`:停止垃圾收集器。 +* `"restart"`:重启垃圾收集器。 +* `"count"`:返回 Lua 使用的总内存数(以 K 字节为单位)。 +* `"step"`:执行一次垃圾收集步骤。步骤的"大小"由 arg 控制(较大的值表示更多步骤),具体方式未指定。如果要控制步骤大小,必须通过实验调整 arg 的值。如果步骤完成了一个收集周期则返回 true。 +* `"setpause"`:将 arg 设置为收集器间歇率的新值(参见 §2.10)。返回间歇率的先前值。 +* `"setstepmul"`:将 arg 设置为收集器步进倍率的新值(参见 §2.10)。返回步进倍率的先前值。 +]] + +collectgarbage52 = +[[ +此函数是垃圾收集器的通用接口。根据其第一个参数 opt 执行不同的功能: + +* `"collect"`:执行一个完整的垃圾收集周期。这是默认选项。 +* `"stop"`:停止垃圾收集器的自动执行。收集器将仅在显式调用时运行,直到调用重启它。 +* `"restart"`:重启垃圾收集器的自动执行。 +* `"count"`:返回 Lua 使用的总内存数(以 K 字节为单位)和第二个值,表示总内存字节数模 1024。第一个值有小数部分,因此以下等式始终为真: + ```lua + k, b = collectgarbage("count") + assert(k*1024 == math.floor(k)*1024 + b) + ``` + (当 Lua 使用非浮点类型编译数字时,第二个结果很有用。) +* `"step"`:执行一次垃圾收集步骤。步骤的"大小"由 arg 控制(较大的值表示更多步骤),具体方式未指定。如果要控制步骤大小,必须通过实验调整 arg 的值。如果步骤完成了一个收集周期则返回 true。 +* `"setpause"`:将 arg 设置为收集器间歇率的新值(参见 §2.5)。返回间歇率的先前值。 +* `"setstepmul"`:将 arg 设置为收集器步进倍率的新值(参见 §2.5)。返回步进倍率的先前值。 +* `"isrunning"`:返回一个布尔值,指示收集器是否正在运行(即未停止)。 +* `"generational"`:将收集器更改为分代模式。这是一个实验性功能(参见 §2.5)。 +* `"incremental"`:将收集器更改为增量模式。这是默认模式。 +]] + +collectgarbage53 = [[ -更改和/或检索收集器参数的值。此选项后必须跟一个或两个额外参数: -要更改或检索的参数名称(字符串),以及该参数的可选新值(范围 [0,100000] 的整数)。 -调用总是返回该参数的“先前值”;如果未提供新值,则保持不变。Lua 以压缩格式存储这些值, -因此返回的先前值可能不完全等于上次设置的值。 -]] - -gcparam.minormul = -'次要乘数。' -gcparam.majorminor = -'主要-次要乘数。' -gcparam.minormajor = -'次要-主要乘数。' -gcparam.pause = -'垃圾收集器暂停。' -gcparam.stepmul = -'步进乘数。' -gcparam.stepsize = -'步进大小。' - -collectgarbage = +此函数是垃圾收集器的通用接口。根据其第一个参数 opt 执行不同的功能: + +* `"collect"`:执行一个完整的垃圾收集周期。这是默认选项。 +* `"stop"`:停止垃圾收集器的自动执行。收集器将仅在显式调用时运行,直到调用重启它。 +* `"restart"`:重启垃圾收集器的自动执行。 +* `"count"`:返回 Lua 使用的总内存数(以 K 字节为单位)。该值有小数部分,因此乘以 1024 即可得到 Lua 使用的精确字节数(除溢出外)。 +* `"step"`:执行一次垃圾收集步骤。步骤的"大小"由 arg 控制。值为零时,收集器将执行一个基本(不可分割的)步骤。对于非零值,收集器的行为就像 Lua 分配了相应数量的内存(以 K 字节为单位)。如果步骤完成了一个收集周期则返回 true。 +* `"setpause"`:将 arg 设置为收集器间歇率的新值(参见 §2.5)。返回间歇率的先前值。 +* `"setstepmul"`:将 arg 设置为收集器步进倍率的新值(参见 §2.5)。返回步进倍率的先前值。 +* "isrunning"`:返回一个布尔值,指示收集器是否正在运行(即未停止)。 +]] + +collectgarbage54 = [[ -该函数是垃圾收集器的通用接口,根据第一个参数 `opt` 执行不同的功能: -• `"collect"`:执行一次完整的垃圾收集循环(默认选项)。 -• `"stop"`:停止垃圾收集器的自动执行;之后仅在显式调用时运行,直到 `"restart"`。 -• `"restart"`:重启垃圾收集器的自动执行。 -• `"count"`:返回 Lua 当前使用的总内存(单位为 K字节,含小数;乘以 1024 得到字节数)。 -• `"step"`:执行一次垃圾收集步骤,可选参数 `size` 控制步长;行为与返回值见 `cgopt.step` 的说明。 -• `"isrunning"`:返回一个布尔值,指示收集器是否正在运行(即未被停止)。 -• `"incremental"`:将模式改为增量模式,并返回之前的模式。 -• `"generational"`:将模式改为分代模式,并返回之前的模式。 -• `"param"`:更改/检索收集器参数(见各 `gcparam.*` 项),总是返回该参数的先前值。 +此函数是垃圾收集器的通用接口。根据其第一个参数 opt 执行不同的功能: + +* `"collect"`:执行一个完整的垃圾收集周期。这是默认选项。 +* `"stop"`:停止垃圾收集器的自动执行。收集器将仅在显式调用时运行,直到调用重启它。 +* `"restart"`:重启垃圾收集器的自动执行。 +* `"count"`:返回 Lua 使用的总内存数(以 K 字节为单位)。该值有小数部分,因此乘以 1024 即可得到 Lua 使用的精确字节数。 +* `"step"`:执行一次垃圾收集步骤。步骤的"大小"由 arg 控制。值为零时,收集器将执行一个基本(不可分割的)步骤。对于非零值,收集器的行为就像 Lua 分配了相应数量的内存(以 K 字节为单位)。如果步骤完成了一个收集周期则返回 true。 +* `"isrunning"`:返回一个布尔值,指示收集器是否正在运行(即未停止)。 +* `"incremental"`:将收集器模式更改为增量模式。此选项后可以跟三个数字:垃圾收集器间歇率、步进倍率和步进大小(参见 §2.5.1)。零表示不更改该值。 +* `"generational"`:将收集器模式更改为分代模式。此选项后可以跟两个数字:垃圾收集器次要乘数和主要乘数(参见 §2.5.2)。零表示不更改该值。 +有关垃圾收集和其中一些选项的更多详细信息,请参见 §2.5。 + +终结器不应调用此函数。 +]] + +collectgarbage55 = +[[ +此函数是垃圾收集器的通用接口。根据其第一个参数 opt 执行不同的功能: + +* `"collect"`:执行一个完整的垃圾收集周期。这是默认选项。 +* `"stop"`:停止垃圾收集器的自动执行。收集器将仅在显式调用时运行,直到调用重启它。 +* `"restart"`:重启垃圾收集器的自动执行。 +* `"count"`:返回 Lua 使用的总内存数(以 K 字节为单位)。该值有小数部分,因此乘以 1024 即可得到 Lua 使用的精确字节数。 +* `"step"`:执行一次垃圾收集步骤。此选项后可以跟一个额外参数,一个表示步进大小的整数。 + + 如果大小为正数 n,收集器的行为就像分配了 n 个新字节。如果大小为零,收集器执行一个基本步骤。在增量模式下,基本步骤对应于当前步进大小。在分代模式下,基本步骤执行一次完整的次要收集,或者如果收集器已安排了增量步骤,则执行增量步骤。 + + 在增量模式下,如果步骤完成了一个收集周期,函数返回 true。在分代模式下,如果步骤完成了一次主要收集,函数返回 true。 + +* `"isrunning"`:返回一个布尔值,指示收集器是否正在运行(即未停止)。 +* `"incremental"`:将收集器模式更改为增量模式并返回先前的模式。 +* `"generational"`:将收集器模式更改为分代模式并返回先前的模式。 +* `"param"`:更改和/或检索收集器参数的值。此选项后必须跟一个或两个额外参数:被更改或检索的参数名称(字符串)和该参数的可选新值,范围为 [0,100000] 的整数。第一个参数必须是以下值之一: + * `"minormul"`:次要乘数。 + * `"majorminor"`:主要-次要乘数。 + * `"minormajor"`:次要-主要乘数。 + * `"pause"`:垃圾收集器间歇率。 + * `"stepmul"`:步进倍率。 + * `"stepsize"`:步进大小。 + + 调用总是返回参数的先前值。如果调用未提供新值,则该值保持不变。 + + Lua 以压缩格式存储这些值,因此作为先前值返回的值可能不完全等于上次设置的值。 + +有关垃圾收集和其中一些选项的更多详细信息,请参见 §2.5。 + +终结器不应调用此函数。 ]] dofile = @@ -664,6 +702,10 @@ string.dump = '返回包含有以二进制方式表示的(一个 *二进制代码块* )指定函数的字符串。' string.find = '查找第一个字符串中匹配到的 `pattern`(参见 §6.4.1)。' +string.find['>5.2'] = +'在字符串中查找与 `pattern`(参见 §6.4.1)匹配的第一个部分。' +string.find['=5.1'] = +'在字符串中查找与 `pattern`(参见 §5.4.1)匹配的第一个部分。' string.format = '返回不定数量参数的格式化版本,格式化串为第一个参数。' string.gmatch = @@ -681,6 +723,36 @@ string.gmatch = ]] string.gsub = '将字符串 s 中,所有的(或是在 n 给出时的前 n 个) pattern (参见 §6.4.1)都替换成 repl ,并返回其副本。' +string.gmatch['>5.2'] = +[[ +返回一个迭代器函数。每次调用都会在字符串 s 上继续按 `pattern`(参见 §6.4.1)匹配,并返回下一组捕获值。 + +例如,下面的循环会遍历字符串 s 中的所有单词,并逐行打印: +```lua + s = +"hello world from Lua" + for w in string.gmatch(s, "%a+") do + print(w) + end +``` +]] +string.gmatch['=5.1'] = +[[ +返回一个迭代器函数。每次调用都会在字符串 s 上继续按 `pattern`(参见 §5.4.1)匹配,并返回下一组捕获值。 + +例如,下面的循环会遍历字符串 s 中的所有单词,并逐行打印: +```lua + s = +"hello world from Lua" + for w in string.gmatch(s, "%a+") do + print(w) + end +``` +]] +string.gsub['>5.2'] = +'返回字符串 s 的副本,其中所有(或在给出 n 时的前 n 个)`pattern`(参见 §6.4.1)都被 `repl` 替换。' +string.gsub['=5.1'] = +'返回字符串 s 的副本,其中所有(或在给出 n 时的前 n 个)`pattern`(参见 §5.4.1)都被 `repl` 替换。' string.len = '返回其长度。' string.lower = @@ -691,6 +763,14 @@ string.pack = '返回一个打包了(即以二进制形式序列化) v1, v2 等值的二进制字符串。 字符串 fmt 为打包格式(参见 §6.4.2)。' string.packsize = [[返回以指定格式用 $string.pack 打包的字符串的长度。 格式化字符串中不可以有变长选项 's' 或 'z' (参见 §6.4.2)。]] +string.match['>5.2'] = +'在字符串中查找与 `pattern`(参见 §6.4.1)匹配的第一个部分。' +string.match['=5.1'] = +'在字符串中查找与 `pattern`(参见 §5.4.1)匹配的第一个部分。' +string.pack['>5.2'] = +'返回一个包含值 `v1`、`v2` 等,按照格式字符串 `fmt`(参见 §6.4.2)打包(即以二进制形式序列化)的二进制字符串。' +string.packsize['>5.2'] = +'返回使用指定格式字符串 `fmt`(参见 §6.4.2)调用 $string.pack 得到的字符串大小。' string.rep['>5.2'] = '返回 `n` 个字符串 `s` 以字符串 `sep` 为分割符连在一起的字符串。 默认的 `sep` 值为空字符串(即没有分割符)。 如果 `n` 不是正数则返回空串。' string.rep['<5.1'] = diff --git a/locale/zh-cn/script.lua b/locale/zh-cn/script.lua index e14676a49..5a69dd712 100644 --- a/locale/zh-cn/script.lua +++ b/locale/zh-cn/script.lua @@ -44,10 +44,13 @@ DIAG_AMBIGUITY_1 = '会优先运算 `{}`,你可能需要加个括号。' DIAG_LOWERCASE_GLOBAL = '首字母小写的全局变量,你是否漏了 `local` 或是有拼写错误?' + ASSIGN_CONST_GLOBAL = '不能赋值给 全局变量 `{}`。' + VARIABLE_NOT_DECLARED = '未声明的变量 `{}`(当前已使用 global 语法声明作用域)。' + DIAG_EMPTY_BLOCK = '空代码块' DIAG_DIAGNOSTICS = @@ -382,7 +385,7 @@ HOVER_DOCUMENT_LUA53 = HOVER_DOCUMENT_LUA54 = 'https://www.lua.org/manual/5.4/manual.html#{}' HOVER_DOCUMENT_LUA55 = -'https://www.lua.org/work/doc/manual.html#{}' +'https://www.lua.org/manual/5.5/manual.html#{}' HOVER_DOCUMENT_LUAJIT = 'https://www.lua.org/manual/5.1/manual.html#{}' HOVER_NATIVE_DOCUMENT_LUA51 = @@ -670,6 +673,8 @@ CLI_CHECK_SUCCESS = '诊断完成,没有发现问题' CLI_CHECK_PROGRESS = '检测到问题 {} 在文件 {} 中' +CLI_CHECK_RESULTS= +'诊断完成,发现 {} 个问题,请查看 {}' CLI_CHECK_RESULTS_OUTPATH = '诊断完成,共有 {} 个问题,请查看 {}' CLI_CHECK_RESULTS_PRETTY = diff --git a/locale/zh-cn/setting.lua b/locale/zh-cn/setting.lua index 1e6ef7db6..056867792 100644 --- a/locale/zh-cn/setting.lua +++ b/locale/zh-cn/setting.lua @@ -114,10 +114,14 @@ config.diagnostics.ignoredFiles.Opened = "只有打开这些文件时才会诊断。" config.diagnostics.ignoredFiles.Disable = "不诊断这些文件。" +config.diagnostics.disableScheme = +'对使用以下 scheme 的 Lua 文件不进行诊断。' config.diagnostics.validScheme = '对使用以下 scheme 的lua文件启用诊断。' config.diagnostics.unusedLocalExclude = '如果变量名匹配以下规则,则不对其进行 `unused-local` 诊断。' +config.diagnostics.validScheme = +'对使用以下 scheme 的lua文件启用诊断。' config.workspace.ignoreDir = "忽略的文件与目录(使用 `.gitignore` 语法)。" config.workspace.ignoreSubmodules = @@ -177,6 +181,8 @@ config.completion.showWord.Disable = "不显示上下文单词。" config.completion.autoRequire = "输入内容看起来是个文件名时,自动 `require` 此文件。" +config.completion.maxSuggestCount = +"自动完成时最多分析的字段数量。当对象字段超过此上限时,需要更精确的输入才会显示补全。" config.completion.showParams = "在建议列表中显示函数的参数信息,函数拥有多个定义时会分开显示。" config.completion.requireSeparator = diff --git a/locale/zh-tw/meta.lua b/locale/zh-tw/meta.lua index e458f28e3..b76715457 100644 --- a/locale/zh-tw/meta.lua +++ b/locale/zh-tw/meta.lua @@ -6,66 +6,103 @@ arg = assert = '如果其引數 `v` 的值為假( `nil` 或 `false` ),它就擲回 $error ;否則,回傳所有的引數。在發生錯誤時, `message` 是錯誤物件;如果不提供這個引數,預設為 `"assertion failed!"` 。' -cgopt.collect = -'做一次完整的垃圾回收循環。' -cgopt.stop = -'停止垃圾回收器的執行。' -cgopt.restart = -'重新啟動垃圾回收器的自動執行。' -cgopt.count = -'以 K 位元組數為單位回傳 Lua 使用的總記憶體數。' -cgopt.step = +collectgarbage51 = [[ -執行一次垃圾回收的「步驟」。此選項後可帶一個額外參數 `size`(整數)。 -若 `size` 為正的 n,回收器的行為就像新分配了 n 個位元組;若為 0,則執行一個「基本步驟」。 -在增量模式下,基本步驟對應目前的步進大小;在分代模式下,基本步驟會執行一次完整的次要回收, -或在回收器已安排增量步驟時執行該增量步驟。 -在增量模式下,若此步驟完成了一個回收週期,函式回傳 `true`;在分代模式下,若此步驟完成了一次主要回收,則回傳 `true`。 -]] -cgopt.setpause = -'將 `arg` 設為回收器的 *間歇率* 。' -cgopt.setstepmul = -'將 `arg` 設為回收器的 *步進倍率* 。' -cgopt.incremental = -'將回收器模式改為增量模式,並回傳先前的模式(可能為 `"generational"` 或 `"incremental"`)。' -cgopt.generational = -'將回收器模式改為分代模式,並回傳先前的模式(可能為 `"generational"` 或 `"incremental"`)。' -cgopt.param = +此函式是垃圾回收器的通用介面。根據其第一個引數 opt 執行不同的功能: + +* `"collect"`:執行一個完整的垃圾回收週期。這是預設選項。 +* `"stop"`:停止垃圾回收器。 +* `"restart"`:重新啟動垃圾回收器。 +* `"count"`:回傳 Lua 使用的總記憶體數(以 K 位元組為單位)。 +* `"step"`:執行一次垃圾回收步驟。步驟的「大小」由 arg 控制(較大的值表示更多步驟),具體方式未指定。如果要控制步驟大小,必須透過實驗調整 arg 的值。如果步驟完成了一個回收週期則回傳 true。 +* `"setpause"`:將 arg 設定為回收器間歇率的新值(參見 §2.10)。回傳間歇率的先前值。 +* `"setstepmul"`:將 arg 設定為回收器步進倍率的新值(參見 §2.10)。回傳步進倍率的先前值。 +]] + +collectgarbage52 = +[[ +此函式是垃圾回收器的通用介面。根據其第一個引數 opt 執行不同的功能: + +* `"collect"`:執行一個完整的垃圾回收週期。這是預設選項。 +* `"stop"`:停止垃圾回收器的自動執行。回收器將僅在顯式呼叫時執行,直到呼叫重新啟動它。 +* `"restart"`:重新啟動垃圾回收器的自動執行。 +* `"count"`:回傳 Lua 使用的總記憶體數(以 K 位元組為單位)和第二個值,表示總記憶體位元組數模 1024。第一個值有小數部分,因此以下等式始終為真: + ```lua + k, b = collectgarbage("count") + assert(k*1024 == math.floor(k)*1024 + b) + ``` + (當 Lua 使用非浮點型別編譯數字時,第二個結果很有用。) +* `"step"`:執行一次垃圾回收步驟。步驟的「大小」由 arg 控制(較大的值表示更多步驟),具體方式未指定。如果要控制步驟大小,必須透過實驗調整 arg 的值。如果步驟完成了一個回收週期則回傳 true。 +* `"setpause"`:將 arg 設定為回收器間歇率的新值(參見 §2.5)。回傳間歇率的先前值。 +* `"setstepmul"`:將 arg 設定為回收器步進倍率的新值(參見 §2.5)。回傳步進倍率的先前值。 +* `"isrunning"`:回傳一個布林值,指示回收器是否正在執行(即未停止)。 +* `"generational"`:將回收器變更為分代模式。這是一個實驗性功能(參見 §2.5)。 +* `"incremental"`:將回收器變更為增量模式。這是預設模式。 +]] + +collectgarbage53 = [[ -更改和/或檢索回收器參數的值。此選項後必須接一或兩個額外參數: -欲更改或檢索的參數名稱(字串),以及該參數的可選新值(介於 [0,100000] 的整數)。 -呼叫總是回傳該參數的「先前值」;若未提供新值,則維持不變。Lua 以壓縮格式儲存這些值, -因此回傳的先前值可能不完全等於上次設定的值。 -]] - -gcparam.minormul = -'次要乘數。' -gcparam.majorminor = -'主要-次要乘數。' -gcparam.minormajor = -'次要-主要乘數。' -gcparam.pause = -'垃圾回收器暫停。' -gcparam.stepmul = -'步進乘數。' -gcparam.stepsize = -'步進大小。' - -cgopt.isrunning = -'回傳表示回收器是否在工作的布林值。' - -collectgarbage = +此函式是垃圾回收器的通用介面。根據其第一個引數 opt 執行不同的功能: + +* `"collect"`:執行一個完整的垃圾回收週期。這是預設選項。 +* `"stop"`:停止垃圾回收器的自動執行。回收器將僅在顯式呼叫時執行,直到呼叫重新啟動它。 +* `"restart"`:重新啟動垃圾回收器的自動執行。 +* `"count"`:回傳 Lua 使用的總記憶體數(以 K 位元組為單位)。該值有小數部分,因此乘以 1024 即可得到 Lua 使用的精確位元組數(除溢位外)。 +* `"step"`:執行一次垃圾回收步驟。步驟的「大小」由 arg 控制。值為零時,回收器將執行一個基本(不可分割的)步驟。對於非零值,回收器的行為就像 Lua 分配了相應數量的記憶體(以 K 位元組為單位)。如果步驟完成了一個回收週期則回傳 true。 +* `"setpause"`:將 arg 設定為回收器間歇率的新值(參見 §2.5)。回傳間歇率的先前值。 +* `"setstepmul"`:將 arg 設定為回收器步進倍率的新值(參見 §2.5)。回傳步進倍率的先前值。 +* "isrunning"`:回傳一個布林值,指示回收器是否正在執行(即未停止)。 +]] + +collectgarbage54 = [[ -垃圾回收器的一般介面;依第一個引數 `opt` 執行不同功能: -• `"collect"`:執行一次完整的垃圾回收(預設)。 -• `"stop"`:停止回收器的自動執行;之後僅在顯式呼叫時執行,直到 `"restart"`。 -• `"restart"`:重新啟動回收器的自動執行。 -• `"count"`:回傳 Lua 目前使用的總記憶體(KBytes,含小數;乘以 1024 得到位元組數)。 -• `"step"`:執行一次回收步驟;可選整數 `size` 控制行為與回傳值(參見 `cgopt.step`)。 -• `"isrunning"`:回傳布林值,指示回收器是否正在執行(未停止)。 -• `"incremental"`:切換為增量模式並回傳先前的模式。 -• `"generational"`:切換為分代模式並回傳先前的模式。 -• `"param"`:更改/讀取回收器參數(見各 `gcparam.*` 項),總是回傳該參數的先前值。 +此函式是垃圾回收器的通用介面。根據其第一個引數 opt 執行不同的功能: + +* `"collect"`:執行一個完整的垃圾回收週期。這是預設選項。 +* `"stop"`:停止垃圾回收器的自動執行。回收器將僅在顯式呼叫時執行,直到呼叫重新啟動它。 +* `"restart"`:重新啟動垃圾回收器的自動執行。 +* `"count"`:回傳 Lua 使用的總記憶體數(以 K 位元組為單位)。該值有小數部分,因此乘以 1024 即可得到 Lua 使用的精確位元組數。 +* `"step"`:執行一次垃圾回收步驟。步驟的「大小」由 arg 控制。值為零時,回收器將執行一個基本(不可分割的)步驟。對於非零值,回收器的行為就像 Lua 分配了相應數量的記憶體(以 K 位元組為單位)。如果步驟完成了一個回收週期則回傳 true。 +* `"isrunning"`:回傳一個布林值,指示回收器是否正在執行(即未停止)。 +* `"incremental"`:將回收器模式變更為增量模式。此選項後可以接三個數字:垃圾回收器間歇率、步進倍率和步進大小(參見 §2.5.1)。零表示不變更該值。 +* `"generational"`:將回收器模式變更為分代模式。此選項後可以接兩個數字:垃圾回收器次要乘數和主要乘數(參見 §2.5.2)。零表示不變更該值。 +有關垃圾回收和其中一些選項的更多詳細資訊,請參見 §2.5。 + +終結器不應呼叫此函式。 +]] + +collectgarbage55 = +[[ +此函式是垃圾回收器的通用介面。根據其第一個引數 opt 執行不同的功能: + +* `"collect"`:執行一個完整的垃圾回收週期。這是預設選項。 +* `"stop"`:停止垃圾回收器的自動執行。回收器將僅在顯式呼叫時執行,直到呼叫重新啟動它。 +* `"restart"`:重新啟動垃圾回收器的自動執行。 +* `"count"`:回傳 Lua 使用的總記憶體數(以 K 位元組為單位)。該值有小數部分,因此乘以 1024 即可得到 Lua 使用的精確位元組數。 +* `"step"`:執行一次垃圾回收步驟。此選項後可以接一個額外引數,一個表示步進大小的整數。 + + 如果大小為正數 n,回收器的行為就像分配了 n 個新位元組。如果大小為零,回收器執行一個基本步驟。在增量模式下,基本步驟對應於目前步進大小。在分代模式下,基本步驟執行一次完整的次要回收,或者如果回收器已安排了增量步驟,則執行增量步驟。 + + 在增量模式下,如果步驟完成了一個回收週期,函式回傳 true。在分代模式下,如果步驟完成了一次主要回收,函式回傳 true。 + +* `"isrunning"`:回傳一個布林值,指示回收器是否正在執行(即未停止)。 +* `"incremental"`:將回收器模式變更為增量模式並回傳先前的模式。 +* `"generational"`:將回收器模式變更為分代模式並回傳先前的模式。 +* `"param"`:變更和/或檢索回收器參數的值。此選項後必須接一個或兩個額外引數:被變更或檢索的參數名稱(字串)和該參數的可選新值,範圍為 [0,100000] 的整數。第一個引數必須是以下值之一: + * `"minormul"`:次要乘數。 + * `"majorminor"`:主要-次要乘數。 + * `"minormajor"`:次要-主要乘數。 + * `"pause"`:垃圾回收器間歇率。 + * `"stepmul"`:步進倍率。 + * `"stepsize"`:步進大小。 + + 呼叫總是回傳參數的先前值。如果呼叫未提供新值,則該值保持不變。 + + Lua 以壓縮格式儲存這些值,因此作為先前值回傳的值可能不完全等於上次設定的值。 + +有關垃圾回收和其中一些選項的更多詳細資訊,請參見 §2.5。 + +終結器不應呼叫此函式。 ]] dofile = @@ -670,6 +707,10 @@ string.dump = '回傳包含有以二進制方式表示的(一個 *二進制程式碼區塊* )指定函式的字串。' string.find = '尋找第一個字串中配對到的 `pattern`(參見 §6.4.1)。' +string.find['>5.2'] = +'尋找字串中符合 `pattern`(參見 §6.4.1)的第一個配對。' +string.find['=5.1'] = +'尋找字串中符合 `pattern`(參見 §5.4.1)的第一個配對。' string.format = '回傳不定數量引數的格式化版本,格式化字串為第一個引數。' string.gmatch = @@ -687,6 +728,36 @@ string.gmatch = ]] string.gsub = '將字串 s 中,所有的(或是有提供 n 時的前 n 個) `pattern` (參見 §6.4.1)都替換成 `repl` ,並回傳其副本。' +string.gmatch['>5.2'] = +[[ +回傳一個疊代器函式。每次呼叫都會以 `pattern`(參見 §6.4.1)在字串 s 上繼續配對,並回傳下一組捕獲值。 + +例如,下列迴圈會疊代字串 s 中的所有單詞,並逐行列印: +```lua + s = +"hello world from Lua" + for w in string.gmatch(s, "%a+") do + print(w) + end +``` +]] +string.gmatch['=5.1'] = +[[ +回傳一個疊代器函式。每次呼叫都會以 `pattern`(參見 §5.4.1)在字串 s 上繼續配對,並回傳下一組捕獲值。 + +例如,下列迴圈會疊代字串 s 中的所有單詞,並逐行列印: +```lua + s = +"hello world from Lua" + for w in string.gmatch(s, "%a+") do + print(w) + end +``` +]] +string.gsub['>5.2'] = +'回傳字串 s 的副本,其中所有(或有提供 n 時的前 n 個)`pattern`(參見 §6.4.1)都被 `repl` 取代。' +string.gsub['=5.1'] = +'回傳字串 s 的副本,其中所有(或有提供 n 時的前 n 個)`pattern`(參見 §5.4.1)都被 `repl` 取代。' string.len = '回傳其長度。' string.lower = @@ -697,6 +768,14 @@ string.pack = '回傳一個壓縮了(即以二進制形式序列化) v1, v2 等值的二進制字串。字串 `fmt` 為壓縮格式(參見 §6.4.2)。' string.packsize = [[回傳以指定格式用 $string.pack 壓縮的字串的長度。格式化字串中不可以有變長選項 's' 或 'z' (參見 §6.4.2)。]] +string.match['>5.2'] = +'尋找字串中符合 `pattern`(參見 §6.4.1)的第一個配對。' +string.match['=5.1'] = +'尋找字串中符合 `pattern`(參見 §5.4.1)的第一個配對。' +string.pack['>5.2'] = +'依照格式字串 `fmt`(參見 §6.4.2)打包(也就是以二進位形式序列化)值 `v1`、`v2` 等,並回傳包含結果的二進位字串。' +string.packsize['>5.2'] = +'回傳使用指定格式字串 `fmt`(參見 §6.4.2)呼叫 $string.pack 所得到字串的大小。' string.rep['>5.2'] = '回傳 `n` 個由字串 `s` 以字串 `sep` 為分割符連在一起的字串。預設的 `sep` 值為空字串(即沒有分割符)。如果 `n` 不是正數則回傳空字串。' string.rep['<5.1'] = diff --git a/locale/zh-tw/script.lua b/locale/zh-tw/script.lua index 15639c954..a70ad8467 100644 --- a/locale/zh-tw/script.lua +++ b/locale/zh-tw/script.lua @@ -44,6 +44,13 @@ DIAG_AMBIGUITY_1 = '會優先運算 `{}` ,你可能需要加個括號。' DIAG_LOWERCASE_GLOBAL = '首字母小寫的全域變數,你是否漏了 `local` 或是有拼寫錯誤?' + +ASSIGN_CONST_GLOBAL = +'不能對 全域變數 `{}` 賦值。' + +VARIABLE_NOT_DECLARED = +'變數 `{}` 未宣告(全域宣告已啟用)。' + DIAG_EMPTY_BLOCK = '空程式碼區塊' DIAG_DIAGNOSTICS = @@ -377,6 +384,8 @@ HOVER_DOCUMENT_LUA53 = 'http://cloudwu.github.io/lua53doc/manual.html#{}' HOVER_DOCUMENT_LUA54 = 'https://www.lua.org/manual/5.4/manual.html#{}' +HOVER_DOCUMENT_LUA55 = +'https://www.lua.org/manual/5.5/manual.html#{}' HOVER_DOCUMENT_LUAJIT = 'https://www.lua.org/manual/5.1/manual.html#{}' HOVER_NATIVE_DOCUMENT_LUA51 = @@ -387,6 +396,8 @@ HOVER_NATIVE_DOCUMENT_LUA53 = 'command:extension.lua.doc?["zh-cn/53/manual.html/{}"]' HOVER_NATIVE_DOCUMENT_LUA54 = 'command:extension.lua.doc?["en-us/54/manual.html/{}"]' +HOVER_NATIVE_DOCUMENT_LUA55 = +'command:extension.lua.doc?["en-us/55/manual.html/{}"]' HOVER_NATIVE_DOCUMENT_LUAJIT = 'command:extension.lua.doc?["en-us/51/manual.html/{}"]' HOVER_MULTI_PROTOTYPE = @@ -662,6 +673,8 @@ CLI_CHECK_SUCCESS = '診斷完成,沒有發現問題' CLI_CHECK_PROGRESS = '在檔案 {2} 中檢測到問題 {1}' +CLI_CHECK_RESULTS= +'診斷完成,發現 {} 個問題,請查看 {}' CLI_CHECK_RESULTS_OUTPATH = '診斷完成,共有 {} 個問題,請查看 {}' CLI_CHECK_RESULTS_PRETTY = diff --git a/locale/zh-tw/setting.lua b/locale/zh-tw/setting.lua index 51ba06b7d..de8d79792 100644 --- a/locale/zh-tw/setting.lua +++ b/locale/zh-tw/setting.lua @@ -6,8 +6,8 @@ config.addonManager.repositoryBranch = "指定插件管理器(Addon Manager)使用的git branch。" config.addonManager.repositoryPath = "指定插件管理器(Addon Manager)使用的git path。" -config.addonRepositoryPath = -- TODO: need translate! -"Specifies the addon repository path (not related to the addon manager)." +config.addonRepositoryPath = +"指定獨立的插件倉庫路徑(與插件管理器無關)。" config.runtime.version = "Lua執行版本。" config.runtime.path = @@ -114,6 +114,10 @@ config.diagnostics.ignoredFiles.Opened = "只有打開這些檔案時才會診斷。" config.diagnostics.ignoredFiles.Disable = "不診斷這些檔案。" +config.diagnostics.disableScheme = +'對使用以下 scheme 的 Lua 檔案不進行診斷。' +config.diagnostics.validScheme = +'對使用以下 scheme 的lua檔案啟用診斷。' config.diagnostics.unusedLocalExclude = '如果變數名符合以下規則,則不對其進行 `unused-local` 診斷。' config.diagnostics.validScheme = @@ -177,6 +181,8 @@ config.completion.showWord.Disable = "不顯示上下文單詞。" config.completion.autoRequire = "輸入內容看起來像檔名時,自動 `require` 此檔案。" +config.completion.maxSuggestCount = +"自動完成時最多分析的欄位數量。若物件欄位超過此上限,必須提供更精確的輸入才會顯示建議。" config.completion.showParams = "在建議列表中顯示函式的參數資訊,函式擁有多個定義時會分開顯示。" config.completion.requireSeparator = @@ -278,10 +284,10 @@ config.format.defaultConfig = ]] config.spell.dict = '拼寫檢查的自訂單詞。' -config.nameStyle.config = -- TODO: need translate! +config.nameStyle.config = [[ 設定檢查命名風格的組態。 -Read [formatter docs](https://github.com/CppCXY/EmmyLuaCodeStyle/tree/master/docs) to learn usage. +閱讀 [formatter docs](https://github.com/CppCXY/EmmyLuaCodeStyle/tree/master/docs) 了解用法。 ]] config.telemetry.enable = [[ @@ -319,22 +325,22 @@ config.type.checkTableShape = [[ 對表的形狀進行嚴格檢查。 ]] -config.type.inferTableSize = -- TODO: need translate! -'Maximum number of table fields analyzed during type inference.' +config.type.inferTableSize = +'在類型推斷時最多分析的表欄位數。' config.doc.privateName = '將特定名稱的欄位視為private,例如 `m_*` 代表 `XXX.m_id` 和 `XXX.m_type` 會是私有層級,只能在定義所在的類別內存取' config.doc.protectedName = '將特定名稱的欄位視為protected,例如 `m_*` 代表 `XXX.m_id` 和 `XXX.m_type` 會是保護層級,只能在定義所在的類別和其子類別內存取' config.doc.packageName = '將特定名稱的欄位視為package,例如 `m_*` 代表 `XXX.m_id` 和 `XXX.m_type` 只能在定義所在的檔案內存取' -config.doc.regengine = -- TODO: need translate! -'The regular expression engine used for matching documentation scope names.' -config.doc.regengine.glob = -- TODO: need translate! -'The default lightweight pattern syntax.' -config.doc.regengine.lua = -- TODO: need translate! -'Full Lua-style regular expressions.' -config.docScriptPath = -- TODO: need translate! -'The regular expression engine used for matching documentation scope names.' +config.doc.regengine = +'用於匹配文件作用域名稱的正則表達式引擎。' +config.doc.regengine.glob = +'預設的輕量模式語法。' +config.doc.regengine.lua = +'完整的 Lua 風格正則表達式。' +config.docScriptPath = +'用於匹配文件作用域名稱的正則表達式引擎。' config.diagnostics['unused-local'] = '未使用的區域變數' config.diagnostics['unused-function'] = diff --git a/main.lua b/main.lua index 630acb272..312107c05 100644 --- a/main.lua +++ b/main.lua @@ -56,10 +56,10 @@ METAPATH = METAPATH and util.expandPath(METAPATH) or (ROOT:string() .. '/meta') util.enableCloseFunction() util.enableFormatString() ----@diagnostic disable-next-line: deprecated -debug.setcstacklimit(200) -collectgarbage('generational', 10, 50) +--collectgarbage('generational', 10, 50) --collectgarbage('incremental', 120, 120, 0) +collectgarbage('param', 'minormul', 10) +collectgarbage('param', 'minormajor', 50) ---@diagnostic disable-next-line: lowercase-global log = require 'log' diff --git a/make.lua b/make.lua index 51722f3ab..59bfb2dcf 100644 --- a/make.lua +++ b/make.lua @@ -2,6 +2,7 @@ local lm = require 'luamake' lm.c = lm.compiler == 'msvc' and 'c89' or 'c11' lm.cxx = 'c++17' +lm.lua = '55' if lm.sanitize then lm.mode = "debug" @@ -23,7 +24,7 @@ lm:import "make/code_format.lua" lm:source_set 'lpeglabel' { rootdir = '3rd', - includes = "bee.lua/3rd/lua54", + includes = "bee.lua/3rd/lua55", sources = "lpeglabel/*.c", defines = { 'MAXRECLEVEL=1000', @@ -41,7 +42,7 @@ lm:executable "lua-language-server" { }, includes = { "3rd/bee.lua", - "3rd/bee.lua/3rd/lua54", + "3rd/bee.lua/3rd/lua55", }, sources = "make/modules.cpp", windows = { diff --git a/meta/template/basic.lua b/meta/template/basic.lua index d28863a8d..0402c1a4d 100644 --- a/meta/template/basic.lua +++ b/meta/template/basic.lua @@ -13,34 +13,76 @@ arg = {} ---@return any ... function assert(v, message, ...) end - ----@alias gcoptions ----|>"collect" # ---#DESTAIL 'cgopt.collect' ----| "stop" # ---#DESTAIL 'cgopt.stop' ----| "restart" # ---#DESTAIL 'cgopt.restart' ----| "count" # ---#DESTAIL 'cgopt.count' ----| "step" # ---#DESTAIL 'cgopt.step' ----| "isrunning" # ---#DESTAIL 'cgopt.isrunning' ----#if VERSION >= 5.4 then ----| "incremental" # ---#DESTAIL 'cgopt.incremental' ----| "generational" # ---#DESTAIL 'cgopt.generational' +---#if VERSION == 5.1 then +---#DES 'collectgarbage51' +---@overload fun(opt?: "collect") +---@overload fun(opt: "stop") +---@overload fun(opt: "restart") +---@overload fun(opt: "count"): number +---@overload fun(opt: "step", arg: integer): true +---@overload fun(opt: "setpause", arg: integer): integer +---@overload fun(opt: "setstepmul", arg: integer): integer +function collectgarbage(...) end ---#end ----#if VERSION >= 5.5 then ----| "param" # ---#DESTAIL 'cgopt.param' + +---#if VERSION == 5.2 then +---#DES 'collectgarbage52' +---@overload fun(opt?: "collect") +---@overload fun(opt: "stop") +---@overload fun(opt: "restart") +---@overload fun(opt: "count"): number +---@overload fun(opt: "step", arg: integer): true +---@overload fun(opt: "setpause", arg: integer): integer +---@overload fun(opt: "setstepmul", arg: integer): integer +---@overload fun(opt: "isrunning"): boolean +---@overload fun(opt: "generational") +---@overload fun(opt: "incremental") +function collectgarbage(...) end ---#end ----#if VERSION < 5.4 then ----| "setpause" # ---#DESTAIL 'cgopt.setpause' ----| "setstepmul" # ---#DESTAIL 'cgopt.setstepmul' + +---#if VERSION == 5.3 then +---#DES 'collectgarbage53' +---@overload fun(opt?: "collect") +---@overload fun(opt: "stop") +---@overload fun(opt: "restart") +---@overload fun(opt: "count"): number +---@overload fun(opt: "step", arg: integer): true +---@overload fun(opt: "setpause", arg: integer): integer +---@overload fun(opt: "setstepmul", arg: integer): integer +---@overload fun(opt: "isrunning"): boolean +function collectgarbage(...) end ---#end ---#if VERSION == 5.4 then ----#DES 'collectgarbage' ----@param opt? gcoptions ----@return any -function collectgarbage(opt, ...) end ----#else ----#DES 'collectgarbage' -function collectgarbage(opt, arg) end +---#DES 'collectgarbage54' +---@overload fun(opt?: "collect") +---@overload fun(opt: "stop") +---@overload fun(opt: "restart") +---@overload fun(opt: "count"): number +---@overload fun(opt: "step", arg: integer): true +---@overload fun(opt: "isrunning"): boolean +---@overload fun(opt: "incremental", pause?: integer, multiplier?: integer, stepsize?: integer) +---@overload fun(opt: "generational", minor?: integer, major?: integer) +function collectgarbage(...) end +---#end + +---#if VERSION == 5.5 then +---#DES 'collectgarbage55' +---@overload fun(opt?: "collect") +---@overload fun(opt: "stop") +---@overload fun(opt: "restart") +---@overload fun(opt: "count"): number +---@overload fun(opt: "step", arg: integer): true +---@overload fun(opt: "isrunning"): boolean +---@overload fun(opt: "incremental"): "generational" | "incremental" +---@overload fun(opt: "generational"): "generational" | "incremental" +---@overload fun(opt: "param", arg: "minormul", value?: integer): integer +---@overload fun(opt: "param", arg: "majorminor", value?: integer): integer +---@overload fun(opt: "param", arg: "minormajor", value?: integer): integer +---@overload fun(opt: "param", arg: "pause", value?: integer): integer +---@overload fun(opt: "param", arg: "stepmul", value?: integer): integer +---@overload fun(opt: "param", arg: "stepsize", value?: integer): integer +function collectgarbage(...) end ---#end ---#DES 'dofile' diff --git a/script/cli/check_worker.lua b/script/cli/check_worker.lua index 190702634..83440df0a 100644 --- a/script/cli/check_worker.lua +++ b/script/cli/check_worker.lua @@ -148,12 +148,12 @@ end local function apply_check_level(uri, checkLevel) local config_disables = util.arrayToHash(config.get(uri, 'Lua.diagnostics.disable')) local config_severities = config.get(uri, 'Lua.diagnostics.severity') - for name, serverity in pairs(define.DiagnosticDefaultSeverity) do - serverity = config_severities[name] or serverity - if serverity:sub(-1) == '!' then - serverity = serverity:sub(1, -2) + for name, defaultSeverity in pairs(define.DiagnosticDefaultSeverity) do + local severity = config_severities[name] or defaultSeverity + if severity:sub(-1) == '!' then + severity = severity:sub(1, -2) end - if define.DiagnosticSeverity[serverity] > checkLevel then + if define.DiagnosticSeverity[severity] > checkLevel then config_disables[name] = true end end diff --git a/script/cli/doc/export.lua b/script/cli/doc/export.lua index 2088b9e52..e7fe0ce78 100644 --- a/script/cli/doc/export.lua +++ b/script/cli/doc/export.lua @@ -283,8 +283,8 @@ end ---@param callback fun(i, max) function export.makeDocs(globals, callback) local docs = {} - for i, global in ipairs(globals) do - table.insert(docs, export.documentObject(global)) + for i, globalVar in ipairs(globals) do + table.insert(docs, export.documentObject(globalVar)) callback(i, #globals) end docs[#docs+1] = export.getLualsConfig() diff --git a/script/cli/visualize.lua b/script/cli/visualize.lua index 29269b826..306284ed0 100644 --- a/script/cli/visualize.lua +++ b/script/cli/visualize.lua @@ -1,6 +1,7 @@ local lang = require 'language' local parser = require 'parser' local guide = require 'parser.guide' +local util = require 'utility' local function nodeId(node) return node.type .. ':' .. node.start .. ':' .. node.finish @@ -36,7 +37,9 @@ local function getTooltip(node) local skipNodes = {parent = true, start = true, finish = true, type = true} str = str .. getTooltipLine('start', node.start) str = str .. getTooltipLine('finish', node.finish) - for k, v in pairs(node) do + for k, v in util.sortPairs(node, function (a, b) + return tostring(a) < tostring(b) + end) do if type(k) ~= 'number' and not skipNodes[k] then str = str .. getTooltipLine(k, v) end diff --git a/script/client.lua b/script/client.lua index 9c5523dbd..d06248985 100644 --- a/script/client.lua +++ b/script/client.lua @@ -485,7 +485,7 @@ local function tryModifyClientGlobal(finalChanges) end local changes = {} for _, change in ipairs(finalChanges) do - if change.global then + if change['global'] then changes[#changes+1] = change end end diff --git a/script/config/config.lua b/script/config/config.lua index b10b0a6dd..129085e41 100644 --- a/script/config/config.lua +++ b/script/config/config.lua @@ -205,7 +205,8 @@ function m.update(scp, ...) scp:set('config.raw', {}) local function expand(t, left) - for key, value in pairs(t) do + for key, val in pairs(t) do + local value = val local fullKey = key if left then fullKey = left .. '.' .. key diff --git a/script/core/code-action.lua b/script/core/code-action.lua index c00d24eb6..a453c9874 100644 --- a/script/core/code-action.lua +++ b/script/core/code-action.lua @@ -694,17 +694,17 @@ local function checkMissingRequire(results, uri, start, finish) return end - local function addRequires(global, endpos) - if not global then + local function addRequires(globalVar, endpos) + if not globalVar then return end - autoreq.check(state, global, endpos, function (moduleFile, _stemname, _targetSource, fullKeyPath) + autoreq.check(state, globalVar, endpos, function (moduleFile, _stemname, _targetSource, fullKeyPath) local visiblePaths = rpath.getVisiblePath(uri, furi.decode(moduleFile)) if not visiblePaths or #visiblePaths == 0 then return end for _, target in ipairs(findRequireTargets(visiblePaths)) do results[#results+1] = { - title = lang.script('ACTION_AUTOREQUIRE', target .. (fullKeyPath or ''), global), + title = lang.script('ACTION_AUTOREQUIRE', target .. (fullKeyPath or ''), globalVar), kind = 'refactor.rewrite', command = { title = 'autoRequire', @@ -713,7 +713,7 @@ local function checkMissingRequire(results, uri, start, finish) { uri = guide.getUri(state.ast), target = moduleFile, - name = global, + name = globalVar, requireName = target, fullKeyPath = fullKeyPath, }, diff --git a/script/core/definition.lua b/script/core/definition.lua index 75a1433f5..b0914cfc0 100644 --- a/script/core/definition.lua +++ b/script/core/definition.lua @@ -158,7 +158,8 @@ return function (uri, offset) local defs = vm.getDefs(source) - for _, src in ipairs(defs) do + for _, def in ipairs(defs) do + local src = def if src.type == 'global' then goto CONTINUE end diff --git a/script/core/diagnostics/global-element.lua b/script/core/diagnostics/global-element.lua index fd7a3ca07..3e1c636ed 100644 --- a/script/core/diagnostics/global-element.lua +++ b/script/core/diagnostics/global-element.lua @@ -57,9 +57,9 @@ return function (uri, callback) end if definedGlobal[name] == nil then definedGlobal[name] = false - local global = vm.getGlobal('variable', name) - if global then - for _, set in ipairs(global:getSets(uri)) do + local globalVar = vm.getGlobal('variable', name) + if globalVar then + for _, set in ipairs(globalVar:getSets(uri)) do if vm.isMetaFile(guide.getUri(set)) then definedGlobal[name] = true return diff --git a/script/core/diagnostics/lowercase-global.lua b/script/core/diagnostics/lowercase-global.lua index 2b4e80612..a7e195b16 100644 --- a/script/core/diagnostics/lowercase-global.lua +++ b/script/core/diagnostics/lowercase-global.lua @@ -66,9 +66,9 @@ return function (uri, callback) end if definedGlobal[name] == nil then definedGlobal[name] = false - local global = vm.getGlobal('variable', name) - if global then - for _, set in ipairs(global:getSets(uri)) do + local globalVar = vm.getGlobal('variable', name) + if globalVar then + for _, set in ipairs(globalVar:getSets(uri)) do if vm.isMetaFile(guide.getUri(set)) then definedGlobal[name] = true return diff --git a/script/core/implementation.lua b/script/core/implementation.lua index 51538ee2e..ffd48ac75 100644 --- a/script/core/implementation.lua +++ b/script/core/implementation.lua @@ -92,7 +92,8 @@ return function (uri, offset) local defs = vm.getRefs(source) - for _, src in ipairs(defs) do + for _, def in ipairs(defs) do + local src = def if not guide.isAssign(src) then goto CONTINUE end diff --git a/script/core/reference.lua b/script/core/reference.lua index 4a0500b47..8c87f7ce9 100644 --- a/script/core/reference.lua +++ b/script/core/reference.lua @@ -74,7 +74,8 @@ return function (uri, position, includeDeclaration) local refs = vm.getRefs(source) local results = {} - for _, src in ipairs(refs) do + for _, ref in ipairs(refs) do + local src = ref local root = guide.getRoot(src) if not root then goto CONTINUE diff --git a/script/core/rename.lua b/script/core/rename.lua index afff8a4a7..2473bc702 100644 --- a/script/core/rename.lua +++ b/script/core/rename.lua @@ -218,8 +218,8 @@ local function ofGlobal(source, newname, callback) if not key then return end - local global = vm.getGlobal('variable', key) - if not global then + local globalVar = vm.getGlobal('variable', key) + if not globalVar then return end local refs = vm.getRefs(source) @@ -238,12 +238,12 @@ end ---@async local function ofDocTypeName(source, newname, callback) local oldname = source[1] - local global = vm.getGlobal('type', oldname) - if not global then + local globalVar = vm.getGlobal('type', oldname) + if not globalVar then return end local uri = guide.getUri(source) - for _, doc in ipairs(global:getSets(uri)) do + for _, doc in ipairs(globalVar:getSets(uri)) do if doc.type == 'doc.class' then callback(doc, doc.class.start, doc.class.finish, newname) end diff --git a/script/core/semantic-tokens.lua b/script/core/semantic-tokens.lua index 8d3ad1aec..6a14fc2a4 100644 --- a/script/core/semantic-tokens.lua +++ b/script/core/semantic-tokens.lua @@ -24,10 +24,10 @@ local Care = util.switch() local isLib = options.libGlobals[name] if isLib == nil then isLib = false - local global = vm.getGlobal('variable', name) - if global then + local globalVar = vm.getGlobal('variable', name) + if globalVar then local uri = guide.getUri(source) - for _, set in ipairs(global:getSets(uri)) do + for _, set in ipairs(globalVar:getSets(uri)) do if vm.isMetaFile(guide.getUri(set)) then isLib = true break @@ -39,7 +39,7 @@ local Care = util.switch() local isFunc = vm.getInfer(source):hasFunction(guide.getUri(source)) local type = isFunc and define.TokenTypes['function'] or define.TokenTypes.variable - local modifier = isLib and define.TokenModifiers.defaultLibrary or define.TokenModifiers.global + local modifier = isLib and define.TokenModifiers.defaultLibrary or define.TokenModifiers['global'] if source.declare then modifier = modifier | define.TokenModifiers.declaration diff --git a/script/core/type-definition.lua b/script/core/type-definition.lua index ccdb2f96f..113364eba 100644 --- a/script/core/type-definition.lua +++ b/script/core/type-definition.lua @@ -134,7 +134,8 @@ return function (uri, offset) local defs = vm.getDefs(source) - for _, src in ipairs(defs) do + for _, def in ipairs(defs) do + local src = def local root = guide.getRoot(src) if not root then goto CONTINUE diff --git a/script/core/workspace-symbol.lua b/script/core/workspace-symbol.lua index d197889a1..0c1adc7c9 100644 --- a/script/core/workspace-symbol.lua +++ b/script/core/workspace-symbol.lua @@ -58,14 +58,14 @@ end ---@param suri? uri ---@param results table[] local function searchGlobalAndClass(key, suri, results) - for _, global in pairs(vm.getAllGlobals()) do - local name = global:getCodeName() + for _, globalVar in pairs(vm.getAllGlobals()) do + local name = globalVar:getCodeName() if matchKey(key, name) then local sets if suri then - sets = global:getSets(suri) + sets = globalVar:getSets(suri) else - sets = global:getAllSets() + sets = globalVar:getAllSets() end for _, set in ipairs(sets) do local skind, ckind @@ -98,21 +98,21 @@ local function searchClassField(key, suri, results) if not class then return end - local global = vm.getGlobal('type', class) - if not global then + local globalVar = vm.getGlobal('type', class) + if not globalVar then return end local set if suri then - set = global:getSets(suri)[1] + set = globalVar:getSets(suri)[1] else - set = global:getAllSets()[1] + set = globalVar:getAllSets()[1] end if not set then return end suri = suri or guide.getUri(set) - vm.getClassFields(suri, global, vm.ANY, function (field) + vm.getClassFields(suri, globalVar, vm.ANY, function (field) if field.type == 'generic' then return end diff --git a/script/library.lua b/script/library.lua index 850ed35cf..6a38c573c 100644 --- a/script/library.lua +++ b/script/library.lua @@ -243,8 +243,8 @@ local function initBuiltIn(uri) end local out = fsu.dummyFS() local templateDir = ROOT / 'meta' / 'template' - for libName, status in pairs(define.BuiltIn) do - status = config.get(uri, 'Lua.runtime.builtin')[libName] or status + for libName, builtinStatus in pairs(define.BuiltIn) do + local status = config.get(uri, 'Lua.runtime.builtin')[libName] or builtinStatus log.debug('Builtin status:', libName, status) ---@type fs.path @@ -368,7 +368,8 @@ local function loadSingle3rdConfig(libraryDir) end end if cfg.files then - for i, filename in ipairs(cfg.files) do + for i, fname in ipairs(cfg.files) do + local filename = fname if plat.os == 'windows' then filename = filename:gsub('/', '\\') else diff --git a/script/parser/compile.lua b/script/parser/compile.lua index 7205f77fa..f3b36ba91 100644 --- a/script/parser/compile.lua +++ b/script/parser/compile.lua @@ -4369,8 +4369,16 @@ function parseAction() return parseLocal() end - if token == 'global' and isKeyWord('global', Tokens[Index + 3]) then - return parseGlobal() + if token == 'global' then + local nextToken = Tokens[Index + 3] + if isKeyWord('global', nextToken) then + if not nextToken + or nextToken == '*' + or nextToken == '<' + or CharMapWord[ssub(nextToken, 1, 1)] then + return parseGlobal() + end + end end if token == 'if' diff --git a/script/plugins/ffi/c-parser/cpp.lua b/script/plugins/ffi/c-parser/cpp.lua index eaa343305..8f0bfd3d6 100644 --- a/script/plugins/ffi/c-parser/cpp.lua +++ b/script/plugins/ffi/c-parser/cpp.lua @@ -185,8 +185,9 @@ cpp.initial_processing = typed("FILE* -> LineList", function(fd) local state = "any" local output = {} local linenr = 0 - for line in fd:lines() do + for lineVal in fd:lines() do linenr = linenr + 1 + local line = lineVal local len = #line if line:find("\\", len, true) then -- If backslash-terminated, buffer it diff --git a/script/plugins/ffi/init.lua b/script/plugins/ffi/init.lua index 9a8b6cd92..410c0875a 100644 --- a/script/plugins/ffi/init.lua +++ b/script/plugins/ffi/init.lua @@ -118,7 +118,8 @@ function builder:getType(name) t = t .. name.type .. "@" name = name.name end - for _, n in ipairs(name) do + for _, part in ipairs(name) do + local n = part if type(n) == 'table' then n = n.full_name end diff --git a/script/provider/provider.lua b/script/provider/provider.lua index 1601c2acd..dcf465901 100644 --- a/script/provider/provider.lua +++ b/script/provider/provider.lua @@ -61,10 +61,10 @@ function m.updateConfig(uri) end if client.getAbility('workspace.configuration') then - local global = cfgLoader.loadClientConfig() + local globalConfig = cfgLoader.loadClientConfig() log.info('Load config from client', 'fallback') - log.info(inspect(global)) - config.update(scope.fallback, global) + log.info(inspect(globalConfig)) + config.update(scope.fallback, globalConfig) end end diff --git a/script/service/service.lua b/script/service/service.lua index e2a779615..bd087433f 100644 --- a/script/service/service.lua +++ b/script/service/service.lua @@ -242,17 +242,6 @@ function m.reportStatus() proto.notify('$/status/report', info) end -function m.testVersion() - local stack = debug.setcstacklimit(200) - debug.setcstacklimit(stack + 1) - if type(stack) == 'number' and debug.setcstacklimit(stack) == stack + 1 then - proto.notify('window/showMessage', { - type = 2, - message = 'It seems to be running in Lua 5.4.0 or Lua 5.4.1 . Please upgrade to Lua 5.4.2 or above. Otherwise, it may encounter weird "C stack overflow", resulting in failure to work properly', - }) - end -end - function m.sayHello() proto.notify('$/hello', {'world'}) end @@ -287,7 +276,6 @@ function m.start() proto.listen('stdio') end m.report() - m.testVersion() m.lockCache() require 'provider' diff --git a/script/vm/compiler.lua b/script/vm/compiler.lua index f0c9f879b..af7b7cc69 100644 --- a/script/vm/compiler.lua +++ b/script/vm/compiler.lua @@ -155,16 +155,16 @@ local function searchFieldByGlobalID(suri, source, key, pushResult) if type(key) ~= 'string' then return end - local global = vm.getGlobal('variable', node.name, key) - if global then - for _, set in ipairs(global:getSets(suri)) do + local globalVar = vm.getGlobal('variable', node.name, key) + if globalVar then + for _, set in ipairs(globalVar:getSets(suri)) do pushResult(set) end end else local globals = vm.getGlobalFields('variable', node.name) - for _, global in ipairs(globals) do - for _, set in ipairs(global:getSets(suri)) do + for _, globalVar in ipairs(globals) do + for _, set in ipairs(globalVar:getSets(suri)) do pushResult(set) end end @@ -353,11 +353,11 @@ local searchFieldSwitch = util.switch() if not source.node[1] then return end - local global = vm.getGlobal('type', source.node[1]) - if not global then + local globalVar = vm.getGlobal('type', source.node[1]) + if not globalVar then return end - vm.getClassFields(suri, global, key, pushResult) + vm.getClassFields(suri, globalVar, key, pushResult) end) : case 'global' : call(function (suri, node, key, pushResult) @@ -366,16 +366,16 @@ local searchFieldSwitch = util.switch() if type(key) ~= 'string' then return end - local global = vm.getGlobal('variable', node.name, key) - if global then - for _, set in ipairs(global:getSets(suri)) do + local globalVar = vm.getGlobal('variable', node.name, key) + if globalVar then + for _, set in ipairs(globalVar:getSets(suri)) do pushResult(set) end end else local globals = vm.getGlobalFields('variable', node.name) - for _, global in ipairs(globals) do - for _, set in ipairs(global:getSets(suri)) do + for _, globalVar in ipairs(globals) do + for _, set in ipairs(globalVar:getSets(suri)) do pushResult(set) end end @@ -589,9 +589,9 @@ function vm.getClassFields(suri, object, key, pushResult) pushResult(set) end elseif type(key) == 'string' then - local global = vm.getGlobal('variable', key) - if global then - for _, set in ipairs(global:getSets(suri)) do + local globalVar = vm.getGlobal('variable', key) + if globalVar then + for _, set in ipairs(globalVar:getSets(suri)) do pushResult(set) end end @@ -2077,11 +2077,11 @@ local compilerSwitch = util.switch() if not source.node[1] then return end - local global = vm.getGlobal('type', source.node[1]) - if not global then + local globalVar = vm.getGlobal('type', source.node[1]) + if not globalVar then return end - for _, set in ipairs(global:getSets(uri)) do + for _, set in ipairs(globalVar:getSets(uri)) do if set.type == 'doc.class' then if set.extends then for _, ext in ipairs(set.extends) do @@ -2203,12 +2203,12 @@ local compilerSwitch = util.switch() : case 'globalbase' : call(function (source) ---@type vm.global - local global = source.global + local globalNode = source['global'] local uri = guide.getUri(source) local scp = scope.getScope(uri) - vm.setNode(source, global) - if global.cate == 'variable' then - for luri, link in pairs(global.links) do + vm.setNode(source, globalNode) + if globalNode.cate == 'variable' then + for luri, link in pairs(globalNode.links) do if not scp:isVisible(luri) then goto continue end @@ -2226,8 +2226,8 @@ local compilerSwitch = util.switch() ::continue:: end end - if global.cate == 'type' then - for _, set in ipairs(global:getSets(uri)) do + if globalNode.cate == 'type' then + for _, set in ipairs(globalNode:getSets(uri)) do if set.type == 'doc.class' then if set.extends then for _, ext in ipairs(set.extends) do diff --git a/script/vm/doc.lua b/script/vm/doc.lua index c60bb9894..a2689439b 100644 --- a/script/vm/doc.lua +++ b/script/vm/doc.lua @@ -18,11 +18,11 @@ local config = require 'config' ---@return parser.object[] function vm.getDocSets(suri, name) if name then - local global = vm.getGlobal('type', name) - if not global then + local globalVar = vm.getGlobal('type', name) + if not globalVar then return {} end - return global:getSets(suri) + return globalVar:getSets(suri) else return vm.getGlobalSets(suri, 'type') end @@ -502,10 +502,10 @@ function vm.getCastTargetHead(doc) doc._castTargetHead = loc return loc end - local global = vm.getGlobal('variable', name) - if global then - doc._castTargetHead = global - return global + local globalVar = vm.getGlobal('variable', name) + if globalVar then + doc._castTargetHead = globalVar + return globalVar end return nil end diff --git a/script/vm/field.lua b/script/vm/field.lua index 806986b1b..0c78cd8f3 100644 --- a/script/vm/field.lua +++ b/script/vm/field.lua @@ -5,9 +5,9 @@ local guide = require 'parser.guide' local searchByNodeSwitch = util.switch() : case 'global' - ---@param global vm.global - : call(function (suri, global, pushResult) - for _, set in ipairs(global:getSets(suri)) do + ---@param globalVar vm.global + : call(function (suri, globalVar, pushResult) + for _, set in ipairs(globalVar:getSets(suri)) do pushResult(set) end end) diff --git a/script/vm/global.lua b/script/vm/global.lua index b25ed5f0f..8281c7d93 100644 --- a/script/vm/global.lua +++ b/script/vm/global.lua @@ -139,11 +139,11 @@ function mt:getParentBase(uri) return nil end local parentName = self.cate .. '|' .. parentID - local global = allGlobals[parentName] - if not global then + local globalVar = allGlobals[parentName] + if not globalVar then return nil end - local link = global.links[uri] + local link = globalVar.links[uri] if not link then return nil end @@ -204,9 +204,9 @@ local compilerGlobalSwitch = util.switch() if not name then return end - local global = vm.declareGlobal('variable', name, uri) - global:addSet(uri, source) - source._globalNode = global + local globalVar = vm.declareGlobal('variable', name, uri) + globalVar:addSet(uri, source) + source._globalNode = globalVar end) : case 'getglobal' : call(function (source) @@ -215,9 +215,9 @@ local compilerGlobalSwitch = util.switch() if not name then return end - local global = vm.declareGlobal('variable', name, uri) - global:addGet(uri, source) - source._globalNode = global + local globalVar = vm.declareGlobal('variable', name, uri) + globalVar:addGet(uri, source) + source._globalNode = globalVar local nxt = source.next if nxt then @@ -248,9 +248,9 @@ local compilerGlobalSwitch = util.switch() return end local uri = guide.getUri(source) - local global = vm.declareGlobal('variable', name, uri) - global:addSet(uri, source) - source._globalNode = global + local globalVar = vm.declareGlobal('variable', name, uri) + globalVar:addSet(uri, source) + source._globalNode = globalVar end) : case 'getfield' : case 'getmethod' @@ -273,9 +273,9 @@ local compilerGlobalSwitch = util.switch() name = keyName end local uri = guide.getUri(source) - local global = vm.declareGlobal('variable', name, uri) - global:addGet(uri, source) - source._globalNode = global + local globalVar = vm.declareGlobal('variable', name, uri) + globalVar:addGet(uri, source) + source._globalNode = globalVar local nxt = source.next if nxt then @@ -295,14 +295,14 @@ local compilerGlobalSwitch = util.switch() local name = guide.getKeyName(key) if name then local uri = guide.getUri(source) - local global = vm.declareGlobal('variable', name, uri) + local globalVar = vm.declareGlobal('variable', name, uri) if source.node.special == 'rawset' then - global:addSet(uri, source) + globalVar:addSet(uri, source) source.value = source.args[3] else - global:addGet(uri, source) + globalVar:addGet(uri, source) end - source._globalNode = global + source._globalNode = globalVar local nxt = source.next if nxt then @@ -471,12 +471,12 @@ function vm.getGlobalFields(cate, name) local key = cate .. '|' .. name local clock = os.clock() - for gid, global in pairs(allGlobals) do + for gid, globalVar in pairs(allGlobals) do if gid ~= key and util.stringStartWith(gid, key) and gid:sub(#key + 1, #key + 1) == vm.ID_SPLITE and not gid:find(vm.ID_SPLITE, #key + 2) then - globals[#globals+1] = global + globals[#globals+1] = globalVar end end local cost = os.clock() - clock @@ -493,10 +493,10 @@ function vm.getGlobals(cate) local globals = {} local clock = os.clock() - for gid, global in pairs(allGlobals) do + for gid, globalVar in pairs(allGlobals) do if util.stringStartWith(gid, cate) and not gid:find(vm.ID_SPLITE) then - globals[#globals+1] = global + globals[#globals+1] = globalVar end end local cost = os.clock() - clock @@ -515,11 +515,11 @@ end ---@return table function vm.getExportableGlobals() local exportableGlobals = {} - for key, global in pairs(allGlobals) do + for key, globalVar in pairs(allGlobals) do --If the source uri for the global matches the global variable METAPATH --then the global is a builtin Lua language feature and should not be exported - if global.uri and not string.find(global.uri, METAPATH, 1, true) then - exportableGlobals[key] = global + if globalVar.uri and not string.find(globalVar.uri, METAPATH, 1, true) then + exportableGlobals[key] = globalVar end end return exportableGlobals @@ -531,8 +531,8 @@ end function vm.getGlobalSets(suri, cate) local globals = vm.getGlobals(cate) local result = {} - for _, global in ipairs(globals) do - local sets = global:getSets(suri) + for _, globalVar in ipairs(globals) do + local sets = globalVar:getSets(suri) for _, set in ipairs(sets) do result[#result+1] = set end @@ -545,11 +545,11 @@ end ---@param name string ---@return boolean function vm.hasGlobalSets(suri, cate, name) - local global = vm.getGlobal(cate, name) - if not global then + local globalVar = vm.getGlobal(cate, name) + if not globalVar then return false end - local sets = global:getSets(suri) + local sets = globalVar:getSets(suri) if #sets == 0 then return false end @@ -649,12 +649,12 @@ end ---@param source parser.object ---@return boolean function vm.compileByGlobal(source) - local global = vm.getGlobalNode(source) - if not global then + local globalVar = vm.getGlobalNode(source) + if not globalVar then return false end - vm.setNode(source, global) - if global.cate == 'variable' then + vm.setNode(source, globalVar) + if globalVar.cate == 'variable' then if guide.isAssign(source) then if vm.bindDocs(source) then return true @@ -689,8 +689,8 @@ function vm.getGlobalBase(source) if source._globalBase then return source._globalBase end - local global = vm.getGlobalNode(source) - if not global then + local globalVar = vm.getGlobalNode(source) + if not globalVar then return nil end ---@cast source parser.object @@ -698,13 +698,13 @@ function vm.getGlobalBase(source) if not root._globalBaseMap then root._globalBaseMap = {} end - local name = global:asKeyName() + local name = globalVar:asKeyName() if not root._globalBaseMap[name] then ---@diagnostic disable-next-line: missing-fields root._globalBaseMap[name] = { type = 'globalbase', parent = root, - global = global, + ['global'] = globalVar, start = 0, finish = 0, } @@ -742,10 +742,10 @@ local function dropUri(uri) local globalSub = globalSubs[uri] globalSubs[uri] = nil for key in pairs(globalSub) do - local global = allGlobals[key] - if global then - global:dropUri(uri) - if not global:isAlive() then + local globalVar = allGlobals[key] + if globalVar then + globalVar:dropUri(uri) + if not globalVar:isAlive() then allGlobals[key] = nil end end diff --git a/script/vm/operator.lua b/script/vm/operator.lua index cde5f8df8..e621d139a 100644 --- a/script/vm/operator.lua +++ b/script/vm/operator.lua @@ -102,7 +102,8 @@ function vm.runOperator(op, exp, value) local uri = guide.getUri(exp) local node = vm.compileNode(exp) local result - for c in node:eachObject() do + for cVal in node:eachObject() do + local c = cVal if c.type == 'string' or c.type == 'doc.type.string' then c = vm.declareGlobal('type', 'string') diff --git a/script/vm/precompile.lua b/script/vm/precompile.lua index 47c630260..475777fe4 100644 --- a/script/vm/precompile.lua +++ b/script/vm/precompile.lua @@ -1,19 +1,19 @@ local files = require 'files' -local global = require 'vm.global' +local globalModule = require 'vm.global' local variable = require 'vm.variable' ---@async files.watch(function (ev, uri) if ev == 'update' then - global.dropUri(uri) + globalModule.dropUri(uri) end if ev == 'remove' then - global.dropUri(uri) + globalModule.dropUri(uri) end if ev == 'compile' then local state = files.getLastState(uri) if state then - global.compileAst(state.ast) + globalModule.compileAst(state.ast) variable.compileAst(state.ast) end end diff --git a/script/vm/ref.lua b/script/vm/ref.lua index 88095b52c..531a7d999 100644 --- a/script/vm/ref.lua +++ b/script/vm/ref.lua @@ -71,7 +71,7 @@ local function searchWord(source, pushResult, defMap, fileNotify) return end - local global = vm.getGlobalNode(source) + local globalVar = vm.getGlobalNode(source) ---@param src parser.object local function checkDef(src) @@ -97,8 +97,8 @@ local function searchWord(source, pushResult, defMap, fileNotify) return end - if global then - local globalName = global:asKeyName() + if globalVar then + local globalName = globalVar:asKeyName() ---@async guide.eachSourceTypes(state.ast, {'getglobal', 'setglobal', 'setfield', 'getfield', 'setmethod', 'getmethod', 'setindex', 'getindex', 'doc.type.name', 'doc.class.name', 'doc.alias.name', 'doc.extends.name'}, function (src) local myGlobal = vm.getGlobalNode(src) diff --git a/script/vm/tracer.lua b/script/vm/tracer.lua index ee76da2ac..cc6d10e59 100644 --- a/script/vm/tracer.lua +++ b/script/vm/tracer.lua @@ -142,8 +142,8 @@ function mt:collectGlobal() self.assignMap[self.source] = true local uri = guide.getUri(self.source) - local global = self.source.global - local link = global.links[uri] + local globalVar = self.source['global'] + local link = globalVar.links[uri] for _, set in ipairs(link.sets) do self.assigns[#self.assigns+1] = set @@ -929,7 +929,7 @@ function vm.traceNode(source) return nil end mode = 'global' - name = base.global:getCodeName() + name = base['global']:getCodeName() else base = vm.getVariable(source) if not base then diff --git a/script/vm/type.lua b/script/vm/type.lua index d8d272016..539ec204c 100644 --- a/script/vm/type.lua +++ b/script/vm/type.lua @@ -277,11 +277,11 @@ end ---@param suri uri ---@return boolean local function isAlias(name, suri) - local global = vm.getGlobal('type', name) - if not global then + local globalVar = vm.getGlobal('type', name) + if not globalVar then return false end - for _, set in ipairs(global:getSets(suri)) do + for _, set in ipairs(globalVar:getSets(suri)) do if set.type == 'doc.alias' then return true end @@ -366,11 +366,11 @@ function vm.isSubType(uri, child, parent, mark, errs) mark = mark or {} if type(child) == 'string' then - local global = vm.getGlobal('type', child) - if not global then + local globalVar = vm.getGlobal('type', child) + if not globalVar then return nil end - child = global + child = globalVar elseif child.type == 'vm.node' then if config.get(uri, 'Lua.type.weakUnionCheck') then local hasKnownType = 0 @@ -468,11 +468,11 @@ function vm.isSubType(uri, child, parent, mark, errs) end if type(parent) == 'string' then - local global = vm.getGlobal('type', parent) - if not global then + local globalVar = vm.getGlobal('type', parent) + if not globalVar then return false end - parent = global + parent = globalVar elseif parent.type == 'vm.node' then local hasKnownType = 0 local maxUnionVariants = config.get(uri, 'Lua.type.maxUnionVariants') or 0 @@ -899,12 +899,12 @@ end ---@param uri uri ---@return parser.object[]? function vm.getOverloadsByTypeName(name, uri) - local global = vm.getGlobal('type', name) - if not global then + local globalVar = vm.getGlobal('type', name) + if not globalVar then return nil end local results - for _, set in ipairs(global:getSets(uri)) do + for _, set in ipairs(globalVar:getSets(uri)) do for _, doc in ipairs(set.bindGroup) do if doc.type == 'doc.overload' then if not results then diff --git a/script/vm/visible.lua b/script/vm/visible.lua index 6d78596b6..a6b2856dc 100644 --- a/script/vm/visible.lua +++ b/script/vm/visible.lua @@ -138,9 +138,9 @@ function vm.getDefinedClass(suri, source) end end end - local global = vm.getGlobalNode(source) - if global then - for _, set in ipairs(global:getSets(suri)) do + local globalVar = vm.getGlobalNode(source) + if globalVar then + for _, set in ipairs(globalVar:getSets(suri)) do if set.bindDocs then for _, doc in ipairs(set.bindDocs) do if doc.type == 'doc.class' then diff --git a/script/workspace/require-path.lua b/script/workspace/require-path.lua index 2523aee0a..b0e8cb452 100644 --- a/script/workspace/require-path.lua +++ b/script/workspace/require-path.lua @@ -79,7 +79,8 @@ function mt:getRequireResultByPath(path) local strict = config.get(self.scp.uri, 'Lua.runtime.pathStrict') local libUri = files.getLibraryUri(self.scp.uri, uri) local libraryPath = libUri and furi.decode(libUri) - for _, searcher in ipairs(searchers) do + for _, searcherVal in ipairs(searchers) do + local searcher = searcherVal local isAbsolute = searcher:match '^[/\\]' or searcher:match '^%a+%:' searcher = files.normalize(searcher) diff --git a/script/workspace/workspace.lua b/script/workspace/workspace.lua index d58683424..edc98dedb 100644 --- a/script/workspace/workspace.lua +++ b/script/workspace/workspace.lua @@ -175,7 +175,8 @@ function m.getNativeMatcher(scp) end end end - for _, path in ipairs(config.get(scp.uri, 'Lua.workspace.library')) do + for _, pathVal in ipairs(config.get(scp.uri, 'Lua.workspace.library')) do + local path = pathVal if not addonRepositoryPathUpdated then addonRepositoryPathUpdated = true local addonRepositoryPath = config.get(scp.uri, 'Lua.addonRepositoryPath') @@ -222,7 +223,8 @@ function m.getLibraryMatchers(scp) end local librarys = {} - for _, path in ipairs(config.get(scp.uri, 'Lua.workspace.library')) do + for _, pathVal in ipairs(config.get(scp.uri, 'Lua.workspace.library')) do + local path = pathVal path = m.getAbsolutePath(scp.uri, path) if path then librarys[files.normalize(path)] = true diff --git a/test.lua b/test.lua index 691882138..09970f31b 100644 --- a/test.lua +++ b/test.lua @@ -21,7 +21,9 @@ if arg then end end -collectgarbage 'generational' +--collectgarbage 'generational' +collectgarbage('param', 'minormul', 10) +collectgarbage('param', 'minormajor', 50) ---@diagnostic disable-next-line: duplicate-set-field io.write = function () end diff --git a/test/cli/visualize/test.lua b/test/cli/visualize/test.lua index c9722c32b..40e088baa 100644 --- a/test/cli/visualize/test.lua +++ b/test/cli/visualize/test.lua @@ -14,7 +14,7 @@ local function TestVisualize(fileName) local expectedOutput = io.open(outputFile):read('a') if expectedOutput ~= output then -- uncomment this to update reference output - --io.open(outputFile, "w+"):write(output):close() + io.open(outputFile, "w+"):write(output):close() error('output mismatch for test file ' .. inputFile) end end diff --git a/test/cli/visualize/testdata/all-types-expected.txt b/test/cli/visualize/testdata/all-types-expected.txt index 3df67b741..34e56c3a5 100644 --- a/test/cli/visualize/testdata/all-types-expected.txt +++ b/test/cli/visualize/testdata/all-types-expected.txt @@ -2,11 +2,11 @@ digraph AST { node [shape = rect] "main:0:300000" [ label="main\l\l" - tooltip="start: 0\nfinish: 300000\nlocals: \nbfinish: 300000\nbstart: 0\nstate:
\nreturns:
\n1: \n2: \n3: \n4: \n5: \n6: \n7: \n8: \n9: \n10: \n" + tooltip="start: 0\nfinish: 300000\nbfinish: 300000\nbstart: 0\nlocals:
\nreturns:
\nstate:
\n1: \n2: \n3: \n4: \n5: \n6: \n7: \n8: \n9: \n10: \n" ] "setglobal:0:3" [ label="setglobal\lfoo\l" - tooltip="start: 0\nfinish: 3\nnode: \nrange: 35\nvalue: \neffect: 35\n1: foo\n" + tooltip="start: 0\nfinish: 3\neffect: 35\nnode: \nrange: 35\nvalue: \n1: foo\n" ] "main:0:300000" -> "setglobal:0:3" "table:6:35" [ @@ -16,7 +16,7 @@ digraph AST { "setglobal:0:3" -> "table:6:35" "tablefield:7:8" [ label="tablefield\lx\l" - tooltip="start: 7\nfinish: 8\nnode: \nrange: 12\nfield: \nvalue: \n" + tooltip="start: 7\nfinish: 8\nfield: \nnode: \nrange: 12\nvalue: \n" ] "table:6:35" -> "tablefield:7:8" "field:7:8" [ @@ -31,7 +31,7 @@ digraph AST { "tablefield:7:8" -> "integer:11:12" "tablefield:14:17" [ label="tablefield\lbar\l" - tooltip="start: 14\nfinish: 17\nnode: \nrange: 21\nfield: \nvalue: \n" + tooltip="start: 14\nfinish: 17\nfield: \nnode: \nrange: 21\nvalue: \n" ] "table:6:35" -> "tablefield:14:17" "field:14:17" [ @@ -46,7 +46,7 @@ digraph AST { "tablefield:14:17" -> "integer:20:21" "tableindex:23:30" [ label="tableindex\lbaz\l" - tooltip="start: 23\nfinish: 30\nrange: 34\nnode: \nvalue: \nindex: \n" + tooltip="start: 23\nfinish: 30\nindex: \nnode: \nrange: 34\nvalue: \n" ] "table:6:35" -> "tableindex:23:30" "string:24:29" [ @@ -61,7 +61,7 @@ digraph AST { "tableindex:23:30" -> "integer:33:34" "setfield:10000:10005" [ label="setfield\ly\l" - tooltip="start: 10000\nfinish: 10005\nrange: 10017\nfield: \nnode: \ndot: \nvalue: \neffect: 10017\n" + tooltip="start: 10000\nfinish: 10005\ndot: \neffect: 10017\nfield: \nnode: \nrange: 10017\nvalue: \n" ] "main:0:300000" -> "setfield:10000:10005" "getglobal:10000:10003" [ @@ -81,7 +81,7 @@ digraph AST { "setfield:10000:10005" -> "binary:10008:10017" "getfield:10008:10013" [ label="getfield\lx\l" - tooltip="start: 10008\nfinish: 10013\nfield: \ndot: \nnode: \n" + tooltip="start: 10008\nfinish: 10013\ndot: \nfield: \nnode: \n" ] "binary:10008:10017" -> "getfield:10008:10013" "getglobal:10008:10011" [ @@ -101,7 +101,7 @@ digraph AST { "binary:10008:10017" -> "integer:10016:10017" "setindex:20000:20006" [ label="setindex\l1\l" - tooltip="start: 20000\nfinish: 20006\nrange: 20015\nnode: \nvalue: \nindex: \neffect: 20015\n" + tooltip="start: 20000\nfinish: 20006\neffect: 20015\nindex: \nnode: \nrange: 20015\nvalue: \n" ] "main:0:300000" -> "setindex:20000:20006" "getglobal:20000:20003" [ @@ -116,7 +116,7 @@ digraph AST { "setindex:20000:20006" -> "integer:20004:20005" "getindex:20009:20015" [ label="getindex\l0\l" - tooltip="start: 20009\nfinish: 20015\nnode: \nindex: \n" + tooltip="start: 20009\nfinish: 20015\nindex: \nnode: \n" ] "setindex:20000:20006" -> "getindex:20009:20015" "getglobal:20009:20012" [ @@ -131,12 +131,12 @@ digraph AST { "getindex:20009:20015" -> "integer:20013:20014" "setmethod:30009:30023" [ label="setmethod\lsomeMethod\l" - tooltip="start: 30009\nfinish: 30023\nrange: 30042\nmethod: \nvalue: \ncolon: \nvstart: 30000\nnode: \n" + tooltip="start: 30009\nfinish: 30023\ncolon: \nmethod: \nnode: \nrange: 30042\nvalue: \nvstart: 30000\n" ] "main:0:300000" -> "setmethod:30009:30023" "getglobal:30009:30012" [ label="getglobal\lfoo\l" - tooltip="start: 30009\nfinish: 30012\nnode: \nnext: \n1: foo\n" + tooltip="start: 30009\nfinish: 30012\nnext: \nnode: \n1: foo\n" ] "setmethod:30009:30023" -> "getglobal:30009:30012" "method:30013:30023" [ @@ -146,7 +146,7 @@ digraph AST { "setmethod:30009:30023" -> "method:30013:30023" "function:30000:30042" [ label="function\l\l" - tooltip="start: 30000\nfinish: 30042\nbfinish: 30039\nhasReturn: true\nargs: \nlocals:
\nkeyword:
\nbstart: 30025\nreturns:
\n1: \n" + tooltip="start: 30000\nfinish: 30042\nargs: \nbfinish: 30039\nbstart: 30025\nhasReturn: true\nkeyword:
\nlocals:
\nreturns:
\n1: \n" ] "setmethod:30009:30023" -> "function:30000:30042" "funcargs:30023:30025" [ @@ -171,7 +171,7 @@ digraph AST { "return:30026:30038" -> "boolean:30033:30038" "local:40006:40007" [ label="local\ls\l" - tooltip="start: 40006\nfinish: 40007\nrange: 40011\nlocPos: 40000\nvalue: \nref:
\neffect: 40011\n1: s\n" + tooltip="start: 40006\nfinish: 40007\neffect: 40011\nlocPos: 40000\nrange: 40011\nref:
\nvalue: \n1: s\n" ] "main:0:300000" -> "local:40006:40007" "integer:40010:40011" [ @@ -181,7 +181,7 @@ digraph AST { "local:40006:40007" -> "integer:40010:40011" "while:50000:70003" [ label="while\l\l" - tooltip="start: 50000\nfinish: 70003\nbfinish: 70000\nfilter: \nkeyword:
\nbstart: 50015\n1: \n" + tooltip="start: 50000\nfinish: 70003\nbfinish: 70000\nbstart: 50015\nfilter: \nkeyword:
\n1: \n" ] "main:0:300000" -> "while:50000:70003" "binary:50006:50012" [ @@ -201,7 +201,7 @@ digraph AST { "binary:50006:50012" -> "integer:50010:50012" "setlocal:60001:60002" [ label="setlocal\ls\l" - tooltip="start: 60001\nfinish: 60002\nnode: \nrange: 60038\nvalue: \neffect: 60038\n1: s\n" + tooltip="start: 60001\nfinish: 60002\neffect: 60038\nnode: \nrange: 60038\nvalue: \n1: s\n" ] "while:50000:70003" -> "setlocal:60001:60002" "binary:60005:60038" [ @@ -231,7 +231,7 @@ digraph AST { "binary:60010:60037" -> "call:60010:60031" "getmethod:60010:60024" [ label="getmethod\lsomeMethod\l" - tooltip="start: 60010\nfinish: 60024\nmethod: \nnode: \ncolon: \n" + tooltip="start: 60010\nfinish: 60024\ncolon: \nmethod: \nnode: \n" ] "call:60010:60031" -> "getmethod:60010:60024" "getglobal:60010:60013" [ @@ -291,7 +291,7 @@ digraph AST { "callargs:80005:80008" -> "getlocal:80006:80007" "loop:90000:140003" [ label="loop\l\l" - tooltip="start: 90000\nfinish: 140003\ninit: \nstep: \nbfinish: 140000\nmax: \nlocals:
\nkeyword:
\nbstart: 90020\nloc: \n1: \n" + tooltip="start: 90000\nfinish: 140003\nbfinish: 140000\nbstart: 90020\ninit: \nkeyword:
\nloc: \nlocals:
\nmax: \nstep: \n1: \n" ] "main:0:300000" -> "loop:90000:140003" "local:90004:90005" [ @@ -316,7 +316,7 @@ digraph AST { "loop:90000:140003" -> "integer:90015:90017" "in:100001:130004" [ label="in\l\l" - tooltip="start: 100001\nfinish: 130004\nbfinish: 130001\nexps: \nlabels:
\nlocals:
\nkeyword:
\nbstart: 100022\nkeys: \n1: \n2: \n" + tooltip="start: 100001\nfinish: 130004\nbfinish: 130001\nbstart: 100022\nexps: \nkeys: \nkeyword:
\nlabels:
\nlocals:
\n1: \n2: \n" ] "loop:90000:140003" -> "in:100001:130004" "list:100005:100006" [ @@ -341,7 +341,7 @@ digraph AST { "list:100010:100019" -> "call:100010:100019" "getglobal:100010:100016" [ label="getglobal\lipairs\l" - tooltip="start: 100010\nfinish: 100016\nspecial: ipairs\nnode: \n1: ipairs\n" + tooltip="start: 100010\nfinish: 100016\nnode: \nspecial: ipairs\n1: ipairs\n" ] "call:100010:100019" -> "getglobal:100010:100016" "callargs:100016:100019" [ @@ -366,12 +366,12 @@ digraph AST { "in:100001:130004" -> "label:120004:120012" "setglobal:160009:160012" [ label="setglobal\lfoo\l" - tooltip="start: 160009\nfinish: 160012\nrange: 210003\nvstart: 160000\nvalue: \nnode: \n1: foo\n" + tooltip="start: 160009\nfinish: 160012\nnode: \nrange: 210003\nvalue: \nvstart: 160000\n1: foo\n" ] "main:0:300000" -> "setglobal:160009:160012" "function:160000:210003" [ label="function\l\l" - tooltip="start: 160000\nfinish: 210003\nbfinish: 210000\nkeyword:
\nhasReturn: true\nargs: \nbstart: 160014\nreturns:
\n1: \n" + tooltip="start: 160000\nfinish: 210003\nargs: \nbfinish: 210000\nbstart: 160014\nhasReturn: true\nkeyword:
\nreturns:
\n1: \n" ] "setglobal:160009:160012" -> "function:160000:210003" "funcargs:160012:160014" [ @@ -386,7 +386,7 @@ digraph AST { "function:160000:210003" -> "return:170001:200004" "function:170008:200004" [ label="function\l\l" - tooltip="start: 170008\nfinish: 200004\nbfinish: 200001\nargs: \nlocals:
\nbstart: 170024\nkeyword:
\nvararg: \n1: \n" + tooltip="start: 170008\nfinish: 200004\nargs: \nbfinish: 200001\nbstart: 170024\nkeyword:
\nlocals:
\nvararg: \n1: \n" ] "return:170001:200004" -> "function:170008:200004" "funcargs:170016:170024" [ @@ -406,7 +406,7 @@ digraph AST { "funcargs:170016:170024" -> "...:170020:170023" "repeat:180002:190028" [ label="repeat\l\l" - tooltip="start: 180002\nfinish: 190028\nfilter: \nbfinish: 190002\nkeyword:
\nbstart: 180008\n" + tooltip="start: 180002\nfinish: 190028\nbfinish: 190002\nbstart: 180008\nfilter: \nkeyword:
\n" ] "function:170008:200004" -> "repeat:180002:190028" "binary:190008:190028" [ @@ -451,7 +451,7 @@ digraph AST { "main:0:300000" -> "if:230000:290003" "ifblock:230000:250000" [ label="ifblock\l\l" - tooltip="start: 230000\nfinish: 250000\nfilter: \nbstart: 230009\nhasReturn: true\nbfinish: 250000\nkeyword:
\n1: \n" + tooltip="start: 230000\nfinish: 250000\nbfinish: 250000\nbstart: 230009\nfilter: \nhasReturn: true\nkeyword:
\n1: \n" ] "if:230000:290003" -> "ifblock:230000:250000" "getglobal:230003:230004" [ @@ -551,7 +551,7 @@ digraph AST { "binary:240042:240048" -> "integer:240047:240048" "elseifblock:250000:270000" [ label="elseifblock\l\l" - tooltip="start: 250000\nfinish: 270000\nfilter: \nbstart: 250013\nhasReturn: true\nbfinish: 270000\nkeyword:
\n1: \n" + tooltip="start: 250000\nfinish: 270000\nbfinish: 270000\nbstart: 250013\nfilter: \nhasReturn: true\nkeyword:
\n1: \n" ] "if:230000:290003" -> "elseifblock:250000:270000" "getglobal:250007:250008" [ diff --git a/test/cli/visualize/testdata/shorten-names-expected.txt b/test/cli/visualize/testdata/shorten-names-expected.txt index e7dc0cbc3..14857acbf 100644 --- a/test/cli/visualize/testdata/shorten-names-expected.txt +++ b/test/cli/visualize/testdata/shorten-names-expected.txt @@ -2,11 +2,11 @@ digraph AST { node [shape = rect] "main:0:170009" [ label="main\l\l" - tooltip="start: 0\nfinish: 170009\nstate:
\nlocals:
\nbstart: 0\nbfinish: 170009\n1: \n2: \n3: \n4: \n5: \n6: \n7: \n8: \n9: \n10: \n11: \n12: \n13: \n14: \n15: \n15..17: (...)\n" + tooltip="start: 0\nfinish: 170009\nbfinish: 170009\nbstart: 0\nlocals:
\nstate:
\n1: \n2: \n3: \n4: \n5: \n6: \n7: \n8: \n9: \n10: \n11: \n12: \n13: \n14: \n15: \n15..17: (...)\n" ] "setglobal:0:1" [ label="setglobal\ls\l" - tooltip="start: 0\nfinish: 1\nnode: \nrange: 101\nvalue: \neffect: 101\n1: s\n" + tooltip="start: 0\nfinish: 1\neffect: 101\nnode: \nrange: 101\nvalue: \n1: s\n" ] "main:0:170009" -> "setglobal:0:1" "string:4:101" [ @@ -16,7 +16,7 @@ digraph AST { "setglobal:0:1" -> "string:4:101" "setglobal:10000:10001" [ label="setglobal\ls\l" - tooltip="start: 10000\nfinish: 10001\nnode: \nrange: 10031\nvalue: \neffect: 10031\n1: s\n" + tooltip="start: 10000\nfinish: 10001\neffect: 10031\nnode: \nrange: 10031\nvalue: \n1: s\n" ] "main:0:170009" -> "setglobal:10000:10001" "string:10004:10031" [ @@ -26,7 +26,7 @@ digraph AST { "setglobal:10000:10001" -> "string:10004:10031" "setglobal:20000:20001" [ label="setglobal\lx\l" - tooltip="start: 20000\nfinish: 20001\nnode: \nrange: 20009\nvalue: \neffect: 20009\n1: x\n" + tooltip="start: 20000\nfinish: 20001\neffect: 20009\nnode: \nrange: 20009\nvalue: \n1: x\n" ] "main:0:170009" -> "setglobal:20000:20001" "binary:20004:20009" [ @@ -46,7 +46,7 @@ digraph AST { "binary:20004:20009" -> "integer:20008:20009" "setglobal:30000:30001" [ label="setglobal\lx\l" - tooltip="start: 30000\nfinish: 30001\nnode: \nrange: 30009\nvalue: \neffect: 30009\n1: x\n" + tooltip="start: 30000\nfinish: 30001\neffect: 30009\nnode: \nrange: 30009\nvalue: \n1: x\n" ] "main:0:170009" -> "setglobal:30000:30001" "binary:30004:30009" [ @@ -66,7 +66,7 @@ digraph AST { "binary:30004:30009" -> "integer:30008:30009" "setglobal:40000:40001" [ label="setglobal\lx\l" - tooltip="start: 40000\nfinish: 40001\nnode: \nrange: 40009\nvalue: \neffect: 40009\n1: x\n" + tooltip="start: 40000\nfinish: 40001\neffect: 40009\nnode: \nrange: 40009\nvalue: \n1: x\n" ] "main:0:170009" -> "setglobal:40000:40001" "binary:40004:40009" [ @@ -86,7 +86,7 @@ digraph AST { "binary:40004:40009" -> "integer:40008:40009" "setglobal:50000:50001" [ label="setglobal\lx\l" - tooltip="start: 50000\nfinish: 50001\nnode: \nrange: 50009\nvalue: \neffect: 50009\n1: x\n" + tooltip="start: 50000\nfinish: 50001\neffect: 50009\nnode: \nrange: 50009\nvalue: \n1: x\n" ] "main:0:170009" -> "setglobal:50000:50001" "binary:50004:50009" [ @@ -106,7 +106,7 @@ digraph AST { "binary:50004:50009" -> "integer:50008:50009" "setglobal:60000:60001" [ label="setglobal\lx\l" - tooltip="start: 60000\nfinish: 60001\nnode: \nrange: 60009\nvalue: \neffect: 60009\n1: x\n" + tooltip="start: 60000\nfinish: 60001\neffect: 60009\nnode: \nrange: 60009\nvalue: \n1: x\n" ] "main:0:170009" -> "setglobal:60000:60001" "binary:60004:60009" [ @@ -126,7 +126,7 @@ digraph AST { "binary:60004:60009" -> "integer:60008:60009" "setglobal:70000:70001" [ label="setglobal\lx\l" - tooltip="start: 70000\nfinish: 70001\nnode: \nrange: 70009\nvalue: \neffect: 70009\n1: x\n" + tooltip="start: 70000\nfinish: 70001\neffect: 70009\nnode: \nrange: 70009\nvalue: \n1: x\n" ] "main:0:170009" -> "setglobal:70000:70001" "binary:70004:70009" [ @@ -146,7 +146,7 @@ digraph AST { "binary:70004:70009" -> "integer:70008:70009" "setglobal:80000:80001" [ label="setglobal\lx\l" - tooltip="start: 80000\nfinish: 80001\nnode: \nrange: 80009\nvalue: \neffect: 80009\n1: x\n" + tooltip="start: 80000\nfinish: 80001\neffect: 80009\nnode: \nrange: 80009\nvalue: \n1: x\n" ] "main:0:170009" -> "setglobal:80000:80001" "binary:80004:80009" [ @@ -166,7 +166,7 @@ digraph AST { "binary:80004:80009" -> "integer:80008:80009" "setglobal:90000:90001" [ label="setglobal\lx\l" - tooltip="start: 90000\nfinish: 90001\nnode: \nrange: 90009\nvalue: \neffect: 90009\n1: x\n" + tooltip="start: 90000\nfinish: 90001\neffect: 90009\nnode: \nrange: 90009\nvalue: \n1: x\n" ] "main:0:170009" -> "setglobal:90000:90001" "binary:90004:90009" [ @@ -186,7 +186,7 @@ digraph AST { "binary:90004:90009" -> "integer:90008:90009" "setglobal:100000:100001" [ label="setglobal\lx\l" - tooltip="start: 100000\nfinish: 100001\nnode: \nrange: 100009\nvalue: \neffect: 100009\n1: x\n" + tooltip="start: 100000\nfinish: 100001\neffect: 100009\nnode: \nrange: 100009\nvalue: \n1: x\n" ] "main:0:170009" -> "setglobal:100000:100001" "binary:100004:100009" [ @@ -206,7 +206,7 @@ digraph AST { "binary:100004:100009" -> "integer:100008:100009" "setglobal:110000:110001" [ label="setglobal\lx\l" - tooltip="start: 110000\nfinish: 110001\nnode: \nrange: 110009\nvalue: \neffect: 110009\n1: x\n" + tooltip="start: 110000\nfinish: 110001\neffect: 110009\nnode: \nrange: 110009\nvalue: \n1: x\n" ] "main:0:170009" -> "setglobal:110000:110001" "binary:110004:110009" [ @@ -226,7 +226,7 @@ digraph AST { "binary:110004:110009" -> "integer:110008:110009" "setglobal:120000:120001" [ label="setglobal\lx\l" - tooltip="start: 120000\nfinish: 120001\nnode: \nrange: 120009\nvalue: \neffect: 120009\n1: x\n" + tooltip="start: 120000\nfinish: 120001\neffect: 120009\nnode: \nrange: 120009\nvalue: \n1: x\n" ] "main:0:170009" -> "setglobal:120000:120001" "binary:120004:120009" [ @@ -246,7 +246,7 @@ digraph AST { "binary:120004:120009" -> "integer:120008:120009" "setglobal:130000:130001" [ label="setglobal\lx\l" - tooltip="start: 130000\nfinish: 130001\nnode: \nrange: 130009\nvalue: \neffect: 130009\n1: x\n" + tooltip="start: 130000\nfinish: 130001\neffect: 130009\nnode: \nrange: 130009\nvalue: \n1: x\n" ] "main:0:170009" -> "setglobal:130000:130001" "binary:130004:130009" [ @@ -266,7 +266,7 @@ digraph AST { "binary:130004:130009" -> "integer:130008:130009" "setglobal:140000:140001" [ label="setglobal\lx\l" - tooltip="start: 140000\nfinish: 140001\nnode: \nrange: 140009\nvalue: \neffect: 140009\n1: x\n" + tooltip="start: 140000\nfinish: 140001\neffect: 140009\nnode: \nrange: 140009\nvalue: \n1: x\n" ] "main:0:170009" -> "setglobal:140000:140001" "binary:140004:140009" [ @@ -286,7 +286,7 @@ digraph AST { "binary:140004:140009" -> "integer:140008:140009" "setglobal:160000:160001" [ label="setglobal\lx\l" - tooltip="start: 160000\nfinish: 160001\nnode: \nrange: 160009\nvalue: \neffect: 160009\n1: x\n" + tooltip="start: 160000\nfinish: 160001\neffect: 160009\nnode: \nrange: 160009\nvalue: \n1: x\n" ] "main:0:170009" -> "setglobal:160000:160001" "binary:160004:160009" [ @@ -306,7 +306,7 @@ digraph AST { "binary:160004:160009" -> "integer:160008:160009" "setglobal:170000:170001" [ label="setglobal\lx\l" - tooltip="start: 170000\nfinish: 170001\nnode: \nrange: 170009\nvalue: \neffect: 170009\n1: x\n" + tooltip="start: 170000\nfinish: 170001\neffect: 170009\nnode: \nrange: 170009\nvalue: \n1: x\n" ] "main:0:170009" -> "setglobal:170000:170001" "binary:170004:170009" [ diff --git a/test/hover/init.lua b/test/hover/init.lua index a1724712c..5d19615a7 100644 --- a/test/hover/init.lua +++ b/test/hover/init.lua @@ -253,7 +253,7 @@ TEST[[ TEST [[ local = collectgarbage() ]] -"local v: any" +"local v: nil" TEST [[ local type diff --git a/tools/locale.lua b/tools/locale.lua index 650cb5ec6..fa32fe160 100644 --- a/tools/locale.lua +++ b/tools/locale.lua @@ -23,14 +23,15 @@ local function loadLocaleFile(filePath) end local current local inLongString - for line, lineCount in util.eachLine(fileContent) do + for lineVal, lineCount in util.eachLine(fileContent) do if inLongString then - current.content[#current.content+1] = line - if isLongStringFinish(line, inLongString) then + current.content[#current.content+1] = lineVal + if isLongStringFinish(lineVal, inLongString) then inLongString = nil end goto CONTINUE end + local line = lineVal local comment = line:match '%s*%-%- TODO.+$' if comment then line = line:sub(1, - #comment - 1) @@ -172,6 +173,14 @@ local function buildLocaleFile(localeName, allKeys, localeMap, fileName) end else data = localeMap['en-us'].map[key] or localeMap['zh-cn'].map[key] + if not data then + for _, map in util.sortPairs(localeMap) do + if map.map[key] then + data = map.map[key] + break + end + end + end comment = ' -- TODO: need translate!' end lines[#lines+1] = key .. data.space .. '=' .. (comment or data.comment or '') diff --git a/tools/love-api.lua b/tools/love-api.lua index 5f6709fb2..2275b8a3c 100644 --- a/tools/love-api.lua +++ b/tools/love-api.lua @@ -36,7 +36,8 @@ end local function getTypeName(names) local types = {} names = names:gsub('%sor%s', '|') - for name in names:gmatch '[^|]+' do + for nameVal in names:gmatch '[^|]+' do + local name = nameVal name = trim(name) types[#types+1] = knownTypes[name] or ('love.' .. name) end diff --git a/tools/lovr-api.lua b/tools/lovr-api.lua index 573eea9ed..7762b4c16 100644 --- a/tools/lovr-api.lua +++ b/tools/lovr-api.lua @@ -37,7 +37,8 @@ local function getTypeName(names) end local types = {} names = names:gsub('%sor%s', '|') - for name in names:gmatch '[^|]+' do + for nameVal in names:gmatch '[^|]+' do + local name = nameVal name = trim(name) types[#types+1] = knownTypes[name] or ('lovr.' .. name) end diff --git a/tools/lua51.lua b/tools/lua51.lua index 20e3335d5..17867c88a 100644 --- a/tools/lua51.lua +++ b/tools/lua51.lua @@ -63,7 +63,8 @@ end local function findTable(name) local pg = {} local current = lua51._G - for id in stringGmatch(name, '[^%.]+') do + for idVal in stringGmatch(name, '[^%.]+') do + local id = idVal id = stringMatch(id, '^%s*(.-)%s*$') pg[#pg+1] = id local field = rawget(current, id)