aboutsummaryrefslogtreecommitdiffhomepage
path: root/modules/ansi_c
diff options
context:
space:
mode:
authorGravatar mitchell <70453897+667e-11@users.noreply.github.com>2015-08-19 20:45:52 -0400
committerGravatar mitchell <70453897+667e-11@users.noreply.github.com>2015-08-19 20:45:52 -0400
commit352543330d2c8bf8f6f9b3e68f902cce1a69dc66 (patch)
treee42ab7f7e5141dc596ea5df0123e7cf6f34445e9 /modules/ansi_c
parentda355472e0f8ad35b84a18e0ca9e43522b8a766b (diff)
Handle 'typeref' in ctags; modules/ansi_c/init.lua
Diffstat (limited to 'modules/ansi_c')
-rw-r--r--modules/ansi_c/init.lua14
1 files changed, 10 insertions, 4 deletions
diff --git a/modules/ansi_c/init.lua b/modules/ansi_c/init.lua
index 45df001f..afb48759 100644
--- a/modules/ansi_c/init.lua
+++ b/modules/ansi_c/init.lua
@@ -30,7 +30,6 @@ local xpms = setmetatable({
}, {__index = function() return 0 end})
textadept.editing.autocompleters.ansi_c = function()
- local list = {}
-- Retrieve the symbol behind the caret.
local line, pos = buffer:get_cur_line()
local symbol, op, part = line:sub(1, pos):match('([%w_]-)([%.%->]*)([%w_]*)$')
@@ -52,18 +51,25 @@ textadept.editing.autocompleters.ansi_c = function()
lfs.currentdir())..'/tags'
local name_patt = '^'..part
local sep = string.char(buffer.auto_c_type_separator)
+ ::rescan::
+ local list = {}
for i = 1, #tags_files do
if lfs.attributes(tags_files[i]) then
for tag_line in io.lines(tags_files[i]) do
local name = tag_line:match('^%S+')
- if name:find(name_patt) and not name:find('^!') and not list[name] then
+ if (name:find(name_patt) and not name:find('^!') and not list[name]) or
+ name == symbol then
local fields = tag_line:match(';"\t(.*)$')
if (fields:match('class:(%S+)') or fields:match('enum:(%S+)') or
- fields:match('struct:(%S+)') or fields:match('typedef:(%S+)') or
- '') == symbol then
+ fields:match('struct:(%S+)') or '') == symbol then
list[#list + 1] = ("%s%s%d"):format(name, sep,
xpms[fields:sub(1, 1)])
list[name] = true
+ elseif name == symbol and fields:match('typeref:') then
+ -- For typeref, change the lookup symbol to the referenced name and
+ -- rescan tags files.
+ symbol = fields:match('[^:]+$')
+ goto rescan
end
end
end