@@ -1221,13 +1221,20 @@ end
1221
1221
1222
1222
--- @async
1223
1223
local function tryWord (state , position , triggerCharacter , results )
1224
+ if triggerCharacter == ' ('
1225
+ or triggerCharacter == ' #'
1226
+ or triggerCharacter == ' ,'
1227
+ or triggerCharacter == ' {' then
1228
+ return
1229
+ end
1224
1230
local text = state .lua
1225
1231
local offset = guide .positionToOffset (state , position )
1226
1232
local finish = lookBackward .skipSpace (text , offset )
1227
1233
local word , start = lookBackward .findWord (text , offset )
1228
1234
local startPos
1229
1235
if not word then
1230
- return nil
1236
+ word = ' '
1237
+ startPos = position
1231
1238
else
1232
1239
startPos = guide .offsetToPosition (state , start - 1 )
1233
1240
end
@@ -1241,17 +1248,17 @@ local function tryWord(state, position, triggerCharacter, results)
1241
1248
else
1242
1249
local parent , oop = findParent (state , startPos )
1243
1250
if parent then
1244
- if not hasSpace then
1245
- checkField (state , word , startPos , position , parent , oop , results )
1246
- end
1251
+ checkField (state , word , startPos , position , parent , oop , results )
1247
1252
elseif isFuncArg (state , position ) then
1248
1253
checkProvideLocal (state , word , startPos , results )
1249
1254
checkFunctionArgByDocParam (state , word , startPos , results )
1250
1255
else
1251
1256
local afterLocal = isAfterLocal (state , startPos )
1252
- local stop = checkKeyWord (state , startPos , position , word , hasSpace , afterLocal , results )
1253
- if stop then
1254
- return
1257
+ if triggerCharacter ~= nil then
1258
+ local stop = checkKeyWord (state , startPos , position , word , hasSpace , afterLocal , results )
1259
+ if stop then
1260
+ return
1261
+ end
1255
1262
end
1256
1263
if not hasSpace then
1257
1264
if afterLocal then
@@ -1265,7 +1272,7 @@ local function tryWord(state, position, triggerCharacter, results)
1265
1272
end
1266
1273
end
1267
1274
end
1268
- if not hasSpace then
1275
+ if not hasSpace and ( # results == 0 or word ~= ' ' ) then
1269
1276
checkCommon (state , word , position , results )
1270
1277
end
1271
1278
end
@@ -1282,15 +1289,15 @@ local function trySymbol(state, position, results)
1282
1289
return nil
1283
1290
end
1284
1291
local startPos = guide .offsetToPosition (state , start )
1285
- if symbol == ' .'
1286
- or symbol == ' :' then
1287
- local parent , oop = findParent (state , startPos )
1288
- if parent then
1289
- tracy .ZoneBeginN ' completion.trySymbol'
1290
- checkField (state , ' ' , startPos , position , parent , oop , results )
1291
- tracy .ZoneEnd ()
1292
- end
1293
- end
1292
+ -- if symbol == '.'
1293
+ -- or symbol == ':' then
1294
+ -- local parent, oop = findParent(state, startPos)
1295
+ -- if parent then
1296
+ -- tracy.ZoneBeginN 'completion.trySymbol'
1297
+ -- checkField(state, '', startPos, position, parent, oop, results)
1298
+ -- tracy.ZoneEnd()
1299
+ -- end
1300
+ -- end
1294
1301
if symbol == ' (' then
1295
1302
checkFunctionArgByDocParam (state , ' ' , startPos , results )
1296
1303
end
0 commit comments