summaryrefslogtreecommitdiff
path: root/server/src
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2018-12-24 11:40:10 +0800
committer最萌小汐 <sumneko@hotmail.com>2018-12-24 11:40:10 +0800
commit878e33a5d363b5471d26096691d4203d33d15b40 (patch)
treec77039010bdf0902a12ae7bacb4ab828cf68cfdf /server/src
parent0f55f1535df9bfc6314dad7d339f5ebeeced1f5d (diff)
downloadlua-language-server-878e33a5d363b5471d26096691d4203d33d15b40.zip
return的匿名函数在hover中不显示名字
Diffstat (limited to 'server/src')
-rw-r--r--server/src/matcher/hover.lua14
-rw-r--r--server/src/matcher/vm.lua8
-rw-r--r--server/src/method/textDocument/hover.lua2
3 files changed, 12 insertions, 12 deletions
diff --git a/server/src/matcher/hover.lua b/server/src/matcher/hover.lua
index 774cce92..7b157892 100644
--- a/server/src/matcher/hover.lua
+++ b/server/src/matcher/hover.lua
@@ -182,13 +182,13 @@ local function buildValueName(result, source)
elseif declarat.type == 'number' or declarat.type == 'boolean' then
key = tostring(declarat[1])
else
- key = '?'
+ key = ''
end
local parentName = declarat.parentName
if not parentName then
- return result.key or ''
+ return key or ''
end
if parentName == '?' then
@@ -282,14 +282,14 @@ end
local function getFunctionHover(name, result, source, lib, oo, select)
local args = ''
local returns
- local enum = ''
- local tip = ''
+ local enum
+ local tip
local argLabel
if lib then
args, argLabel = buildLibArgs(lib, oo, select)
returns = buildLibReturns(lib)
enum = buildEnum(lib)
- tip = lib.description or ''
+ tip = lib.description
else
args, argLabel = buildValueArgs(result, source, select)
returns = buildValueReturns(result)
@@ -362,10 +362,9 @@ local function getValueHover(name, valueType, result, source, lib)
local tip
if lib then
value = lib.code or (lib.value and ('%q'):format(lib.value))
- tip = lib.description or ''
+ tip = lib.description
else
value = result.value.value and ('%q'):format(result.value.value)
- tip = ''
end
local text
@@ -389,7 +388,6 @@ local function getStringHover(result, lsp)
end
local path = lsp.workspace:relativePathByUri(result.uri)
return {
- label = '',
description = ('[%s](%s)'):format(path:string(), result.uri),
}
end
diff --git a/server/src/matcher/vm.lua b/server/src/matcher/vm.lua
index 48a8a49c..de55c12e 100644
--- a/server/src/matcher/vm.lua
+++ b/server/src/matcher/vm.lua
@@ -114,6 +114,11 @@ function mt:addInfo(obj, type, source)
else
self.results.sources[source] = obj
end
+ if type == 'set' or type == 'return' then
+ if not obj.declarat then
+ obj.declarat = source
+ end
+ end
end
return obj
end
@@ -262,9 +267,6 @@ function mt:setValue(var, value, source)
if source and source.start then
self:addInfo(var, 'set', source)
self:addInfo(value, 'set', source)
- if not value.declarat then
- value.declarat = source
- end
end
return value
end
diff --git a/server/src/method/textDocument/hover.lua b/server/src/method/textDocument/hover.lua
index dfc9a043..ca894797 100644
--- a/server/src/method/textDocument/hover.lua
+++ b/server/src/method/textDocument/hover.lua
@@ -27,7 +27,7 @@ return function (lsp, params)
```lua
%s
```
-]]):format(hover.label, hover.description, hover.enum or '')
+]]):format(hover.label or '', hover.description or '', hover.enum or '')
local response = {
contents = {