Skip to content

Commit 60a3a70

Browse files
authored
Merge pull request #962 from CppCXY/master
编辑器设置优先
2 parents d57c21e + c920f96 commit 60a3a70

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
@@ -1020,7 +1020,7 @@ m.register 'textDocument/formatting' {
10201020
pformatting.updateConfig(uri)
10211021

10221022
local core = require 'core.formatting'
1023-
local edits = core(uri)
1023+
local edits = core(uri, params.options)
10241024
if not edits or #edits == 0 then
10251025
return nil
10261026
end
@@ -1058,7 +1058,7 @@ m.register 'textDocument/rangeFormatting' {
10581058
pformatting.updateConfig(uri)
10591059

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

0 commit comments

Comments
 (0)