Skip to content

Commit 5c4fbc7

Browse files
committed
fix #1125
1 parent fd43361 commit 5c4fbc7

File tree

3 files changed

+25
-4
lines changed

3 files changed

+25
-4
lines changed

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## 3.2.4
44
* `FIX` hover: can not union `table` with other basic types
5+
* `FIX` [#1125](https://github.com/sumneko/lua-language-server/issues/1125)
56

67
## 3.2.3
78
`2022-5-16`

script/core/hover/description.lua

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -229,14 +229,13 @@ local function getBindEnums(source, docGroup)
229229
end
230230

231231
local function tryDocFieldUpComment(source)
232-
if source.type ~= 'doc.field.name' then
232+
if source.type ~= 'doc.field' then
233233
return
234234
end
235-
local docField = source.parent
236-
if not docField.bindGroup then
235+
if not source.bindGroup then
237236
return
238237
end
239-
local comment = getBindComment(docField, docField.bindGroup, docField)
238+
local comment = getBindComment(source, source.bindGroup, source)
240239
return comment
241240
end
242241

test/crossfile/hover.lua

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1137,3 +1137,24 @@ TEST {
11371137
(async) (method) C:f(a: any)
11381138
```]]
11391139
}
1140+
1141+
TEST {
1142+
{
1143+
path = 'a.lua',
1144+
content = [[
1145+
---@class Apple
1146+
---The color of your awesome apple!
1147+
---@field color string
1148+
local Apple = {}
1149+
1150+
Apple.<?color?>
1151+
]]
1152+
},
1153+
hover = [[
1154+
```lua
1155+
(field) Apple.color: string
1156+
```
1157+
1158+
---
1159+
The color of your awesome apple!]]
1160+
}

0 commit comments

Comments
 (0)