From 2dd1bdb05cb317613cd634208953d8450acf4d52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Thu, 16 Jun 2022 15:49:51 +0800 Subject: don't show `any` as field node --- script/core/hover/name.lua | 3 +++ test/hover/init.lua | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/script/core/hover/name.lua b/script/core/hover/name.lua index f8473638..59e639d6 100644 --- a/script/core/hover/name.lua +++ b/script/core/hover/name.lua @@ -20,6 +20,9 @@ local function asField(source, oop) local class if source.node.type ~= 'getglobal' then class = vm.getInfer(source.node):viewClass() + if class == 'any' then + class = nil + end end local node = class or buildName(source.node, false) diff --git a/test/hover/init.lua b/test/hover/init.lua index 46accbf7..48daf593 100644 --- a/test/hover/init.lua +++ b/test/hover/init.lua @@ -1929,3 +1929,13 @@ local [[ local x: ` x | y `|`123 ????` ]] + +TEST [[ +---@type any +local x + +print(x.) +]] +[[ +(field) x.y: unknown +]] -- cgit debian/1.2.3+git2.25.1-1-2-gaceb0