Skip to content

Commit aa13aba

Browse files
committed
编辑器设置优先
1 parent e518eed commit aa13aba

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

script/core/formatting.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
local codeFormat = require("code_format")
2-
local files = require("files")
3-
local log = require("log")
2+
local files = require("files")
3+
local log = require("log")
44

5-
return function(uri)
5+
return function(uri, options)
66
local text = files.getText(uri)
77
local ast = files.getState(uri)
8-
local status, formattedText = codeFormat.format(uri, text)
8+
local status, formattedText = codeFormat.format(uri, text, options)
99

1010
if not status then
1111
if formattedText ~= nil then

script/core/rangeformatting.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ local files = require("files")
33
local log = require("log")
44
local converter = require("proto.converter")
55

6-
return function(uri, range)
6+
return function(uri, range, options)
77
local text = files.getText(uri)
88
local status, formattedText, startLine, endLine = codeFormat.range_format(
9-
uri, text, range.start.line, range["end"].line)
9+
uri, text, range.start.line, range["end"].line, options)
1010

1111
if not status then
1212
if formattedText ~= nil then

script/provider/provider.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,7 +1019,7 @@ m.register 'textDocument/formatting' {
10191019
pformatting.updateConfig(uri)
10201020

10211021
local core = require 'core.formatting'
1022-
local edits = core(uri)
1022+
local edits = core(uri, params.options)
10231023
if not edits or #edits == 0 then
10241024
return nil
10251025
end
@@ -1057,7 +1057,7 @@ m.register 'textDocument/rangeFormatting' {
10571057
pformatting.updateConfig(uri)
10581058

10591059
local core = require 'core.rangeformatting'
1060-
local edits = core(uri, params.range)
1060+
local edits = core(uri, params.range, params.options)
10611061
if not edits or #edits == 0 then
10621062
return nil
10631063
end

0 commit comments

Comments
 (0)