From 4429e81639b9bf339609dab6392bef18223a808e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Thu, 25 Dec 2025 11:15:19 +0800 Subject: [PATCH 1/6] update document of `utf8.offset` in Lua 5.5 --- changelog.md | 4 ++++ locale/en-us/meta.lua | 2 ++ meta/template/utf8.lua | 13 +++++++++++++ 3 files changed, 19 insertions(+) diff --git a/changelog.md b/changelog.md index 79b3e9e02..a8931e3e4 100644 --- a/changelog.md +++ b/changelog.md @@ -3,6 +3,10 @@ ## Unreleased +## 3.16.4 +* `FIX` (VSCode) Broken `view document` + + ## 3.16.3 `2025-12-23` * `CHG` Upgraded to Lua 5.5, memory usage has been reduced by ~10% diff --git a/locale/en-us/meta.lua b/locale/en-us/meta.lua index 756cd1cc5..c0f8edd60 100644 --- a/locale/en-us/meta.lua +++ b/locale/en-us/meta.lua @@ -881,3 +881,5 @@ utf8.len = 'Returns the number of UTF-8 characters in string `s` that start between positions `i` and `j` (both inclusive).' utf8.offset = 'Returns the position (in bytes) where the encoding of the `n`-th character of `s` (counting from position `i`) starts.' +utf8.offset[55] = +'Returns the position of the n-th character of s (counting from byte position i) as two integers: The index (in bytes) where its encoding starts and the index (in bytes) where it ends.' diff --git a/meta/template/utf8.lua b/meta/template/utf8.lua index 5c7668384..b47d1b03f 100644 --- a/meta/template/utf8.lua +++ b/meta/template/utf8.lua @@ -67,6 +67,7 @@ function utf8.len(s, i, j) end function utf8.len(s, i, j, lax) end ---#end +---#if VERSION <= 5.4 then ---#DES 'utf8.offset' ---@param s string ---@param n integer @@ -74,5 +75,17 @@ function utf8.len(s, i, j, lax) end ---@return integer p ---@nodiscard function utf8.offset(s, n, i) end +---#end + +---#if VERSION >= 5.5 then +---#DES 'utf8.offset.55' +---@param s string +---@param n integer +---@param i? integer +---@return integer ps +---@return integer pe +---@nodiscard +function utf8.offset(s, n, i) end +---#end return utf8 From 1c6a48cf1198f5491c23d8870fb36defc2b6e95f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Thu, 25 Dec 2025 11:16:36 +0800 Subject: [PATCH 2/6] update submodules --- 3rd/bee.lua | 2 +- 3rd/json.lua | 2 +- 3rd/luamake | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/3rd/bee.lua b/3rd/bee.lua index 466c4f071..f55b6988e 160000 --- a/3rd/bee.lua +++ b/3rd/bee.lua @@ -1 +1 @@ -Subproject commit 466c4f071a17ab7c31e402383b0a2097b03535ba +Subproject commit f55b6988e8d9564816a555118b0e76564ef9a283 diff --git a/3rd/json.lua b/3rd/json.lua index f94860ef5..08095fd2c 160000 --- a/3rd/json.lua +++ b/3rd/json.lua @@ -1 +1 @@ -Subproject commit f94860ef551036490c5b3db6098325267f42ef28 +Subproject commit 08095fd2cdfde8f49a5f5b54b35ec7b3d4906a36 diff --git a/3rd/luamake b/3rd/luamake index d5bd143b0..4c4bd16c9 160000 --- a/3rd/luamake +++ b/3rd/luamake @@ -1 +1 @@ -Subproject commit d5bd143b0307dcb8a7c25fb9308f3f7721fe1a8d +Subproject commit 4c4bd16c9b0c1d773402fc15c76367f7899a1f91 From 0879bb17eb3270209159162617ac442d7ed9dc71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Thu, 25 Dec 2025 11:27:12 +0800 Subject: [PATCH 3/6] update locale --- locale/en-us/setting.lua | 2 - locale/es-419/meta.lua | 2 + locale/es-419/setting.lua | 2 - locale/ja-jp/meta.lua | 2 + locale/ja-jp/setting.lua | 263 ++++++++++++++++++++++++++++---------- locale/pt-br/meta.lua | 2 + locale/pt-br/setting.lua | 2 - locale/zh-cn/meta.lua | 2 + locale/zh-cn/setting.lua | 2 - locale/zh-tw/meta.lua | 2 + locale/zh-tw/setting.lua | 2 - tools/locale.lua | 6 +- 12 files changed, 208 insertions(+), 81 deletions(-) diff --git a/locale/en-us/setting.lua b/locale/en-us/setting.lua index 13f5f9f73..0ba6c2852 100644 --- a/locale/en-us/setting.lua +++ b/locale/en-us/setting.lua @@ -121,8 +121,6 @@ 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 446213a81..a4a91a650 100644 --- a/locale/es-419/meta.lua +++ b/locale/es-419/meta.lua @@ -880,3 +880,5 @@ utf8.len = 'Retorna el número de caracteres en UTF-8 en el string `s` que empiezan entre las posiciones `i` y `j` (ambos inclusive).' utf8.offset = 'Retorna la posición en bytes donde la codificación del caracter `n`-ésimo de `s` empieza, contado a partir de la posición `i`.' +utf8.offset[55] = -- TODO: need translate! +'Returns the position of the n-th character of s (counting from byte position i) as two integers: The index (in bytes) where its encoding starts and the index (in bytes) where it ends.' diff --git a/locale/es-419/setting.lua b/locale/es-419/setting.lua index d29ef2e62..61e8fdbfb 100644 --- a/locale/es-419/setting.lua +++ b/locale/es-419/setting.lua @@ -122,8 +122,6 @@ 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 = diff --git a/locale/ja-jp/meta.lua b/locale/ja-jp/meta.lua index 9493b9bcd..fb6c337a3 100644 --- a/locale/ja-jp/meta.lua +++ b/locale/ja-jp/meta.lua @@ -876,3 +876,5 @@ utf8.len = 'バイト位置 `i` から `j`(両方含む)の間に含まれるUTF-8文字の数を返す。' utf8.offset = '文字列 `s` における `n` 番目の文字が始まるバイト位置をを返す。`i` が指定された場合、`i` から数えたバイト位置を返す。' +utf8.offset[55] = -- TODO: need translate! +'Returns the position of the n-th character of s (counting from byte position i) as two integers: The index (in bytes) where its encoding starts and the index (in bytes) where it ends.' diff --git a/locale/ja-jp/setting.lua b/locale/ja-jp/setting.lua index 250676365..7f4e2ca31 100644 --- a/locale/ja-jp/setting.lua +++ b/locale/ja-jp/setting.lua @@ -6,82 +6,129 @@ 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 = +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! [[ -デフォルトのフォーマット設定。ワークスペース内の`.editorconfig`ファイルより優先度が低くなります。 -[formatter docs](https://github.com/CppCXY/EmmyLuaCodeStyle/tree/master/docs) を参照してください。 +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. ]] -config.spell.dict = -'スペルチェック用のカスタム単語。' -config.nameStyle.config = +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! [[ -命名スタイル設定。 -[formatter docs](https://github.com/CppCXY/EmmyLuaCodeStyle/tree/master/docs) を参照してください。 +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.telemetry.enable = +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! [[ -テレメトリを有効にし、エディタ情報とエラーログをネットワーク経由で送信します。プライバシーポリシーは[こちら](https://luals.github.io/privacy/#language-server)。 +Modify the diagnostic severity. + +End with `!` means override the group setting `diagnostics.groupSeverity`. ]] -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.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! +[[ +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 `!`. +]] +config.diagnostics.groupFileStatus = -- TODO: need translate! +[[ +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 `!`. +]] +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.validScheme = -- TODO: need translate! +'Enable diagnostics for 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 = "プリロード時にこの値(KB)より大きいファイルをスキップします。" config.workspace.library = @@ -177,6 +224,82 @@ config.hover.expandAlias = [[ エイリアスを展開するかどうか。たとえば、`---@alias myType boolean|number`を展開すると`boolean|number`として表示され、そうでない場合は`myType`として表示されます。 ]] +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 = +[[ +デフォルトのフォーマット設定。ワークスペース内の`.editorconfig`ファイルより優先度が低くなります。 +[formatter docs](https://github.com/CppCXY/EmmyLuaCodeStyle/tree/master/docs) を参照してください。 +]] +config.spell.dict = +'スペルチェック用のカスタム単語。' +config.nameStyle.config = +[[ +命名スタイル設定。 +[formatter docs](https://github.com/CppCXY/EmmyLuaCodeStyle/tree/master/docs) を参照してください。 +]] +config.telemetry.enable = +[[ +テレメトリを有効にし、エディタ情報とエラーログをネットワーク経由で送信します。プライバシーポリシーは[こちら](https://luals.github.io/privacy/#language-server)。 +]] +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.type.castNumberToInteger = '`number` 型を `integer` 型に代入することを許可します。' config.type.weakUnionCheck = diff --git a/locale/pt-br/meta.lua b/locale/pt-br/meta.lua index 7aa064675..2f9720c17 100644 --- a/locale/pt-br/meta.lua +++ b/locale/pt-br/meta.lua @@ -881,3 +881,5 @@ utf8.len = 'Retorna o número de caracteres UTF-8 na string `s` que começa entre as posições `i` e `j` (ambos inclusos).' utf8.offset = 'Retorna a posição (em bytes) onde a codificação do `n`-ésimo caractere de `s` inícia (contando a partir da posição `i`).' +utf8.offset[55] = -- TODO: need translate! +'Returns the position of the n-th character of s (counting from byte position i) as two integers: The index (in bytes) where its encoding starts and the index (in bytes) where it ends.' diff --git a/locale/pt-br/setting.lua b/locale/pt-br/setting.lua index b2777a6b9..b26c4f254 100644 --- a/locale/pt-br/setting.lua +++ b/locale/pt-br/setting.lua @@ -121,8 +121,6 @@ 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 = diff --git a/locale/zh-cn/meta.lua b/locale/zh-cn/meta.lua index c243434c8..3ae4f8844 100644 --- a/locale/zh-cn/meta.lua +++ b/locale/zh-cn/meta.lua @@ -860,3 +860,5 @@ utf8.len = '返回字符串 `s` 中 从位置 `i` 到 `j` 间 (包括两端) UTF-8 字符的个数。' utf8.offset = '返回编码在 `s` 中的第 `n` 个字符的开始位置(按字节数) (从位置 `i` 处开始统计)。' +utf8.offset[55] = -- TODO: need translate! +'Returns the position of the n-th character of s (counting from byte position i) as two integers: The index (in bytes) where its encoding starts and the index (in bytes) where it ends.' diff --git a/locale/zh-cn/setting.lua b/locale/zh-cn/setting.lua index 056867792..cd8f45c40 100644 --- a/locale/zh-cn/setting.lua +++ b/locale/zh-cn/setting.lua @@ -120,8 +120,6 @@ config.diagnostics.validScheme = '对使用以下 scheme 的lua文件启用诊断。' config.diagnostics.unusedLocalExclude = '如果变量名匹配以下规则,则不对其进行 `unused-local` 诊断。' -config.diagnostics.validScheme = -'对使用以下 scheme 的lua文件启用诊断。' config.workspace.ignoreDir = "忽略的文件与目录(使用 `.gitignore` 语法)。" config.workspace.ignoreSubmodules = diff --git a/locale/zh-tw/meta.lua b/locale/zh-tw/meta.lua index b76715457..99e567abc 100644 --- a/locale/zh-tw/meta.lua +++ b/locale/zh-tw/meta.lua @@ -864,3 +864,5 @@ utf8.len = '回傳字串 `s` 中 從位置 `i` 到 `j` 間 (包括兩端) UTF-8 字元的個數。' utf8.offset = '回傳編碼在 `s` 中的第 `n` 個字元的開始位置(按位元組數)(從位置 `i` 處開始統計)。' +utf8.offset[55] = -- TODO: need translate! +'Returns the position of the n-th character of s (counting from byte position i) as two integers: The index (in bytes) where its encoding starts and the index (in bytes) where it ends.' diff --git a/locale/zh-tw/setting.lua b/locale/zh-tw/setting.lua index de8d79792..15e846bf9 100644 --- a/locale/zh-tw/setting.lua +++ b/locale/zh-tw/setting.lua @@ -120,8 +120,6 @@ config.diagnostics.validScheme = '對使用以下 scheme 的lua檔案啟用診斷。' config.diagnostics.unusedLocalExclude = '如果變數名符合以下規則,則不對其進行 `unused-local` 診斷。' -config.diagnostics.validScheme = -'對使用以下 scheme 的lua檔案啟用診斷。' config.workspace.ignoreDir = "忽略的檔案與目錄(使用 `.gitignore` 語法)。" config.workspace.ignoreSubmodules = diff --git a/tools/locale.lua b/tools/locale.lua index fa32fe160..537743c52 100644 --- a/tools/locale.lua +++ b/tools/locale.lua @@ -120,6 +120,7 @@ local function buildLocaleFile(localeName, allKeys, localeMap, fileName) local lastKey local blocks = {} local currentBlock = {} + local usedKeys = {} blocks[#blocks+1] = currentBlock for _, key in ipairs(allKeys) do if needSplit(key, lastKey) then @@ -127,7 +128,10 @@ local function buildLocaleFile(localeName, allKeys, localeMap, fileName) blocks[#blocks+1] = currentBlock end lastKey = key - currentBlock[#currentBlock+1] = key + if not usedKeys[key] then + currentBlock[#currentBlock+1] = key + usedKeys[key] = true + end end if fileName == 'meta' then From 744156bdcafdeb8fd620cd24a6d0894f1d2fe20c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Thu, 25 Dec 2025 11:32:07 +0800 Subject: [PATCH 4/6] translate locale by AI --- locale/es-419/meta.lua | 4 +- locale/ja-jp/meta.lua | 4 +- locale/ja-jp/setting.lua | 200 +++++++++++++++++++-------------------- locale/pt-br/meta.lua | 4 +- locale/zh-cn/meta.lua | 4 +- locale/zh-tw/meta.lua | 4 +- 6 files changed, 110 insertions(+), 110 deletions(-) diff --git a/locale/es-419/meta.lua b/locale/es-419/meta.lua index a4a91a650..d7ef11f08 100644 --- a/locale/es-419/meta.lua +++ b/locale/es-419/meta.lua @@ -880,5 +880,5 @@ utf8.len = 'Retorna el número de caracteres en UTF-8 en el string `s` que empiezan entre las posiciones `i` y `j` (ambos inclusive).' utf8.offset = 'Retorna la posición en bytes donde la codificación del caracter `n`-ésimo de `s` empieza, contado a partir de la posición `i`.' -utf8.offset[55] = -- TODO: need translate! -'Returns the position of the n-th character of s (counting from byte position i) as two integers: The index (in bytes) where its encoding starts and the index (in bytes) where it ends.' +utf8.offset[55] = +'Retorna la posición del carácter número `n` de `s` (contando desde la posición de byte `i`) como dos enteros: el índice (en bytes) donde empieza su codificación y el índice (en bytes) donde termina.' diff --git a/locale/ja-jp/meta.lua b/locale/ja-jp/meta.lua index fb6c337a3..d541a9131 100644 --- a/locale/ja-jp/meta.lua +++ b/locale/ja-jp/meta.lua @@ -876,5 +876,5 @@ utf8.len = 'バイト位置 `i` から `j`(両方含む)の間に含まれるUTF-8文字の数を返す。' utf8.offset = '文字列 `s` における `n` 番目の文字が始まるバイト位置をを返す。`i` が指定された場合、`i` から数えたバイト位置を返す。' -utf8.offset[55] = -- TODO: need translate! -'Returns the position of the n-th character of s (counting from byte position i) as two integers: The index (in bytes) where its encoding starts and the index (in bytes) where it ends.' +utf8.offset[55] = +'文字列 `s` における `n` 番目の文字の位置を、2つの整数として返します(バイト位置 `i` から数えます):その文字のエンコードが開始するバイトインデックスと終了するバイトインデックス。' diff --git a/locale/ja-jp/setting.lua b/locale/ja-jp/setting.lua index 7f4e2ca31..5bf50c403 100644 --- a/locale/ja-jp/setting.lua +++ b/locale/ja-jp/setting.lua @@ -6,129 +6,129 @@ config.addonManager.repositoryBranch = "アドオンマネージャーが使用するgitブランチを指定します。" config.addonManager.repositoryPath = "アドオンマネージャーが使用するgitパスを指定します。" -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.addonRepositoryPath = +"アドオンのリポジトリパスを指定します(アドオンマネージャーとは無関係です)。" +config.runtime.version = +"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. +`require` を使用する際、入力名に基づいてファイルを探す方法。 +この設定を `?/init.lua` にすると、`require 'myfile'` と入力したとき、読み込まれたファイルから `${workspace}/myfile/init.lua` が検索されます。 +`runtime.pathStrict` が `false` の場合、`${workspace}/**/myfile/init.lua` も検索対象になります。 +ワークスペース外のファイルを読み込みたい場合は、先に `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 = +'有効にすると、`runtime.path` は最上位のディレクトリ階層のみを検索します。詳細は `runtime.path` の説明を参照してください。' +config.runtime.special = +[[カスタムのグローバル変数を一部の特別な組み込み変数として扱い、言語サーバーが特別なサポートを提供します。 +以下の例では、`include` を `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 = +"名前に Unicode 文字を使用できるようにします。" +config.runtime.nonstandardSymbol = +"非標準の記号をサポートします。ランタイム環境がこれらの記号をサポートしていることを確認してください。" +config.runtime.plugin = +"プラグインのパス。詳細は [wiki](https://luals.github.io/wiki/plugins) を参照してください。" +config.runtime.pluginArgs = +"プラグインに渡す追加引数。" +config.runtime.fileEncoding = +"ファイルのエンコーディング。`ansi` オプションは `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. +組み込みライブラリの有効状態を調整します。実際のランタイム環境に応じて、存在しないライブラリを無効化(または再定義)できます。 -* `default`: Indicates that the library will be enabled or disabled according to the runtime version -* `enable`: always enable -* `disable`: always disable +* `default`: ランタイムバージョンに応じてライブラリを有効/無効にします +* `enable`: 常に有効 +* `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! +config.runtime.meta = +'メタファイルのディレクトリ名の形式。' +config.diagnostics.enable = +"診断を有効にします。" +config.diagnostics.disable = +"無効化する診断(ホバーの括弧内に表示されるコードを使用)。" +config.diagnostics.globals = +"定義済みのグローバル変数。" +config.diagnostics.globalsRegex = +"正規表現で定義済みのグローバル変数を検索します。" +config.diagnostics.severity = [[ -Modify the diagnostic severity. +診断の重大度を変更します。 -End with `!` means override the group setting `diagnostics.groupSeverity`. +末尾に `!` を付けると、グループ設定 `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: 開いているファイルのみを診断 +* Any: すべてのファイルを診断 +* None: この診断を無効化 -End with `!` means override the group setting `diagnostics.groupFileStatus`. +末尾に `!` を付けると、グループ設定 `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 `!`. +グループ内の診断の重大度を変更します。 +`Fallback` は、このグループ内の診断が個別に `diagnostics.severity` によって制御されることを意味します。 +その他の設定は、末尾に `!` が付いていない個別の設定を上書きします。 ]] -config.diagnostics.groupFileStatus = -- TODO: need translate! +config.diagnostics.groupFileStatus = [[ -Modify the diagnostic needed file status in a group. +グループ内の診断対象ファイル状態を変更します。 -* Opened: only diagnose opened files -* Any: diagnose all files -* None: disable this diagnostic +* Opened: 開いているファイルのみを診断 +* Any: すべてのファイルを診断 +* None: この診断を無効化 -`Fallback` means that diagnostics in this group are controlled by `diagnostics.neededFileStatus` separately. -Other settings will override individual settings without end of `!`. +`Fallback` は、このグループ内の診断が個別に `diagnostics.neededFileStatus` によって制御されることを意味します。 +その他の設定は、末尾に `!` が付いていない個別の設定を上書きします。 ]] -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.validScheme = -- TODO: need translate! -'Enable diagnostics for 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.diagnostics.workspaceEvent = +"ワークスペース診断をトリガーするタイミングを設定します。" +config.diagnostics.workspaceEvent.OnChange = +"ファイルが変更されたときにワークスペース診断をトリガーします。" +config.diagnostics.workspaceEvent.OnSave = +"ファイルが保存されたときにワークスペース診断をトリガーします。" +config.diagnostics.workspaceEvent.None = +"ワークスペース診断を無効にします。" +config.diagnostics.workspaceDelay = +"ワークスペース診断の待ち時間(ミリ秒)。" +config.diagnostics.workspaceRate = +"ワークスペース診断の実行レート(%)。この値を下げると CPU 使用率は低下しますが、ワークスペース診断の速度も低下します。現在編集中のファイルの診断は常に全速で行われ、この設定の影響を受けません。" +config.diagnostics.libraryFiles = +"`Lua.workspace.library` 経由で読み込まれたファイルをどのように診断するか。" +config.diagnostics.libraryFiles.Enable = +"常にこれらのファイルを診断します。" +config.diagnostics.libraryFiles.Opened = +"これらのファイルが開かれているときのみ診断します。" +config.diagnostics.libraryFiles.Disable = +"これらのファイルは診断しません。" +config.diagnostics.ignoredFiles = +"無視されているファイルをどのように診断するか。" +config.diagnostics.ignoredFiles.Enable = +"常にこれらのファイルを診断します。" +config.diagnostics.ignoredFiles.Opened = +"これらのファイルが開かれているときのみ診断します。" +config.diagnostics.ignoredFiles.Disable = +"これらのファイルは診断しません。" +config.diagnostics.disableScheme = +'次のスキームを使用する Lua ファイルは診断しません。' +config.diagnostics.validScheme = +'次のスキームを使用する Lua ファイルの診断を有効にします。' +config.diagnostics.unusedLocalExclude = +'変数名が次のパターンに一致する場合、`unused-local` を診断しません。' +config.workspace.ignoreDir = +"無視するファイルとディレクトリ(`.gitignore` の構文を使用)。"-- .. example.ignoreDir, +config.workspace.ignoreSubmodules = +"サブモジュールを無視します。" +config.workspace.useGitIgnore = +"`.gitignore` に記載されたファイルを無視します。" +config.workspace.maxPreload = +"プリロードする最大ファイル数。" config.workspace.preloadFileSize = "プリロード時にこの値(KB)より大きいファイルをスキップします。" config.workspace.library = diff --git a/locale/pt-br/meta.lua b/locale/pt-br/meta.lua index 2f9720c17..2b0810f41 100644 --- a/locale/pt-br/meta.lua +++ b/locale/pt-br/meta.lua @@ -881,5 +881,5 @@ utf8.len = 'Retorna o número de caracteres UTF-8 na string `s` que começa entre as posições `i` e `j` (ambos inclusos).' utf8.offset = 'Retorna a posição (em bytes) onde a codificação do `n`-ésimo caractere de `s` inícia (contando a partir da posição `i`).' -utf8.offset[55] = -- TODO: need translate! -'Returns the position of the n-th character of s (counting from byte position i) as two integers: The index (in bytes) where its encoding starts and the index (in bytes) where it ends.' +utf8.offset[55] = +'Retorna a posição do n-ésimo caractere de `s` (contando a partir da posição de byte `i`) como dois inteiros: o índice (em bytes) onde sua codificação começa e o índice (em bytes) onde ela termina.' diff --git a/locale/zh-cn/meta.lua b/locale/zh-cn/meta.lua index 3ae4f8844..86ae136bb 100644 --- a/locale/zh-cn/meta.lua +++ b/locale/zh-cn/meta.lua @@ -860,5 +860,5 @@ utf8.len = '返回字符串 `s` 中 从位置 `i` 到 `j` 间 (包括两端) UTF-8 字符的个数。' utf8.offset = '返回编码在 `s` 中的第 `n` 个字符的开始位置(按字节数) (从位置 `i` 处开始统计)。' -utf8.offset[55] = -- TODO: need translate! -'Returns the position of the n-th character of s (counting from byte position i) as two integers: The index (in bytes) where its encoding starts and the index (in bytes) where it ends.' +utf8.offset[55] = +'返回字符串 `s` 中第 `n` 个字符的位置(从字节位置 `i` 开始计数),以两个整数表示:其编码开始的字节索引和结束的字节索引。' diff --git a/locale/zh-tw/meta.lua b/locale/zh-tw/meta.lua index 99e567abc..52169a532 100644 --- a/locale/zh-tw/meta.lua +++ b/locale/zh-tw/meta.lua @@ -864,5 +864,5 @@ utf8.len = '回傳字串 `s` 中 從位置 `i` 到 `j` 間 (包括兩端) UTF-8 字元的個數。' utf8.offset = '回傳編碼在 `s` 中的第 `n` 個字元的開始位置(按位元組數)(從位置 `i` 處開始統計)。' -utf8.offset[55] = -- TODO: need translate! -'Returns the position of the n-th character of s (counting from byte position i) as two integers: The index (in bytes) where its encoding starts and the index (in bytes) where it ends.' +utf8.offset[55] = +'以兩個整數回傳字串 `s` 中第 `n` 個字元的位置(從位元組位置 `i` 開始計數):其編碼開始的位元組索引與結束的位元組索引。' From 3fef0997dff5353e16921d56b7bc0416cf1f8409 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Thu, 25 Dec 2025 11:41:56 +0800 Subject: [PATCH 5/6] `for .. in` should only treat the first variable as const --- changelog.md | 2 +- script/parser/compile.lua | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/changelog.md b/changelog.md index a8931e3e4..ae2e3ce57 100644 --- a/changelog.md +++ b/changelog.md @@ -5,7 +5,7 @@ ## 3.16.4 * `FIX` (VSCode) Broken `view document` - +* `FIX` `for .. in` should only treat the first variable as const ## 3.16.3 `2025-12-23` diff --git a/script/parser/compile.lua b/script/parser/compile.lua index f3b36ba91..d6a8722cc 100644 --- a/script/parser/compile.lua +++ b/script/parser/compile.lua @@ -4098,9 +4098,9 @@ local function parseFor() for i = 1, #list do local obj = list[i] ---@cast obj parser.object - -- In Lua 5.5, for loop variables are treated as constants + -- In Lua 5.5, for first loop variable is treated as constant local attrs - if State.version == 'Lua 5.5' then + if i == 1 and State.version == 'Lua 5.5' then attrs = { type = 'localattrs', start = obj.start, From af7bea0b05b1c11d2579db02de3ccd32224b5ccb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Thu, 25 Dec 2025 11:42:18 +0800 Subject: [PATCH 6/6] 3.16.4 --- changelog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/changelog.md b/changelog.md index ae2e3ce57..d4ecb8039 100644 --- a/changelog.md +++ b/changelog.md @@ -4,6 +4,7 @@ ## 3.16.4 +`2025-12-25` * `FIX` (VSCode) Broken `view document` * `FIX` `for .. in` should only treat the first variable as const