Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Warn user + show tooltips for syntax errors

  • Loading branch information...
commit b0b58008127bcecae658922707370f0df915847c 1 parent dc640de
@xolox authored
Showing with 20 additions and 13 deletions.
  1. +5 −5 TODO.md
  2. +12 −6 luainspect.vim
  3. +3 −2 luainspect4vim.lua
View
10 TODO.md
@@ -1,7 +1,7 @@
# The to-do list
- * Right now the highlighting styles used by `luainspect.vim` are the same as those used by the SciTE plug-in and they don't work well on dark backgrounds. As soon as I get around to picking some alternate colors I'll include those in the plug-in.
-
- * Bindings for other features of LuaInspect such as omni completion for in scope variables (including display of library function signatures).
-
- * Document the g:lua_inspect_path option.
+ * Copy highlighting colors for dark backgrounds from luainspect/scite.lua.
+ * OMNI completion for in scope variables (including display of library function signatures).
+ * Fix improvised hack by using new `luainspect.signatures.value_signatures` table.
+ * Highlighting and tooltips for wrong parameter counts.
+ * Document g:lua_inspect_path option.
View
18 luainspect.vim
@@ -1,8 +1,8 @@
" Vim plug-in
" Author: Peter Odding <peter@peterodding.com>
-" Last Change: August 11, 2010
+" Last Change: August 12, 2010
" URL: http://peterodding.com/code/vim/lua-inspect/
-" Version: 0.3.3
+" Version: 0.3.4
" License: MIT
" Support for automatic update using the GLVS plug-in.
@@ -86,7 +86,11 @@ endfunction
function! LuaInspectToolTip() " {{{2
let text = s:run_lua_inspect('tooltip', 0, 1)
- return type(text) == type('') ? text : ''
+ if exists('b:luainspect_syntax_error')
+ return b:luainspect_syntax_error
+ else
+ return type(text) == type('') ? text : ''
+ endif
endfunction
function! s:run_lua_inspect(action, toggle, enabled) " {{{2
@@ -107,12 +111,14 @@ function! s:run_lua_inspect(action, toggle, enabled) " {{{2
let linenum = b:luainspect_output[1] + 0
let colnum = b:luainspect_output[2] + 0
let linenum2 = b:luainspect_output[3] + 0
- " TODO Can we do something useful with this?!
- " let message = b:luainspect_output[4]
+ let b:luainspect_syntax_error = b:luainspect_output[4]
let error_cmd = 'syntax match luaInspectSyntaxError /\%%>%il\%%<%il.*/ containedin=ALLBUT,lua*Comment*'
execute printf(error_cmd, linenum - 1, (linenum2 ? linenum2 : line('$')) + 1)
+ call xolox#warning("Syntax error around line %i: %s", linenum, b:luainspect_syntax_error)
return
- elseif response == 'highlight'
+ endif
+ unlet! b:luainspect_syntax_error
+ if response == 'highlight'
call s:define_default_styles()
call s:clear_previous_matches()
call s:highlight_variables()
View
5 luainspect4vim.lua
@@ -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 11, 2010
+ Last Change: August 12, 2010
URL: http://peterodding.com/code/vim/lua-inspect/
License: MIT
@@ -235,7 +235,8 @@ return function(src)
myprint(linenum)
myprint(colnum)
myprint(linenum2 or 0)
- myprint(err or '')
+ -- Remove prefixed line number from error message because it's redundant.
+ myprint((err:gsub('^%d+:%s+', '')))
return
end
-- Now parse the source code using metalua to build an abstract syntax tree.
Please sign in to comment.
Something went wrong with that request. Please try again.