Skip to content

Commit

Permalink
Merge pull request #962 from CppCXY/master
Browse files Browse the repository at this point in the history
编辑器设置优先
  • Loading branch information
sumneko authored Feb 22, 2022
2 parents d57c21e + c920f96 commit 60a3a70
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions script/core/formatting.lua
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions script/core/rangeformatting.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions script/provider/provider.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1020,7 +1020,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
Expand Down Expand Up @@ -1058,7 +1058,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
Expand Down

0 comments on commit 60a3a70

Please sign in to comment.