From c5aed1f2c6c854b932a95efc815147599643359e Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Thu, 6 Jul 2017 10:17:33 -0400 Subject: Do not attempt to provide autocompletions when there is no context. --- modules/lua/init.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'modules/lua') diff --git a/modules/lua/init.lua b/modules/lua/init.lua index 02f9f7a6..ae3c76f9 100644 --- a/modules/lua/init.lua +++ b/modules/lua/init.lua @@ -37,7 +37,7 @@ textadept.editing.autocompleters.lua = function() -- Retrieve the symbol behind the caret. local line, pos = buffer:get_cur_line() local symbol, op, part = line:sub(1, pos):match('([%w_%.]-)([%.:]?)([%w_]*)$') - if symbol == '' and part == '' and op ~= '' then return nil end -- lone . + if symbol == '' and part == '' then return nil end -- nothing to complete symbol, part = symbol:gsub('^_G%.?', ''), part ~= '_G' and part or '' -- Attempt to identify string type and file type symbols. local buffer = buffer @@ -68,6 +68,7 @@ textadept.editing.autocompleters.lua = function() end end end + if #list == 1 and list[1]:find(name_patt..'%?') then return nil end return #part, list end -- cgit v1.2.3