diff options
author | CppCXY <812125110@qq.com> | 2022-02-22 14:06:47 +0800 |
---|---|---|
committer | CppCXY <812125110@qq.com> | 2022-02-22 14:06:47 +0800 |
commit | aa13abab66752f42081f8d61d7fb415d03953364 (patch) | |
tree | 55830fba4b6ed0bcff27670a1bb5fdaf8504e244 /script | |
parent | e518eed9efd99c46b79c9413c5f34a0f675ab9e6 (diff) | |
download | lua-language-server-aa13abab66752f42081f8d61d7fb415d03953364.zip |
编辑器设置优先
Diffstat (limited to 'script')
-rw-r--r-- | script/core/formatting.lua | 8 | ||||
-rw-r--r-- | script/core/rangeformatting.lua | 4 | ||||
-rw-r--r-- | script/provider/provider.lua | 4 |
3 files changed, 8 insertions, 8 deletions
diff --git a/script/core/formatting.lua b/script/core/formatting.lua index 6c57b8c2..49da6861 100644 --- a/script/core/formatting.lua +++ b/script/core/formatting.lua @@ -1,11 +1,11 @@ local codeFormat = require("code_format") -local files = require("files") -local log = require("log") +local files = require("files") +local log = require("log") -return function(uri) +return function(uri, options) local text = files.getText(uri) local ast = files.getState(uri) - local status, formattedText = codeFormat.format(uri, text) + local status, formattedText = codeFormat.format(uri, text, options) if not status then if formattedText ~= nil then diff --git a/script/core/rangeformatting.lua b/script/core/rangeformatting.lua index de9516c1..ccf2d21f 100644 --- a/script/core/rangeformatting.lua +++ b/script/core/rangeformatting.lua @@ -3,10 +3,10 @@ local files = require("files") local log = require("log") local converter = require("proto.converter") -return function(uri, range) +return function(uri, range, options) local text = files.getText(uri) local status, formattedText, startLine, endLine = codeFormat.range_format( - uri, text, range.start.line, range["end"].line) + uri, text, range.start.line, range["end"].line, options) if not status then if formattedText ~= nil then diff --git a/script/provider/provider.lua b/script/provider/provider.lua index f5bace80..f516e1af 100644 --- a/script/provider/provider.lua +++ b/script/provider/provider.lua @@ -1019,7 +1019,7 @@ m.register 'textDocument/formatting' { pformatting.updateConfig(uri) local core = require 'core.formatting' - local edits = core(uri) + local edits = core(uri, params.options) if not edits or #edits == 0 then return nil end @@ -1057,7 +1057,7 @@ m.register 'textDocument/rangeFormatting' { pformatting.updateConfig(uri) local core = require 'core.rangeformatting' - local edits = core(uri, params.range) + local edits = core(uri, params.range, params.options) if not edits or #edits == 0 then return nil end |