diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-04-07 03:34:53 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-04-07 03:34:53 +0800 |
commit | afaf9114d2ea37b1567b6e09ab018ae594f88e08 (patch) | |
tree | 5f8926da709b91a86f9d857e36641f72aaface20 /script/core/diagnostics | |
parent | d45984a61c94447c7c55ff5efffa9209c0b98d7c (diff) | |
download | lua-language-server-afaf9114d2ea37b1567b6e09ab018ae594f88e08.zip |
update
Diffstat (limited to 'script/core/diagnostics')
-rw-r--r-- | script/core/diagnostics/duplicate-doc-field.lua | 8 | ||||
-rw-r--r-- | script/core/diagnostics/duplicate-index.lua | 4 | ||||
-rw-r--r-- | script/core/diagnostics/duplicate-set-field.lua | 3 | ||||
-rw-r--r-- | script/core/diagnostics/not-yieldable.lua | 4 | ||||
-rw-r--r-- | script/core/diagnostics/undefined-field.lua | 12 |
5 files changed, 12 insertions, 19 deletions
diff --git a/script/core/diagnostics/duplicate-doc-field.lua b/script/core/diagnostics/duplicate-doc-field.lua index 0ad2045e..03f4dee5 100644 --- a/script/core/diagnostics/duplicate-doc-field.lua +++ b/script/core/diagnostics/duplicate-doc-field.lua @@ -1,6 +1,10 @@ local files = require 'files' local lang = require 'language' +local function getFieldEventName(doc) + +end + return function (uri, callback) local state = files.getState(uri) if not state then @@ -18,8 +22,8 @@ return function (uri, callback) mark = {} elseif doc.type == 'doc.field' then if mark then - local name = doc.field[1] - local eventName = noder.getFieldEventName(doc) + local name = ('%q'):format(doc.field[1]) + local eventName = getFieldEventName(doc) if eventName then name = name .. '|' .. eventName end diff --git a/script/core/diagnostics/duplicate-index.lua b/script/core/diagnostics/duplicate-index.lua index bf46996e..5097ab3a 100644 --- a/script/core/diagnostics/duplicate-index.lua +++ b/script/core/diagnostics/duplicate-index.lua @@ -15,8 +15,8 @@ return function (uri, callback) if obj.type == 'tablefield' or obj.type == 'tableindex' or obj.type == 'tableexp' then - local name = noder.getID(obj) - if name and name:sub(-1) ~= '*' then + local name = guide.getKeyName(obj) + if name then if not mark[name] then mark[name] = {} end diff --git a/script/core/diagnostics/duplicate-set-field.lua b/script/core/diagnostics/duplicate-set-field.lua index 96abe37c..8052c420 100644 --- a/script/core/diagnostics/duplicate-set-field.lua +++ b/script/core/diagnostics/duplicate-set-field.lua @@ -1,7 +1,8 @@ local files = require 'files' local lang = require 'language' local define = require 'proto.define' -local guide = require "parser.guide" +local guide = require 'parser.guide' +local vm = require 'vm' return function (uri, callback) local ast = files.getState(uri) diff --git a/script/core/diagnostics/not-yieldable.lua b/script/core/diagnostics/not-yieldable.lua index 706c83e0..0588bbde 100644 --- a/script/core/diagnostics/not-yieldable.lua +++ b/script/core/diagnostics/not-yieldable.lua @@ -12,7 +12,7 @@ local function isYieldAble(defs, i) local arg = def.args and def.args[i] if arg then hasFuncDef = true - if infer.hasType(arg, 'any') + if infer.getInfer(arg):hasType 'any' or vm.isAsync(arg, true) or arg.type == '...' then return true @@ -23,7 +23,7 @@ local function isYieldAble(defs, i) local arg = def.args and def.args[i] if arg then hasFuncDef = true - if infer.hasType(arg.extends, 'any') + if infer.getInfer(arg.extends):hasType 'any' or vm.isAsync(arg.extends, true) then return true end diff --git a/script/core/diagnostics/undefined-field.lua b/script/core/diagnostics/undefined-field.lua index ea15dcda..03fedb7b 100644 --- a/script/core/diagnostics/undefined-field.lua +++ b/script/core/diagnostics/undefined-field.lua @@ -24,22 +24,11 @@ return function (uri, callback) return end - local cache = {} - ---@async local function checkUndefinedField(src) - local id = noder.getID(src) - if not id then - return - end - if cache[id] then - return - end - await.delay() if #vm.getDefs(src) > 0 then - cache[id] = true return end local node = src.node @@ -54,7 +43,6 @@ return function (uri, callback) end end if not ok then - cache[id] = true return end end |