Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

编辑器设置优先 #962

Merged
merged 2 commits into from
Feb 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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