@@ -749,7 +749,7 @@ local function checkKeyWord(state, start, position, word, hasSpace, afterLocal,
749749 local text = state .lua
750750 local snipType = config .get (state .uri , ' Lua.completion.keywordSnippet' )
751751 local symbol = lookBackward .findSymbol (text , guide .positionToOffset (state , start ))
752- local isExp = symbol == ' (' or symbol == ' ,' or symbol == ' =' or symbol == ' ['
752+ local isExp = symbol == ' (' or symbol == ' ,' or symbol == ' =' or symbol == ' [' or symbol == ' { '
753753 local info = {
754754 hasSpace = hasSpace ,
755755 isExp = isExp ,
@@ -1485,11 +1485,13 @@ local function checkTableLiteralField(state, position, tbl, fields, results)
14851485 end
14861486 end
14871487 if left then
1488+ local hasResult = false
14881489 for _ , field in ipairs (fields ) do
14891490 local name = guide .getKeyName (field )
14901491 if name
14911492 and not mark [name ]
14921493 and matchKey (left , tostring (name )) then
1494+ hasResult = true
14931495 results [# results + 1 ] = {
14941496 label = guide .getKeyName (field ),
14951497 kind = define .CompletionItemKind .Property ,
@@ -1502,6 +1504,7 @@ local function checkTableLiteralField(state, position, tbl, fields, results)
15021504 }
15031505 end
15041506 end
1507+ return hasResult
15051508 end
15061509end
15071510
@@ -1553,7 +1556,7 @@ end
15531556local function tryTable (state , position , results )
15541557 local source = findNearestTableField (state , position )
15551558 if not source then
1556- return
1559+ return false
15571560 end
15581561 if source .type ~= ' table'
15591562 and (not source .parent or source .parent .type ~= ' table' ) then
@@ -1574,7 +1577,10 @@ local function tryTable(state, position, results)
15741577 fields [# fields + 1 ] = field
15751578 end
15761579 end
1577- checkTableLiteralField (state , position , tbl , fields , results )
1580+ if checkTableLiteralField (state , position , tbl , fields , results ) then
1581+ return true
1582+ end
1583+ return false
15781584end
15791585
15801586local function tryArray (state , position , results )
@@ -2152,9 +2158,11 @@ local function tryCompletions(state, position, triggerCharacter, results)
21522158 if postfix (state , position , results ) then
21532159 return
21542160 end
2161+ if tryTable (state , position , results ) then
2162+ return
2163+ end
21552164 trySpecial (state , position , results )
21562165 tryCallArg (state , position , results )
2157- tryTable (state , position , results )
21582166 tryArray (state , position , results )
21592167 tryWord (state , position , triggerCharacter , results )
21602168 tryIndex (state , position , results )
0 commit comments