Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Warn user + show tooltips for syntax errors

  • Loading branch information...
commit b0b58008127bcecae658922707370f0df915847c 1 parent dc640de
Peter Odding authored August 12, 2010
10  TODO.md
Source Rendered
... ...
@@ -1,7 +1,7 @@
1 1
 # The to-do list
2 2
 
3  
- * 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.
4  
-
5  
- * Bindings for other features of LuaInspect such as omni completion for in scope variables (including display of library function signatures).
6  
-
7  
- * Document the g:lua_inspect_path option.
  3
+ * Copy highlighting colors for dark backgrounds from luainspect/scite.lua.
  4
+ * OMNI completion for in scope variables (including display of library function signatures).
  5
+ * Fix improvised hack by using new `luainspect.signatures.value_signatures` table.
  6
+ * Highlighting and tooltips for wrong parameter counts.
  7
+ * Document g:lua_inspect_path option.
18  luainspect.vim
... ...
@@ -1,8 +1,8 @@
1 1
 " Vim plug-in
2 2
 " Author: Peter Odding <peter@peterodding.com>
3  
-" Last Change: August 11, 2010
  3
+" Last Change: August 12, 2010
4 4
 " URL: http://peterodding.com/code/vim/lua-inspect/
5  
-" Version: 0.3.3
  5
+" Version: 0.3.4
6 6
 " License: MIT
7 7
 
8 8
 " Support for automatic update using the GLVS plug-in.
@@ -86,7 +86,11 @@ endfunction
86 86
 
87 87
 function! LuaInspectToolTip() " {{{2
88 88
   let text = s:run_lua_inspect('tooltip', 0, 1)
89  
-  return type(text) == type('') ? text : ''
  89
+  if exists('b:luainspect_syntax_error')
  90
+    return b:luainspect_syntax_error
  91
+  else
  92
+    return type(text) == type('') ? text : ''
  93
+  endif
90 94
 endfunction
91 95
 
92 96
 function! s:run_lua_inspect(action, toggle, enabled) " {{{2
@@ -107,12 +111,14 @@ function! s:run_lua_inspect(action, toggle, enabled) " {{{2
107 111
         let linenum = b:luainspect_output[1] + 0
108 112
         let colnum = b:luainspect_output[2] + 0
109 113
         let linenum2 = b:luainspect_output[3] + 0
110  
-        " TODO Can we do something useful with this?!
111  
-        " let message = b:luainspect_output[4]
  114
+        let b:luainspect_syntax_error = b:luainspect_output[4]
112 115
         let error_cmd = 'syntax match luaInspectSyntaxError /\%%>%il\%%<%il.*/ containedin=ALLBUT,lua*Comment*'
113 116
         execute printf(error_cmd, linenum - 1, (linenum2 ? linenum2 : line('$')) + 1)
  117
+        call xolox#warning("Syntax error around line %i: %s", linenum, b:luainspect_syntax_error)
114 118
         return
115  
-      elseif response == 'highlight'
  119
+      endif
  120
+      unlet! b:luainspect_syntax_error
  121
+      if response == 'highlight'
116 122
         call s:define_default_styles()
117 123
         call s:clear_previous_matches()
118 124
         call s:highlight_variables()
5  luainspect4vim.lua
@@ -3,7 +3,7 @@
3 3
  This module is part of the luainspect.vim plug-in for the Vim text editor.
4 4
 
5 5
  Author: Peter Odding <peter@peterodding.com>
6  
- Last Change: August 11, 2010
  6
+ Last Change: August 12, 2010
7 7
  URL: http://peterodding.com/code/vim/lua-inspect/
8 8
  License: MIT
9 9
 
@@ -235,7 +235,8 @@ return function(src)
235 235
     myprint(linenum)
236 236
     myprint(colnum)
237 237
     myprint(linenum2 or 0)
238  
-    myprint(err or '')
  238
+    -- Remove prefixed line number from error message because it's redundant.
  239
+    myprint((err:gsub('^%d+:%s+', '')))
239 240
     return
240 241
   end
241 242
   -- Now parse the source code using metalua to build an abstract syntax tree.

0 notes on commit b0b5800

Please sign in to comment.
Something went wrong with that request. Please try again.