summaryrefslogtreecommitdiff
path: root/script/vm
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2023-08-01 18:03:57 +0800
committer最萌小汐 <sumneko@hotmail.com>2023-08-01 18:04:01 +0800
commit5fb08df5d27425ce1c0858d34c2ec62ddd567b38 (patch)
tree6e3cf72072a5cdb559e3655b25a17b1880bc644b /script/vm
parent93dab3c51a0d5f006d152595b6baa8242cd8f5b2 (diff)
downloadlua-language-server-5fb08df5d27425ce1c0858d34c2ec62ddd567b38.zip
don't show constructor in hover
Diffstat (limited to 'script/vm')
-rw-r--r--script/vm/compiler.lua7
-rw-r--r--script/vm/infer.lua8
2 files changed, 12 insertions, 3 deletions
diff --git a/script/vm/compiler.lua b/script/vm/compiler.lua
index cd114bd1..a6b95b7c 100644
--- a/script/vm/compiler.lua
+++ b/script/vm/compiler.lua
@@ -11,6 +11,7 @@ local vm = require 'vm.vm'
---@field _node vm.node
---@field cindex integer
---@field func parser.object
+---@field hideView boolean
-- 该函数有副作用,会给source绑定node!
---@param source parser.object
@@ -28,6 +29,12 @@ function vm.bindDocs(source)
end
if doc.type == 'doc.class' then
vm.setNode(source, vm.compileNode(doc))
+ for j = i + 1, #docs do
+ local overload = docs[j]
+ if overload.type == 'doc.overload' then
+ overload.overload.hideView = true
+ end
+ end
return true
end
if doc.type == 'doc.param' then
diff --git a/script/vm/infer.lua b/script/vm/infer.lua
index 3bc0b3f7..f2673ed3 100644
--- a/script/vm/infer.lua
+++ b/script/vm/infer.lua
@@ -386,9 +386,11 @@ function mt:_computeViews(uri)
self.views = {}
for n in self.node:eachObject() do
- local view = viewNodeSwitch(n.type, n, self, uri)
- if view then
- self.views[view] = true
+ if not n.hideView then
+ local view = viewNodeSwitch(n.type, n, self, uri)
+ if view then
+ self.views[view] = true
+ end
end
end