diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-01-28 19:57:00 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-01-28 19:57:00 +0800 |
commit | 0c083272ea34af6705ad838d013fe2a3a85234a2 (patch) | |
tree | fd0386264e83263d99f343d72e67515d9b046a77 /script | |
parent | 457b73fd22d8ed34301a6a606636d3003735b4dc (diff) | |
download | lua-language-server-0c083272ea34af6705ad838d013fe2a3a85234a2.zip |
update locale
Diffstat (limited to 'script')
-rw-r--r-- | script/files.lua | 2 | ||||
-rw-r--r-- | script/language.lua | 3 | ||||
-rw-r--r-- | script/provider/diagnostic.lua | 20 | ||||
-rw-r--r-- | script/provider/provider.lua | 23 | ||||
-rw-r--r-- | script/service/service.lua | 11 | ||||
-rw-r--r-- | script/workspace/workspace.lua | 6 |
6 files changed, 35 insertions, 30 deletions
diff --git a/script/files.lua b/script/files.lua index 57f51af3..7d43f39e 100644 --- a/script/files.lua +++ b/script/files.lua @@ -316,7 +316,7 @@ function m.compileAst(uri, text) end return nil end - local prog <close> = progress.create('正在编译', 0.5) + local prog <close> = progress.create(lang.script.WINDOW_COMPILING, 0.5) prog:setMessage(ws.getRelativePath(m.getOriginUri(uri))) local clock = os.clock() local state, err = parser:compile(text diff --git a/script/language.lua b/script/language.lua index 69894e39..e3f92275 100644 --- a/script/language.lua +++ b/script/language.lua @@ -134,6 +134,9 @@ return setmetatable({ local language = getLanguage(id) log.info(('VSC language: %s'):format(id)) log.info(('LS language: %s'):format(language)) + for k in pairs(self) do + self[k] = nil + end self.id = language end, }) diff --git a/script/provider/diagnostic.lua b/script/provider/diagnostic.lua index 7be65339..9f9416fb 100644 --- a/script/provider/diagnostic.lua +++ b/script/provider/diagnostic.lua @@ -186,7 +186,7 @@ function m.doDiagnostic(uri) return end - local prog <close> = progress.create('正在诊断', 0.5) + local prog <close> = progress.create(lang.script.WINDOW_DIAGNOSING, 0.5) prog:setMessage(ws.getRelativePath(files.getOriginUri(uri))) local syntax = m.syntaxErrors(uri, ast) @@ -246,36 +246,38 @@ local function askForDisable() if m.dontAskedForDisable then return end + local delay = 30 + local delayTitle = lang.script('WINDOW_DELAY_WS_DIAGNOSTIC', delay) local item = proto.awaitRequest('window/showMessageRequest', { type = define.MessageType.Info, - message = '你可以在设置中延迟或禁用工作目录诊断', + message = lang.script.WINDOW_SETTING_WS_DIAGNOSTIC, actions = { { - title = '不再提醒', + title = lang.script.WINDOW_DONT_SHOW_AGAIN, }, { - title = '空闲时进行工作区诊断(延迟30秒)', + title = delayTitle, }, { - title = '禁用工作区诊断', + title = lang.script.WINDOW_DISABLE_DIAGNOSTIC, }, } }) if not item then return end - if item.title == '不再提醒' then + if item.title == lang.script.WINDOW_DONT_SHOW_AGAIN then m.dontAskedForDisable = true - elseif item.title == '空闲时再进行诊断(延迟30秒)' then + elseif item.title == delayTitle then proto.notify('$/command', { command = 'lua.config', data = { key = 'Lua.diagnostics.workspaceDelay', action = 'set', - value = 30000, + value = delay * 1000, } }) - elseif item.title == '禁用工作区诊断' then + elseif item.title == lang.script.WINDOW_DISABLE_DIAGNOSTIC then proto.notify('workspace/executeCommand', { command = 'lua.config', data = { diff --git a/script/provider/provider.lua b/script/provider/provider.lua index 894b8ef2..31cefbff 100644 --- a/script/provider/provider.lua +++ b/script/provider/provider.lua @@ -104,7 +104,7 @@ end) proto.on('initialized', function (params) files.init() - local _ <close> = progress.create('正在初始化...', 0.5) + local _ <close> = progress.create(lang.script.WINDOW_INITIALIZING, 0.5) updateConfig() proto.awaitRequest('client/registerCapability', { registrations = { @@ -225,7 +225,7 @@ proto.on('textDocument/hover', function (params) await.close 'hover' await.setID 'hover' workspace.awaitReady() - local _ <close> = progress.create('正在处理悬浮提示...', 0.5) + local _ <close> = progress.create(lang.script.WINDOW_PROCESSING_HOVER, 0.5) local core = require 'core.hover' local doc = params.textDocument local uri = doc.uri @@ -255,7 +255,7 @@ end) proto.on('textDocument/definition', function (params) workspace.awaitReady() - local _ <close> = progress.create('正在处理转到定义...', 0.5) + local _ <close> = progress.create(lang.script.WINDOW_PROCESSING_DEFINITION, 0.5) local core = require 'core.definition' local uri = params.textDocument.uri if not files.exists(uri) then @@ -284,7 +284,7 @@ end) proto.on('textDocument/references', function (params) workspace.awaitReady() - local _ <close> = progress.create('正在处理转到引用...', 0.5) + local _ <close> = progress.create(lang.script.WINDOW_PROCESSING_REFERENCE, 0.5) local core = require 'core.reference' local uri = params.textDocument.uri if not files.exists(uri) then @@ -328,7 +328,7 @@ end) proto.on('textDocument/rename', function (params) workspace.awaitReady() - local _ <close> = progress.create('正在处理重命名...', 0.5) + local _ <close> = progress.create(lang.script.WINDOW_PROCESSING_RENAME, 0.5) local core = require 'core.rename' local uri = params.textDocument.uri if not files.exists(uri) then @@ -372,7 +372,7 @@ end) proto.on('textDocument/completion', function (params) workspace.awaitReady() - local _ <close> = progress.create('正在处理自动完成...', 0.5) + local _ <close> = progress.create(lang.script.WINDOW_PROCESSING_COMPLETION, 0.5) --log.info(util.dump(params)) local core = require 'core.completion' --log.debug('textDocument/completion') @@ -497,7 +497,7 @@ proto.on('textDocument/signatureHelp', function (params) return nil end workspace.awaitReady() - local _ <close> = progress.create('正在处理参数提示...', 0.5) + local _ <close> = progress.create(lang.script.WINDOW_PROCESSING_SIGNATURE, 0.5) local uri = params.textDocument.uri if not files.exists(uri) then return nil @@ -538,7 +538,7 @@ end) proto.on('textDocument/documentSymbol', function (params) local core = require 'core.document-symbol' - local _ <close> = progress.create('正在处理文件符号...', 0.5) + local _ <close> = progress.create(lang.script.WINDOW_PROCESSING_SYMBOL, 0.5) local uri = params.textDocument.uri while not files.exists(uri) do await.sleep(0.1) @@ -623,7 +623,7 @@ end) proto.on('workspace/symbol', function (params) workspace.awaitReady() - local _ <close> = progress.create('正在处理工作区符号...', 0.5) + local _ <close> = progress.create(lang.script.WINDOW_PROCESSING_WS_SYMBOL, 0.5) local core = require 'core.workspace-symbol' await.close('workspace/symbol') @@ -656,7 +656,7 @@ end) proto.on('textDocument/semanticTokens/full', function (params) workspace.awaitReady() - local _ <close> = progress.create('正在处理全量语义着色...', 0.5) + local _ <close> = progress.create(lang.script.WINDOW_PROCESSING_SEMANTIC_FULL, 0.5) local core = require 'core.semantic-tokens' local uri = params.textDocument.uri log.debug('semanticTokens/full', uri) @@ -673,7 +673,7 @@ end) proto.on('textDocument/semanticTokens/range', function (params) workspace.awaitReady() - local _ <close> = progress.create('正在处理差量语义着色...', 0.5) + local _ <close> = progress.create(lang.script.WINDOW_PROCESSING_SEMANTIC_RANGE, 0.5) local core = require 'core.semantic-tokens' local uri = params.textDocument.uri log.debug('semanticTokens/range', uri) @@ -719,6 +719,5 @@ proto.on('textDocument/foldingRange', function (params) end) proto.on('window/workDoneProgress/cancel', function (params) - local progress = require 'progress' progress.cancel(params.token) end) diff --git a/script/service/service.lua b/script/service/service.lua index 443ee14d..20e07980 100644 --- a/script/service/service.lua +++ b/script/service/service.lua @@ -6,6 +6,7 @@ local proto = require 'proto' local vm = require 'vm' local util = require 'utility' local files = require 'files' +local lang = require 'language' local m = {} m.type = 'service' @@ -156,11 +157,11 @@ function m.reportStatus() else info.text = '😺Lua' end - info.tooltip = ('已缓存文件:%d/%d\n内存占用:%.fM'):format( - files.astCount, - files.fileCount, - collectgarbage('count') / 1000 - ) + info.tooltip = lang.script('WINDOW_LUA_STATUS', { + ast = files.astCount, + max = files.fileCount, + mem = collectgarbage('count') / 1000, + }) proto.notify('$/status/report', info) end)() end diff --git a/script/workspace/workspace.lua b/script/workspace/workspace.lua index 90db1f0c..368add6b 100644 --- a/script/workspace/workspace.lua +++ b/script/workspace/workspace.lua @@ -185,17 +185,17 @@ local function loadFileFactory(root, progressData, isLibrary) message = lang.script('MWS_MAX_PRELOAD', config.config.workspace.maxPreload), actions = { { - title = '增加上限', + title = lang.script.WINDOW_INCREASE_UPPER_LIMIT, }, { - title = '关闭', + title = lang.script.WINDOW_CLOSE, } } }) if not item then return end - if item.title == '增加上限' then + if item.title == lang.script.WINDOW_INCREASE_UPPER_LIMIT then proto.notify('$/command', { command = 'lua.config', data = { |