mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 11:28:22 +00:00
gendeclarations: Also save information about directory
This commit is contained in:
@@ -188,14 +188,15 @@ local footer = [[
|
|||||||
local non_static = header
|
local non_static = header
|
||||||
local static = header
|
local static = header
|
||||||
|
|
||||||
local filepattern = '^#%a* (%d+) "[^"]-/?([^"/]+)"'
|
local filepattern = '^#%a* (%d+) "([^"]-)/?([^"/]+)"'
|
||||||
local curfile
|
local curfile
|
||||||
|
|
||||||
init = 0
|
local init = 0
|
||||||
curfile = nil
|
local curfile = nil
|
||||||
neededfile = fname:match('[^/]+$')
|
local neededfile = fname:match('[^/]+$')
|
||||||
local declline = 0
|
local declline = 0
|
||||||
local declendpos = 0
|
local declendpos = 0
|
||||||
|
local curdir = nil
|
||||||
while init ~= nil do
|
while init ~= nil do
|
||||||
init = text:find('\n', init)
|
init = text:find('\n', init)
|
||||||
if init == nil then
|
if init == nil then
|
||||||
@@ -204,11 +205,17 @@ while init ~= nil do
|
|||||||
init = init + 1
|
init = init + 1
|
||||||
declline = declline + 1
|
declline = declline + 1
|
||||||
if text:sub(init, init) == '#' then
|
if text:sub(init, init) == '#' then
|
||||||
local line, file = text:match(filepattern, init)
|
local line, dir, file = text:match(filepattern, init)
|
||||||
if file ~= nil then
|
if file ~= nil then
|
||||||
curfile = file
|
curfile = file
|
||||||
end
|
end
|
||||||
declline = tonumber(line) - 1
|
declline = tonumber(line) - 1
|
||||||
|
local curdir_start = dir:find('src/nvim/')
|
||||||
|
if curdir_start ~= nil then
|
||||||
|
curdir = dir:sub(curdir_start + #('src/nvim/'))
|
||||||
|
else
|
||||||
|
curdir = dir
|
||||||
|
end
|
||||||
elseif init < declendpos then
|
elseif init < declendpos then
|
||||||
-- Skipping over declaration
|
-- Skipping over declaration
|
||||||
elseif curfile == neededfile then
|
elseif curfile == neededfile then
|
||||||
@@ -232,7 +239,8 @@ while init ~= nil do
|
|||||||
declaration = declaration:gsub(' ?(FUNC_ATTR_)', ' %1')
|
declaration = declaration:gsub(' ?(FUNC_ATTR_)', ' %1')
|
||||||
declaration = declaration:gsub(' $', '')
|
declaration = declaration:gsub(' $', '')
|
||||||
declaration = declaration .. ';'
|
declaration = declaration .. ';'
|
||||||
declaration = declaration .. ' // ' .. curfile .. ':' .. declline
|
declaration = declaration .. (' // %s/%s:%u'):format(
|
||||||
|
curdir, curfile, declline)
|
||||||
declaration = declaration .. '\n'
|
declaration = declaration .. '\n'
|
||||||
if text:sub(s, s + 5) == 'static' then
|
if text:sub(s, s + 5) == 'static' then
|
||||||
static = static .. declaration
|
static = static .. declaration
|
||||||
|
Reference in New Issue
Block a user