1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-05-28 20:24:12 +00:00

Tweak to Colon syntax lua autocompletition.

Changes autocompletition to only complete function names (Or table names treated as functions via __call metamethod) after the colon symbol.
This commit is contained in:
Wojbie 2017-07-07 02:30:57 +02:00
parent 224e752a8f
commit 87406bc00d

View File

@ -409,12 +409,23 @@ function complete( sSearchText, tSearchTable )
if string.find( k, sPart, 1, true ) == 1 then if string.find( k, sPart, 1, true ) == 1 then
if not g_tLuaKeywords[k] and string.match( k, "^[%a_][%a%d_]*$" ) then if not g_tLuaKeywords[k] and string.match( k, "^[%a_][%a%d_]*$" ) then
local sResult = string.sub( k, nPartLength + 1 ) local sResult = string.sub( k, nPartLength + 1 )
if type(v) == "function" then if nColon then
sResult = sResult .. "(" if type(v) == "function" then
elseif type(v) == "table" and next(v) ~= nil then table.insert( tResults, sResult .. "(" )
sResult = sResult .. "." elseif type(v) == "table" then
local tMetatable = getmetatable( v )
if tMetatable and ( type( tMetatable.__call ) == "function" or type( tMetatable.__call ) == "table" ) then
table.insert( tResults, sResult .. "(" )
end
end
else
if type(v) == "function" then
sResult = sResult .. "("
elseif type(v) == "table" and next(v) ~= nil then
sResult = sResult .. "."
end
table.insert( tResults, sResult )
end end
table.insert( tResults, sResult )
end end
end end
end end