@@ -2256,6 +2256,37 @@ local function tryluaDocOfFunction(doc, results, pad)
2256
2256
}
2257
2257
end
2258
2258
2259
+ --- Checks for a lua symbol reference in comment and returns an async callback if found
2260
+ local function trySymbolReference (state , position , results )
2261
+ local doc = getLuaDoc (state , position )
2262
+ if not doc then
2263
+ return
2264
+ end
2265
+
2266
+ local line = doc .originalComment .text --- @type string
2267
+ local col = select (2 , guide .rowColOf (position )) - 2 --- @type integer
2268
+
2269
+ -- User will ask for completion at end of symbol name so we need to perform a reverse match to see if they are in a symbol reference
2270
+ -- Matching in reverse allows the symbol to be of any length and we can still match all the way back to `](lua://` from right to left
2271
+ local symbol = string.match (string.reverse (line ), " %)?(.*)//:aul%(%]" , # line - col )
2272
+
2273
+ if symbol then
2274
+ -- flip it back the right way around
2275
+ symbol = string.reverse (symbol )
2276
+
2277
+ --- @async
2278
+ return function ()
2279
+ for _ , match in ipairs (wssymbol (symbol )) do
2280
+ results [# results + 1 ] = {
2281
+ label = match .name ,
2282
+ kind = define .CompletionItemKind .Class ,
2283
+ insertText = match .name
2284
+ }
2285
+ end
2286
+ end
2287
+ end
2288
+ end
2289
+
2259
2290
--- @async
2260
2291
local function tryLuaDoc (state , position , results )
2261
2292
local doc = getLuaDoc (state , position )
@@ -2327,8 +2358,13 @@ end
2327
2358
--- @async
2328
2359
local function tryCompletions (state , position , triggerCharacter , results )
2329
2360
if getComment (state , position ) then
2361
+ local callback = trySymbolReference (state , position , results )
2362
+ if callback then
2363
+ callback ()
2364
+ else
2365
+ tryComment (state , position , results )
2366
+ end
2330
2367
tryLuaDoc (state , position , results )
2331
- tryComment (state , position , results )
2332
2368
return
2333
2369
end
2334
2370
if postfix (state , position , results ) then
0 commit comments