Skip to content

Commit 12d6a9e

Browse files
committed
cleanup
1 parent bf8b18f commit 12d6a9e

34 files changed

+376
-356
lines changed

.editorconfig

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,14 @@ enable_name_style_check = true
7676
# snake_case | upper_snake_case
7777
# same(first_param, snake_case)
7878
# same('m')
79-
local_name_define_style = camel_case
79+
local_name_define_style = camel_case|upper_snake_case
8080
function_param_name_style = camel_case
8181
function_name_define_style = camel_case
8282
local_function_name_define_style = camel_case
83-
table_field_name_define_style = camel_case
83+
table_field_name_define_style = camel_case|pascal_case
8484
global_variable_name_define_style = camel_case|upper_snake_case
8585
module_name_define_style = camel_case
8686
require_module_name_style = camel_case
8787
class_name_define_style = camel_case
88+
table_append_expression_no_space = true
89+
if_condition_align_with_each_other = true

main.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ local function loadArgs()
1010
goto CONTINUE
1111
end
1212
local value = tail:match '=(.+)'
13-
if value == 'true' or value == nil then
13+
if value == 'true' or value == nil then
1414
value = true
1515
elseif value == 'false' then
1616
value = false

make.lua

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ lm.bindir = "bin"
77
---@diagnostic disable-next-line: codestyle-check
88
lm.EXE_DIR = ""
99

10-
if platform.OS == 'macOS' then
11-
if lm.platform == nil then
10+
if platform.OS == 'macOS' then
11+
if lm.platform == nil then
1212
elseif lm.platform == "darwin-arm64" then
1313
lm.target = "arm64-apple-macos11"
1414
elseif lm.platform == "darwin-x64" then
@@ -17,7 +17,7 @@ if platform.OS == 'macOS' then
1717
error "unknown platform"
1818
end
1919
elseif platform.OS == 'Windows' then
20-
if lm.platform == nil then
20+
if lm.platform == nil then
2121
elseif lm.platform == "win32-ia32" then
2222
lm.arch = "x86"
2323
elseif lm.platform == "win32-x64" then
@@ -26,7 +26,7 @@ elseif platform.OS == 'Windows' then
2626
error "unknown platform"
2727
end
2828
elseif platform.OS == 'Linux' then
29-
if lm.platform == nil then
29+
if lm.platform == nil then
3030
elseif lm.platform == "linux-x64" then
3131
elseif lm.platform == "linux-arm64" then
3232
-- TODO: not implement
@@ -128,15 +128,15 @@ if notest then
128128
end
129129

130130
lm:build "bee-test" {
131-
lm.bindir.."/lua-language-server"..exe, "3rd/bee.lua/test/test.lua",
131+
lm.bindir .. "/lua-language-server" .. exe, "3rd/bee.lua/test/test.lua",
132132
pool = "console",
133133
deps = {
134134
"all",
135135
}
136136
}
137137

138138
lm:build 'unit-test' {
139-
lm.bindir.."/lua-language-server"..exe, 'test.lua',
139+
lm.bindir .. "/lua-language-server" .. exe, 'test.lua',
140140
pool = "console",
141141
deps = {
142142
"bee-test",

make/bootstrap.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
local main, exec
22
local i = 1
33
while arg[i] do
4-
if arg[i] == '-E' then
4+
if arg[i] == '-E' then
55
elseif arg[i] == '-e' then
66
i = i + 1
77
local expr = assert(arg[i], "'-e' needs argument")

script/client.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ end
315315
function m.setConfig(changes, onlyMemory)
316316
local finalChanges = {}
317317
for _, change in ipairs(changes) do
318-
if change.action == 'add' then
318+
if change.action == 'add' then
319319
local suc = config.add(change.uri, change.key, change.value)
320320
if suc then
321321
finalChanges[#finalChanges+1] = change

script/config/config.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ end)
4747

4848
register('Integer', 0, function (self, v)
4949
return type(v) == 'number'
50-
end,function (self, v)
50+
end, function (self, v)
5151
return math.floor(v)
5252
end)
5353

@@ -118,7 +118,7 @@ end, function (self, value)
118118
end
119119
if type(value) == 'string' then
120120
local t = {}
121-
for s in value:gmatch('[^'..self.sep..']+') do
121+
for s in value:gmatch('[^' .. self.sep .. ']+') do
122122
t[s] = true
123123
end
124124
return t
@@ -143,7 +143,7 @@ end, function (self, value)
143143
end
144144
end
145145
end, function (self, ...)
146-
self.subs = {...}
146+
self.subs = { ... }
147147
end)
148148

149149
local Template = {
@@ -412,7 +412,7 @@ function m.update(scp, ...)
412412
if m.nullSymbols[value] then
413413
value = m.NULL
414414
end
415-
if Template[fullKey] then
415+
if Template[fullKey] then
416416
m.setByScope(scp, fullKey, value)
417417
elseif Template['Lua.' .. fullKey] then
418418
m.setByScope(scp, 'Lua.' .. fullKey, value)

script/config/loader.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ function m.loadLocalConfig(uri, filename)
4545
scp:set('lastLocalType', nil)
4646
return nil
4747
end
48-
local buf = util.loadFile(path)
48+
local buf = util.loadFile(path)
4949
if not buf then
5050
errorMessage(lang.script('CONFIG_LOAD_FAILED', path))
5151
scp:set('lastLocalConfig', nil)

script/core/code-action.lua

Lines changed: 30 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,29 @@ local function checkDisableByLuaDocExits(uri, row, mode, code)
1212
local state = files.getState(uri)
1313
local lines = state.lines
1414
if state.ast.docs and lines then
15-
return guide.eachSourceBetween(state.ast.docs, guide.positionOf(row, 0), guide.positionOf(row + 1, 0), function (doc)
16-
if doc.type == 'doc.diagnostic'
17-
and doc.mode == mode then
18-
if doc.names then
19-
return {
20-
start = doc.finish,
21-
finish = doc.finish,
22-
newText = ', ' .. code,
23-
}
24-
else
25-
return {
26-
start = doc.finish,
27-
finish = doc.finish,
28-
newText = ': ' .. code,
29-
}
15+
return guide.eachSourceBetween(
16+
state.ast.docs,
17+
guide.positionOf(row, 0),
18+
guide.positionOf(row + 1, 0),
19+
function (doc)
20+
if doc.type == 'doc.diagnostic'
21+
and doc.mode == mode then
22+
if doc.names then
23+
return {
24+
start = doc.finish,
25+
finish = doc.finish,
26+
newText = ', ' .. code,
27+
}
28+
else
29+
return {
30+
start = doc.finish,
31+
finish = doc.finish,
32+
newText = ': ' .. code,
33+
}
34+
end
3035
end
3136
end
32-
end)
37+
)
3338
end
3439
return nil
3540
end
@@ -86,7 +91,7 @@ local function markGlobal(uri, name, results)
8691
kind = 'quickfix',
8792
command = {
8893
title = lang.script.COMMAND_MARK_GLOBAL,
89-
command = 'lua.setConfig',
94+
command = 'lua.setConfig',
9095
arguments = {
9196
{
9297
key = 'Lua.diagnostics.globals',
@@ -208,7 +213,7 @@ local function solveSyntaxByFix(uri, err, results)
208213
results[#results+1] = {
209214
title = lang.script('ACTION_' .. err.fix.title, err.fix),
210215
kind = 'quickfix',
211-
edit = {
216+
edit = {
212217
changes = {
213218
[uri] = changes,
214219
}
@@ -263,8 +268,8 @@ local function solveNewlineCall(uri, diag, results)
263268
changes = {
264269
[uri] = {
265270
{
266-
start = start,
267-
finish = start,
271+
start = start,
272+
finish = start,
268273
newText = ';',
269274
}
270275
}
@@ -335,8 +340,8 @@ local function solveAwaitInSync(uri, diag, results)
335340
changes = {
336341
[uri] = {
337342
{
338-
start = pos,
339-
finish = pos,
343+
start = pos,
344+
finish = pos,
340345
newText = '---@async\n',
341346
}
342347
}
@@ -541,11 +546,11 @@ end
541546
--end
542547

543548
local function checkJsonToLua(results, uri, start, finish)
544-
local text = files.getText(uri)
545-
local state = files.getState(uri)
549+
local text = files.getText(uri)
550+
local state = files.getState(uri)
546551
local startOffset = guide.positionToOffset(state, start)
547552
local finishOffset = guide.positionToOffset(state, finish)
548-
local jsonStart = text:match ('()[%{%[]', startOffset + 1)
553+
local jsonStart = text:match('()[%{%[]', startOffset + 1)
549554
if not jsonStart then
550555
return
551556
end

0 commit comments

Comments
 (0)