davidm / lua-inspect

Lua code analysis, with plugins for HTML and SciTE
http://lua-users.org/wiki/LuaInspect
Other
170 stars 15 forks source link

Incorrect highlighting of booleans #3

Closed mkottman closed 14 years ago

mkottman commented 14 years ago

I am not sure what causes this, but when I type a simple assignment containing a boolean value, part of it is highlighted as unknown global, see screenshot

After typing other lines, the incorrect highlighting disappears, even after erasing them and leaving only the first line, it works correctly for a while. After few more edits (erasing everything, typing something again), the following error comes up:

lua-inspect/luainspectlib/luainspect/ast.lua:204: attempt to perform arithmetic on local 'src_lpos' (a nil value)

davidm commented 14 years ago

I haven't reproduced that. Unfortunately, SciTE isn't displaying tracebacks on errors. Please change ast.lua:204 to this and reports steps/output:

local function range_transform(src_fpos, src_lpos) if src_lpos == nil then print(src_fpos, top_ast, tokenlist, src, bsrc, preserve, M.dump_tokenlist(tokenlist), debug.traceback()) end

mkottman commented 14 years ago

In order to enable traceback, set the ext.lua.debug.traceback in SciTE properties (see scite220/scite/src/LuaExtension.cxx:1229)

The highlighting happens randomly... It seems to be caused by LuaJIT - I linked SciTE with LuaJIT2.0 instead of using Lua source files distributed with SciTE, and after recompiling with my system shared Lua library (-llua5.1), the symptoms disappear. I guess this issue can be closed.

davidm commented 14 years ago

I'll keep this open since I have seen things like this but haven't determined exact steps that cause it. A major change to the event handlers has just been committed though, and this might have some effect on things.

davidm commented 14 years ago

A patch has been committed related to this error that could occur on updating an empty AST.

BTW, thanks for the tip on ext.lua.debug.traceback. It is kind-of odd though, installing print rather than debug.traceback as the error handler. I can set print to debug.traceback, although that breaks print.

mkottman commented 14 years ago

I have made a little patch that modifies the LuaExtension.cxx in SciTE, so that it shows stack tracebacks instead of using print on error - see http://gist.github.com/542683

davidm commented 14 years ago

probably best to report to the scite list.