summaryrefslogtreecommitdiff
path: root/script/provider/name-style.lua
diff options
context:
space:
mode:
Diffstat (limited to 'script/provider/name-style.lua')
-rw-r--r--script/provider/name-style.lua28
1 files changed, 28 insertions, 0 deletions
diff --git a/script/provider/name-style.lua b/script/provider/name-style.lua
new file mode 100644
index 00000000..bdb20d80
--- /dev/null
+++ b/script/provider/name-style.lua
@@ -0,0 +1,28 @@
+local suc, codeFormat = pcall(require, 'code_format')
+if not suc then
+ return
+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
+
+config.watch(function (uri, key, value)
+ if key == "Lua.nameStyle.config" then
+ codeFormat.update_name_style_config(value)
+ end
+end)
+
+return m