diff options
Diffstat (limited to 'script')
-rw-r--r-- | script/config/template.lua | 1 | ||||
-rw-r--r-- | script/core/completion/completion.lua | 2 | ||||
-rw-r--r-- | script/core/diagnostics/unused-local.lua | 7 |
3 files changed, 8 insertions, 2 deletions
diff --git a/script/config/template.lua b/script/config/template.lua index 4e2f45ae..fa0c2772 100644 --- a/script/config/template.lua +++ b/script/config/template.lua @@ -300,6 +300,7 @@ local template = { 'Opened', 'Disable', }, + ['Lua.diagnostics.unusedLocalExclude'] = Type.Array(Type.String), ['Lua.workspace.ignoreDir'] = Type.Array(Type.String) >> { '.vscode', }, diff --git a/script/core/completion/completion.lua b/script/core/completion/completion.lua index c577874f..c882f283 100644 --- a/script/core/completion/completion.lua +++ b/script/core/completion/completion.lua @@ -2075,8 +2075,6 @@ local function completion(uri, position, triggerCharacter) return nil end clearStack() - vm.lockCache() - local _ <close> = vm.unlockCache local results = {} tracy.ZoneBeginN 'completion #2' tryCompletions(state, position, triggerCharacter, results) diff --git a/script/core/diagnostics/unused-local.lua b/script/core/diagnostics/unused-local.lua index 8bff7dcb..8f2ee217 100644 --- a/script/core/diagnostics/unused-local.lua +++ b/script/core/diagnostics/unused-local.lua @@ -3,6 +3,8 @@ local guide = require 'parser.guide' local define = require 'proto.define' local lang = require 'language' local vm = require 'vm.vm' +local config = require 'config.config' +local glob = require 'glob' local function hasGet(loc) if not loc.ref then @@ -88,12 +90,17 @@ return function (uri, callback) if not ast then return end + local ignorePatterns = config.get(uri, 'Lua.diagnostics.unusedLocalExclude') + local ignore = glob.glob(ignorePatterns) guide.eachSourceType(ast.ast, 'local', function (source) local name = source[1] if name == '_' or name == ast.ENVMode then return end + if ignore(name) then + return + end if isToBeClosed(source) then return end |