aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2017-07-06 10:17:33 -0400
committermitchell <70453897+667e-11@users.noreply.github.com>2017-07-06 10:17:33 -0400
commitc5aed1f2c6c854b932a95efc815147599643359e (patch)
tree3edbb445b3d5e3271ad895c253c45f383223992f /modules
parente7b1218bc916df076f848723f0bd5ba4bc68fca7 (diff)
downloadtextadept-c5aed1f2c6c854b932a95efc815147599643359e.tar.gz
textadept-c5aed1f2c6c854b932a95efc815147599643359e.zip
Do not attempt to provide autocompletions when there is no context.
Diffstat (limited to 'modules')
-rw-r--r--modules/ansi_c/init.lua2
-rw-r--r--modules/lua/init.lua3
2 files changed, 3 insertions, 2 deletions
diff --git a/modules/ansi_c/init.lua b/modules/ansi_c/init.lua
index 6ba97199..fff90d0f 100644
--- a/modules/ansi_c/init.lua
+++ b/modules/ansi_c/init.lua
@@ -31,7 +31,7 @@ textadept.editing.autocompleters.ansi_c = 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
if op ~= '' and op ~= '.' and op ~= '->' then return nil end
-- Attempt to identify the symbol type.
if symbol ~= '' then
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