File tree Expand file tree Collapse file tree 4 files changed +46
-9
lines changed Expand file tree Collapse file tree 4 files changed +46
-9
lines changed Original file line number Diff line number Diff line change @@ -268,15 +268,16 @@ local function getBindEnums(source, docGroup)
268
268
return table.concat (chunks , ' \n\n ' )
269
269
end
270
270
271
- local function tryDocFieldUpComment (source )
271
+ local function tryDocFieldComment (source )
272
272
if source .type ~= ' doc.field' then
273
273
return
274
274
end
275
- if not source .bindGroup then
276
- return
275
+ if source .comment then
276
+ return normalizeComment (source .comment .text , guide .getUri (source ))
277
+ end
278
+ if source .bindGroup then
279
+ return getBindComment (source )
277
280
end
278
- local comment = getBindComment (source )
279
- return comment
280
281
end
281
282
282
283
local function getFunctionComment (source )
@@ -394,7 +395,7 @@ return function (source)
394
395
source = source .parent
395
396
end
396
397
return tryDocOverloadToComment (source )
397
- or tryDocFieldUpComment (source )
398
+ or tryDocFieldComment (source )
398
399
or tyrDocParamComment (source )
399
400
or tryDocComment (source )
400
401
or tryDocClassComment (source )
Original file line number Diff line number Diff line change @@ -178,9 +178,15 @@ return function (source)
178
178
return nil
179
179
end
180
180
181
- for view in vm .getInfer (source ):eachView (uri ) do
182
- if view == ' string'
183
- or (view ~= ' unknown' and view ~= ' any' and vm .isSubType (uri , view , ' string' )) then
181
+ local node = vm .compileNode (source )
182
+ for n in node :eachObject () do
183
+ if n .type == ' global' and n .cate == ' type' then
184
+ if n .name == ' string'
185
+ or (n .name ~= ' unknown' and n .name ~= ' any' and vm .isSubType (uri , n .name , ' string' )) then
186
+ return nil
187
+ end
188
+ elseif n .type == ' doc.type.string'
189
+ or n .type == ' string' then
184
190
return nil
185
191
end
186
192
end
Original file line number Diff line number Diff line change @@ -1360,3 +1360,25 @@ local n: unknown
1360
1360
---
1361
1361
[here](command:xxxxx)]]
1362
1362
}
1363
+
1364
+ TEST {
1365
+ {
1366
+ path = ' a.lua' ,
1367
+ content = [[
1368
+ ---@class A
1369
+ ---@field x number # comments
1370
+
1371
+ ---@type A
1372
+ local t
1373
+
1374
+ print(t.<?x?>)
1375
+ ]]
1376
+ },
1377
+ hover = [[
1378
+ ```lua
1379
+ (field) A.x: number
1380
+ ```
1381
+
1382
+ ---
1383
+ comments]]
1384
+ }
Original file line number Diff line number Diff line change @@ -2112,3 +2112,11 @@ print(<?bool?>)
2112
2112
[[
2113
2113
local bool: boolean = true|false
2114
2114
]]
2115
+
2116
+ TEST [[
2117
+ ---@type 'a'
2118
+ local <?s?>
2119
+ ]]
2120
+ [[
2121
+ local s: 'a'
2122
+ ]]
You can’t perform that action at this time.
0 commit comments