Skip to content

Commit

Permalink
Bug fix: Strip newlines from warnings
Browse files Browse the repository at this point in the history
The communication between `luainspect.vim' and `luainspect4vim.lua' for
the `highlight' action assumes that warning messages never span multiple
lines, but LuaInspect sometimes does include newlines in warnings. This
broke the separation between warning messages and highlight positions
which meant `luainspect.vim' would print "Invalid output" messages.
  • Loading branch information
xolox committed Aug 16, 2010
1 parent f0eeca2 commit 59ba90c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions luainspect.vim
@@ -1,8 +1,8 @@
" Vim plug-in
" Author: Peter Odding <peter@peterodding.com>
" Last Change: August 15, 2010
" Last Change: August 16, 2010
" URL: http://peterodding.com/code/vim/lua-inspect/
" Version: 0.4
" Version: 0.4.1
" License: MIT

" Support for automatic update using the GLVS plug-in.
Expand Down
7 changes: 5 additions & 2 deletions luainspect4vim.lua
Expand Up @@ -3,7 +3,7 @@
This module is part of the luainspect.vim plug-in for the Vim text editor.
Author: Peter Odding <peter@peterodding.com>
Last Change: August 15, 2010
Last Change: August 16, 2010
URL: http://peterodding.com/code/vim/lua-inspect/
License: MIT
Expand Down Expand Up @@ -53,7 +53,10 @@ function actions.highlight(tokenlist, line, column, src) -- {{{1
-- FIXME Why does this report argument count warnings in luainspect/init.lua but not in example.lua?!
local warnings = LI.list_warnings(tokenlist, src)
myprint(#warnings)
for i, warning in ipairs(warnings) do myprint(warning) end
for i, warning in ipairs(warnings) do
warning = warning:gsub('%s+', ' ')
myprint(warning)
end
local curvar = getcurvar(tokenlist, line, column)
for i, token in ipairs(tokenlist) do
if curvar and curvar.ast.id == token.ast.id then
Expand Down

0 comments on commit 59ba90c

Please sign in to comment.