@@ -1163,13 +1163,18 @@ local function tryIndex(ast, text, offset, results)
1163
1163
checkField (ast , word , offset , offset , parent , oop , results )
1164
1164
end
1165
1165
1166
- local function tryWord (ast , text , offset , results )
1166
+ local function tryWord (ast , text , offset , triggerCharacter , results )
1167
1167
local finish = lookBackward .skipSpace (text , offset )
1168
- local word , start = lookBackward .findWord (text , finish )
1168
+ local word , start = lookBackward .findWord (text , offset )
1169
1169
if not word then
1170
- return nil
1170
+ if triggerCharacter == nil then
1171
+ word = ' '
1172
+ start = offset
1173
+ else
1174
+ return nil
1175
+ end
1171
1176
end
1172
- local hasSpace = finish ~= offset
1177
+ local hasSpace = triggerCharacter ~= nil and finish ~= offset
1173
1178
if isInString (ast , offset ) then
1174
1179
if not hasSpace then
1175
1180
if # results == 0 then
@@ -1918,7 +1923,7 @@ local function clearCache()
1918
1923
cache .results = nil
1919
1924
end
1920
1925
1921
- local function completion (uri , offset )
1926
+ local function completion (uri , offset , triggerCharacter )
1922
1927
tracy .ZoneBeginN ' completion cache'
1923
1928
local results = getCache (uri , offset )
1924
1929
tracy .ZoneEnd ()
@@ -1940,7 +1945,7 @@ local function completion(uri, offset)
1940
1945
trySpecial (ast , text , offset , results )
1941
1946
tryCallArg (ast , text , offset , results )
1942
1947
tryTable (ast , text , offset , results )
1943
- tryWord (ast , text , offset , results )
1948
+ tryWord (ast , text , offset , triggerCharacter , results )
1944
1949
tryIndex (ast , text , offset , results )
1945
1950
trySymbol (ast , text , offset , results )
1946
1951
end
0 commit comments