diff options
author | CppCXY <812125110@qq.com> | 2023-04-27 16:20:06 +0800 |
---|---|---|
committer | CppCXY <812125110@qq.com> | 2023-04-27 16:20:06 +0800 |
commit | 1d09f3bd87645e930bf93c14e5790b9297c49075 (patch) | |
tree | c9748852571c6a03e419c216ef412f03a0bd8bb5 | |
parent | f6e103f10acd4b20fd73cd7a5b9b76fa0a676810 (diff) | |
download | lua-language-server-1d09f3bd87645e930bf93c14e5790b9297c49075.zip |
更新实现
m--------- | 3rd/EmmyLuaCodeStyle | 0 | ||||
-rw-r--r-- | locale/en-us/setting.lua | 4 | ||||
-rw-r--r-- | locale/pt-br/setting.lua | 4 | ||||
-rw-r--r-- | locale/zh-cn/setting.lua | 4 | ||||
-rw-r--r-- | locale/zh-tw/setting.lua | 4 | ||||
-rw-r--r-- | script/config/template.lua | 2 | ||||
-rw-r--r-- | script/core/diagnostics/name-style-check.lua (renamed from script/core/diagnostics/name-style.lua) | 0 | ||||
-rw-r--r-- | script/proto/diagnostic.lua | 2 | ||||
-rw-r--r-- | script/provider/name-style.lua | 9 |
9 files changed, 26 insertions, 3 deletions
diff --git a/3rd/EmmyLuaCodeStyle b/3rd/EmmyLuaCodeStyle -Subproject 081b623d03627b281d5744ab53c420667573b95 +Subproject 00e24b9378c5700875899ab310109ca14fb4bc7 diff --git a/locale/en-us/setting.lua b/locale/en-us/setting.lua index a354ff0b..48cde197 100644 --- a/locale/en-us/setting.lua +++ b/locale/en-us/setting.lua @@ -269,6 +269,8 @@ Read [formatter docs](https://github.com/CppCXY/EmmyLuaCodeStyle/tree/master/doc ]] config.spell.dict = 'Custom words for spell checking.' +config.nameStyle.config = +'Set name style config' config.telemetry.enable = [[ Enable telemetry to send your editor information and error logs over the network. Read our privacy policy [here](https://github.com/LuaLS/lua-language-server/wiki/Home#privacy). @@ -401,6 +403,8 @@ config.diagnostics['return-type-mismatch'] = 'Enable diagnostics for return values whose type does not match the type declared in the corresponding return annotation.' config.diagnostics['spell-check'] = 'Enable diagnostics for typos in strings.' +config.diagnostics['name-style-check'] = +'Enable diagnostics for name style.' config.diagnostics['unbalanced-assignments']= 'Enable diagnostics on multiple assignments if not all variables obtain a value (e.g., `local x,y = 1`).' config.diagnostics['undefined-doc-class'] = diff --git a/locale/pt-br/setting.lua b/locale/pt-br/setting.lua index c38f0ff0..ea1bfddd 100644 --- a/locale/pt-br/setting.lua +++ b/locale/pt-br/setting.lua @@ -269,6 +269,8 @@ Read [formatter docs](https://github.com/CppCXY/EmmyLuaCodeStyle/tree/master/doc ]] config.spell.dict = -- TODO: need translate! 'Custom words for spell checking.' +config.nameStyle.config = -- TODO: need translate! +'Set name style config' config.telemetry.enable = -- TODO: need translate! [[ Enable telemetry to send your editor information and error logs over the network. Read our privacy policy [here](https://github.com/LuaLS/lua-language-server/wiki/Home#privacy). @@ -401,6 +403,8 @@ 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! diff --git a/locale/zh-cn/setting.lua b/locale/zh-cn/setting.lua index 9dbd961d..1755d76f 100644 --- a/locale/zh-cn/setting.lua +++ b/locale/zh-cn/setting.lua @@ -268,6 +268,8 @@ config.format.defaultConfig = ]] config.spell.dict = '拼写检查的自定义单词。' +config.nameStyle.config = +'设定命名风格检查的配置' config.telemetry.enable = [[ 启用遥测,通过网络发送你的编辑器信息与错误日志。在[此处](https://github.com/LuaLS/lua-language-server/wiki/Home#privacy)阅读我们的隐私声明。 @@ -400,6 +402,8 @@ 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! diff --git a/locale/zh-tw/setting.lua b/locale/zh-tw/setting.lua index 7cf93297..6c2c0489 100644 --- a/locale/zh-tw/setting.lua +++ b/locale/zh-tw/setting.lua @@ -268,6 +268,8 @@ config.format.defaultConfig = ]] config.spell.dict = '拼寫檢查的自訂單詞。' +config.nameStyle.config = -- TODO: need translate! +'Set name style config' config.telemetry.enable = [[ 啟用遙測,透過網路發送你的編輯器資訊與錯誤日誌。在[此處](https://github.com/LuaLS/lua-language-server/wiki/Home#privacy)閱讀我們的隱私聲明。 @@ -400,6 +402,8 @@ 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! diff --git a/script/config/template.lua b/script/config/template.lua index 2b40f1a2..436f5e1a 100644 --- a/script/config/template.lua +++ b/script/config/template.lua @@ -385,7 +385,7 @@ local template = { auto_complete_table_sep = "true" }, ['Lua.spell.dict'] = Type.Array(Type.String), - ['Lua.nameStyle.config'] = Type.Hash(Type.String, Type.Or(Type.String, Type.Hash(Type.String, Type.String))) + ['Lua.nameStyle.config'] = Type.Hash(Type.String, Type.Or(Type.String, Type.Array(Type.Hash(Type.String, Type.String)))) >> {}, ['Lua.misc.parameters'] = Type.Array(Type.String), ['Lua.misc.executablePath'] = Type.String, diff --git a/script/core/diagnostics/name-style.lua b/script/core/diagnostics/name-style-check.lua index 4bdb068f..4bdb068f 100644 --- a/script/core/diagnostics/name-style.lua +++ b/script/core/diagnostics/name-style-check.lua diff --git a/script/proto/diagnostic.lua b/script/proto/diagnostic.lua index 5ee21638..bd10b7f7 100644 --- a/script/proto/diagnostic.lua +++ b/script/proto/diagnostic.lua @@ -126,7 +126,7 @@ m.register { } m.register { - 'namestyle-check' + 'name-style-check' } { group = 'codestyle', severity = 'Warning', diff --git a/script/provider/name-style.lua b/script/provider/name-style.lua index f9c5c756..bdb20d80 100644 --- a/script/provider/name-style.lua +++ b/script/provider/name-style.lua @@ -5,10 +5,17 @@ end local config = require 'config' - local m = {} +m.loaded = false + function m.nameStyleCheck(uri, text) + if not m.loaded then + local value = config.get(nil, "Lua.nameStyle.config") + codeFormat.update_name_style_config(value) + m.loaded = true + end + return codeFormat.name_style_analysis(uri, text) end |