Skip to content

Commit 735210c

Browse files
committed
cleanup
1 parent 680e6c9 commit 735210c

File tree

4 files changed

+8
-14
lines changed

4 files changed

+8
-14
lines changed

script/config/template.lua

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -218,9 +218,7 @@ local template = {
218218
>> util.deepCopy(define.DiagnosticDefaultSeverity),
219219
['Lua.diagnostics.neededFileStatus'] = Type.Hash(Type.String, Type.String)
220220
>> util.deepCopy(define.DiagnosticDefaultNeededFileStatus),
221-
['Lua.diagnostics.disableScheme'] = Type.Hash(Type.String, Type.Boolean, ';') >> {
222-
['git'] = true,
223-
},
221+
['Lua.diagnostics.disableScheme'] = Type.Array(Type.String) >> { 'git' },
224222
['Lua.diagnostics.workspaceDelay'] = Type.Integer >> 5,
225223
['Lua.diagnostics.workspaceRate'] = Type.Integer >> 100,
226224
['Lua.diagnostics.libraryFiles'] = Type.String >> 'Opened' << {
@@ -238,14 +236,10 @@ local template = {
238236
['Lua.workspace.useGitIgnore'] = Type.Boolean >> true,
239237
['Lua.workspace.maxPreload'] = Type.Integer >> 3000,
240238
['Lua.workspace.preloadFileSize'] = Type.Integer >> 500,
241-
['Lua.workspace.library'] = Type.Hash(Type.String, Type.Boolean, ';'),
239+
['Lua.workspace.library'] = Type.Array(Type.String),
242240
['Lua.workspace.checkThirdParty'] = Type.Boolean >> true,
243241
['Lua.workspace.userThirdParty'] = Type.Array(Type.String),
244-
['Lua.workspace.supportScheme'] = Type.Hash(Type.String, Type.Boolean, ';') >> {
245-
['file'] = true,
246-
['untitled'] = true,
247-
['git'] = true,
248-
},
242+
['Lua.workspace.supportScheme'] = Type.Array(Type.String) >> { 'file', 'untitled', 'git' },
249243
['Lua.completion.enable'] = Type.Boolean >> true,
250244
['Lua.completion.callSnippet'] = Type.String >> 'Disable' << {
251245
'Disable',

script/provider/diagnostic.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ local function isValid(uri)
236236
end
237237
local scheme = furi.split(uri)
238238
local disableScheme = config.get(uri, 'Lua.diagnostics.disableScheme')
239-
if disableScheme[scheme] then
239+
if util.arrayHas(disableScheme, scheme) then
240240
return false
241241
end
242242
return true

script/provider/provider.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ m.register 'textDocument/didOpen' {
239239
local doc = params.textDocument
240240
local scheme = furi.split(doc.uri)
241241
local supports = config.get(doc.uri, 'Lua.workspace.supportScheme')
242-
if not supports[scheme] then
242+
if not util.arrayHas(supports, scheme) then
243243
return
244244
end
245245
local uri = files.getRealUri(doc.uri)
@@ -269,7 +269,7 @@ m.register 'textDocument/didChange' {
269269
local doc = params.textDocument
270270
local scheme = furi.split(doc.uri)
271271
local supports = config.get(doc.uri, 'Lua.workspace.supportScheme')
272-
if not supports[scheme] then
272+
if not util.arrayHas(supports, scheme) then
273273
return
274274
end
275275
local changes = params.contentChanges

script/workspace/workspace.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ function m.getNativeMatcher(scp)
141141
end
142142
end
143143
end
144-
for path in pairs(config.get(scp.uri, 'Lua.workspace.library')) do
144+
for _, path in ipairs(config.get(scp.uri, 'Lua.workspace.library')) do
145145
path = m.getAbsolutePath(scp.uri, path)
146146
if path then
147147
log.debug('Ignore by library:', path)
@@ -183,7 +183,7 @@ function m.getLibraryMatchers(scp)
183183
end
184184

185185
local librarys = {}
186-
for path in pairs(config.get(scp.uri, 'Lua.workspace.library')) do
186+
for _, path in ipairs(config.get(scp.uri, 'Lua.workspace.library')) do
187187
path = m.getAbsolutePath(scp.uri, path)
188188
if path then
189189
librarys[m.normalize(path)] = true

0 commit comments

Comments
 (0)