summaryrefslogtreecommitdiff
path: root/script/provider/name-style.lua
blob: bdb20d80df9f43d8130d56a8b1584b86b61b2fc1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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