blob: 49da68614aab292e288ab51863b57e2d972e5f59 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
local codeFormat = require("code_format")
local files = require("files")
local log = require("log")
return function(uri, options)
local text = files.getText(uri)
local ast = files.getState(uri)
local status, formattedText = codeFormat.format(uri, text, options)
if not status then
if formattedText ~= nil then
log.error(formattedText)
end
return
end
return {
{
start = ast.ast.start,
finish = ast.ast.finish,
text = formattedText,
}
}
end
|