Permalink
Browse files

Add parentheses to functions in overview of known globals

  • Loading branch information...
1 parent 47123ba commit 7f4bbd9f6f08522ba83284c55ca756b94f222453 @xolox committed Jun 16, 2014
Showing with 9 additions and 5 deletions.
  1. +9 −5 misc/lua-ftplugin/globals.lua
@@ -24,12 +24,16 @@ local template = "{'filename': '%s', 'lnum': %i, 'text': '%s %s global %s', 'typ
for _, match in ipairs(matches) do
local read = match.inst == 'GETGLOBAL'
local operation = read and 'Read of' or 'Write to'
- local status, type = 'known', 'I'
- if not _G[match.varname] then
+ local status, severity = 'known', 'I'
+ local varname = match.varname
+ local value = _G[varname]
+ if value == nil then
status = 'unknown'
- type = read and 'E' or 'W'
+ severity = read and 'E' or 'W'
+ elseif type(value) == 'function' then
+ varname = varname .. '()'
end
- if type == 'E' or type == 'W' or verbose then
- print(template:format(arg[1], match.lnum, operation, status, match.varname, type))
+ if severity == 'E' or severity == 'W' or verbose then
+ print(template:format(arg[1], match.lnum, operation, status, varname, severity))
end
end

0 comments on commit 7f4bbd9

Please sign in to comment.