diff options
-rw-r--r-- | script/config/config.lua | 1 | ||||
-rw-r--r-- | script/provider/provider.lua | 8 |
2 files changed, 9 insertions, 0 deletions
diff --git a/script/config/config.lua b/script/config/config.lua index 4df62a05..ea87893d 100644 --- a/script/config/config.lua +++ b/script/config/config.lua @@ -208,6 +208,7 @@ local Template = { ['Lua.hint.arrayIndex'] = Type.Boolean >> 'Auto', ['Lua.window.statusBar'] = Type.Boolean >> true, ['Lua.window.progressBar'] = Type.Boolean >> true, + ['Lua.format.enable'] = Type.Boolean >> true, ['Lua.IntelliSense.traceLocalSet'] = Type.Boolean >> false, ['Lua.IntelliSense.traceReturn'] = Type.Boolean >> false, ['Lua.IntelliSense.traceBeSetted'] = Type.Boolean >> false, diff --git a/script/provider/provider.lua b/script/provider/provider.lua index df226c3f..7d628306 100644 --- a/script/provider/provider.lua +++ b/script/provider/provider.lua @@ -923,6 +923,10 @@ m.register 'textDocument/formatting' { return nil end + if not config.get(uri, 'Lua.format.enable') then + return nil + end + local pformatting = require 'provider.formatting' pformatting.updateConfig(uri) @@ -953,6 +957,10 @@ m.register 'textDocument/rangeFormatting' { return nil end + if not config.get(uri, 'Lua.format.enable') then + return nil + end + local pformatting = require 'provider.formatting' pformatting.updateConfig(uri) |