From 24b3c06cd70050fc98e3946cfd343395d4f11ddf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Wed, 9 Jun 2021 20:24:15 +0800 Subject: --showsource=true --- .vscode/settings.json | 6 ++++-- script/core/hover/init.lua | 8 ++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 248a92a6..31b3626c 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -12,7 +12,8 @@ "DBGPORT", "DBGWAIT", "tracy", - "LOCALE" + "LOCALE", + "SHOWSOURCE" ], "Lua.diagnostics.disable": [ "close-non-object", @@ -43,5 +44,6 @@ "?.lua", "script/?.lua", "script/?/init.lua" - ] + ], + "Lua.misc.parameters": "--showsource=true" } diff --git a/script/core/hover/init.lua b/script/core/hover/init.lua index 81285ef2..0c8644ed 100644 --- a/script/core/hover/init.lua +++ b/script/core/hover/init.lua @@ -155,6 +155,14 @@ local function getHoverByUri(uri, offset) return nil end local hover = getHover(source) + if SHOWSOURCE then + hover.description = ('%s\n---\n\n```lua\n%s\n```'):format( + hover.description or '', + util.dump(source, { + deep = 1, + }) + ) + end return hover end -- cgit v1.2.3