Skip to content

Commit 46f6f7a

Browse files
authored
Merge branch 'LuaLS:master' into luajit-ffi-support
2 parents 0bfd4cc + b422860 commit 46f6f7a

File tree

18 files changed

+266
-12
lines changed

18 files changed

+266
-12
lines changed

3rd/EmmyLuaCodeStyle

Submodule EmmyLuaCodeStyle updated 45 files

changelog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# changelog
22

3+
## 3.6.20
4+
* `NEW` support connecting by socket with `--socket=PORT`
5+
36
## 3.6.19
47
`2023-4-26`
58
* `FIX` commandline parameter `checklevel` may not work

locale/en-us/setting.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,8 @@ Read [formatter docs](https://github.com/CppCXY/EmmyLuaCodeStyle/tree/master/doc
269269
]]
270270
config.spell.dict =
271271
'Custom words for spell checking.'
272+
config.nameStyle.config =
273+
'Set name style config'
272274
config.telemetry.enable =
273275
[[
274276
Enable telemetry to send your editor information and error logs over the network. Read our privacy policy [here](https://github.com/LuaLS/lua-language-server/wiki/Home#privacy).
@@ -401,6 +403,8 @@ config.diagnostics['return-type-mismatch'] =
401403
'Enable diagnostics for return values whose type does not match the type declared in the corresponding return annotation.'
402404
config.diagnostics['spell-check'] =
403405
'Enable diagnostics for typos in strings.'
406+
config.diagnostics['name-style-check'] =
407+
'Enable diagnostics for name style.'
404408
config.diagnostics['unbalanced-assignments']=
405409
'Enable diagnostics on multiple assignments if not all variables obtain a value (e.g., `local x,y = 1`).'
406410
config.diagnostics['undefined-doc-class'] =

locale/pt-br/setting.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,8 @@ Read [formatter docs](https://github.com/CppCXY/EmmyLuaCodeStyle/tree/master/doc
269269
]]
270270
config.spell.dict = -- TODO: need translate!
271271
'Custom words for spell checking.'
272+
config.nameStyle.config = -- TODO: need translate!
273+
'Set name style config'
272274
config.telemetry.enable = -- TODO: need translate!
273275
[[
274276
Enable telemetry to send your editor information and error logs over the network. Read our privacy policy [here](https://github.com/LuaLS/lua-language-server/wiki/Home#privacy).
@@ -401,6 +403,8 @@ config.diagnostics['return-type-mismatch'] = -- TODO: need translate!
401403
'Enable diagnostics for return values whose type does not match the type declared in the corresponding return annotation.'
402404
config.diagnostics['spell-check'] = -- TODO: need translate!
403405
'Enable diagnostics for typos in strings.'
406+
config.diagnostics['name-style-check'] = -- TODO: need translate!
407+
'Enable diagnostics for name style.'
404408
config.diagnostics['unbalanced-assignments']= -- TODO: need translate!
405409
'Enable diagnostics on multiple assignments if not all variables obtain a value (e.g., `local x,y = 1`).'
406410
config.diagnostics['undefined-doc-class'] = -- TODO: need translate!

locale/zh-cn/setting.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,8 @@ config.format.defaultConfig =
268268
]]
269269
config.spell.dict =
270270
'拼写检查的自定义单词。'
271+
config.nameStyle.config =
272+
'设定命名风格检查的配置'
271273
config.telemetry.enable =
272274
[[
273275
启用遥测,通过网络发送你的编辑器信息与错误日志。在[此处](https://github.com/LuaLS/lua-language-server/wiki/Home#privacy)阅读我们的隐私声明。
@@ -400,6 +402,8 @@ config.diagnostics['return-type-mismatch'] = -- TODO: need translate!
400402
'Enable diagnostics for return values whose type does not match the type declared in the corresponding return annotation.'
401403
config.diagnostics['spell-check'] = -- TODO: need translate!
402404
'Enable diagnostics for typos in strings.'
405+
config.diagnostics['name-style-check'] = -- TODO: need translate!
406+
'Enable diagnostics for name style.'
403407
config.diagnostics['unbalanced-assignments']= -- TODO: need translate!
404408
'Enable diagnostics on multiple assignments if not all variables obtain a value (e.g., `local x,y = 1`).'
405409
config.diagnostics['undefined-doc-class'] = -- TODO: need translate!

locale/zh-tw/setting.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,8 @@ config.format.defaultConfig =
268268
]]
269269
config.spell.dict =
270270
'拼寫檢查的自訂單詞。'
271+
config.nameStyle.config = -- TODO: need translate!
272+
'Set name style config'
271273
config.telemetry.enable =
272274
[[
273275
啟用遙測,透過網路發送你的編輯器資訊與錯誤日誌。在[此處](https://github.com/LuaLS/lua-language-server/wiki/Home#privacy)閱讀我們的隱私聲明。
@@ -400,6 +402,8 @@ config.diagnostics['return-type-mismatch'] = -- TODO: need translate!
400402
'Enable diagnostics for return values whose type does not match the type declared in the corresponding return annotation.'
401403
config.diagnostics['spell-check'] = -- TODO: need translate!
402404
'Enable diagnostics for typos in strings.'
405+
config.diagnostics['name-style-check'] = -- TODO: need translate!
406+
'Enable diagnostics for name style.'
403407
config.diagnostics['unbalanced-assignments']= -- TODO: need translate!
404408
'Enable diagnostics on multiple assignments if not all variables obtain a value (e.g., `local x,y = 1`).'
405409
config.diagnostics['undefined-doc-class'] = -- TODO: need translate!

make/code_format.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ lm:source_set 'code_format' {
1919
"Util/src/StringUtil.cpp",
2020
"Util/src/Utf8.cpp",
2121
"Util/src/SymSpell/*.cpp",
22+
"Util/src/InfoTree/*.cpp",
2223
--CodeService
2324
"CodeService/src/**/*.cpp",
2425
},

script/brave/work.lua

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
local brave = require 'brave.brave'
22

3-
brave.on('loadProto', function ()
3+
brave.on('loadProtoByStdio', function ()
44
local jsonrpc = require 'jsonrpc'
55
while true do
66
local proto, err = jsonrpc.decode(io.read)
@@ -13,6 +13,37 @@ brave.on('loadProto', function ()
1313
end
1414
end)
1515

16+
brave.on('loadProtoBySocket', function (fdHandle)
17+
local jsonrpc = require 'jsonrpc'
18+
local socket = require 'bee.socket'
19+
local thread = require 'bee.thread'
20+
local fd = socket.fd(fdHandle)
21+
local buf = ''
22+
while true do
23+
local proto, err = jsonrpc.decode(function (len)
24+
while true do
25+
if #buf >= len then
26+
local res = buf:sub(1, len)
27+
buf = buf:sub(len + 1)
28+
return res
29+
end
30+
local data = fd:recv()
31+
if data then
32+
buf = buf .. data
33+
else
34+
thread.sleep(0.01)
35+
end
36+
end
37+
end)
38+
--log.debug('loaded proto', proto.method)
39+
if not proto then
40+
brave.push('protoerror', err)
41+
return
42+
end
43+
brave.push('proto', proto)
44+
end
45+
end)
46+
1647
brave.on('timer', function (time)
1748
local thread = require 'bee.thread'
1849
while true do

script/config/template.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,8 @@ local template = {
385385
auto_complete_table_sep = "true"
386386
},
387387
['Lua.spell.dict'] = Type.Array(Type.String),
388+
['Lua.nameStyle.config'] = Type.Hash(Type.String, Type.Or(Type.String, Type.Array(Type.Hash(Type.String, Type.String))))
389+
>> {},
388390
['Lua.misc.parameters'] = Type.Array(Type.String),
389391
['Lua.misc.executablePath'] = Type.String,
390392
['Lua.type.castNumberToInteger'] = Type.Boolean >> true,
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
local files = require 'files'
2+
local converter = require 'proto.converter'
3+
local log = require 'log'
4+
local nameStyle = require 'provider.name-style'
5+
6+
7+
---@async
8+
return function (uri, callback)
9+
local state = files.getState(uri)
10+
if not state then
11+
return
12+
end
13+
local text = state.originText
14+
15+
local status, diagnosticInfos = nameStyle.nameStyleCheck(uri, text)
16+
17+
if not status then
18+
if diagnosticInfos ~= nil then
19+
log.error(diagnosticInfos)
20+
end
21+
22+
return
23+
end
24+
25+
if diagnosticInfos then
26+
for _, diagnosticInfo in ipairs(diagnosticInfos) do
27+
callback {
28+
start = converter.unpackPosition(state, diagnosticInfo.range.start),
29+
finish = converter.unpackPosition(state, diagnosticInfo.range["end"]),
30+
message = diagnosticInfo.message,
31+
data = diagnosticInfo.data
32+
}
33+
end
34+
end
35+
end

0 commit comments

Comments
 (0)