diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-06-09 20:24:15 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-06-09 20:24:15 +0800 |
commit | 24b3c06cd70050fc98e3946cfd343395d4f11ddf (patch) | |
tree | 9d8a3516b2dedca021f374a24d21f0a665b3a5d4 | |
parent | 055e6c6691597b37506d7cb13a6893ce5899ac06 (diff) | |
download | lua-language-server-24b3c06cd70050fc98e3946cfd343395d4f11ddf.zip |
--showsource=true
-rw-r--r-- | .vscode/settings.json | 6 | ||||
-rw-r--r-- | 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 |