Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Time plug-in execution for all actions

  • Loading branch information...
commit 2a33bcb6876ef1bd0705ea8738ee0e5c735fff42 1 parent 5f3bdba
Peter Odding authored August 15, 2010
25  autoload.vim
... ...
@@ -1,6 +1,6 @@
1 1
 " Vim script.
2 2
 " Author: Peter Odding <peter@peterodding.com>
3  
-" Last Change: August 12, 2010
  3
+" Last Change: August 15, 2010
4 4
 " URL: http://peterodding.com/code/vim/lua-inspect/
5 5
 " License: MIT
6 6
 
@@ -30,15 +30,12 @@ function! luainspect#highlight_cmd(disable) " {{{1
30 30
     let b:luainspect_disabled = 1
31 31
   else
32 32
     unlet! b:luainspect_disabled
33  
-    let starttime = xolox#timer#start()
34 33
     call luainspect#make_request('highlight')
35  
-    let bufname = expand('%:p:~')
36  
-    let msg = "%s: Highlighted %s in %s."
37  
-    call xolox#timer#stop(msg, s:script, bufname, starttime)
38 34
   endif
39 35
 endfunction
40 36
 
41 37
 function! luainspect#make_request(action) " {{{1
  38
+  let starttime = xolox#timer#start()
42 39
   if a:action == 'tooltip'
43 40
     let lines = getbufline(v:beval_bufnr, 1, "$")
44 41
     call insert(lines, v:beval_col)
@@ -52,6 +49,7 @@ function! luainspect#make_request(action) " {{{1
52 49
   call s:parse_text(join(lines, "\n"), s:prepare_search_path())
53 50
   if !empty(b:luainspect_output)
54 51
     let response = b:luainspect_output[0]
  52
+    let bufname = fnamemodify(bufname(a:action != 'tooltip' ? '%' : v:beval_bufnr), ':p:~')
55 53
     if response == 'syntax_error' && len(b:luainspect_output) >= 4
56 54
       " Never perform syntax error highlighting in non-Lua buffers!
57 55
       let linenum = b:luainspect_output[1] + 0
@@ -62,8 +60,8 @@ function! luainspect#make_request(action) " {{{1
62 60
         let error_cmd = 'syntax match luaInspectSyntaxError /\%%>%il\%%<%il.*/ containedin=ALLBUT,lua*Comment*'
63 61
         execute printf(error_cmd, linenum - 1, (linenum2 ? linenum2 : line('$')) + 1)
64 62
       endif
  63
+      call xolox#timer#stop("%s: Found a syntax error in %s in %s.", s:script, bufname, starttime)
65 64
       " But always let the user know that a syntax error exists.
66  
-      let bufname = fnamemodify(bufname(a:action != 'tooltip' ? '%' : v:beval_bufnr), ':p:~')
67 65
       call xolox#warning("Syntax error around line %i in %s: %s", linenum, bufname, b:luainspect_syntax_error)
68 66
       return
69 67
     endif
@@ -72,6 +70,7 @@ function! luainspect#make_request(action) " {{{1
72 70
       call s:define_default_styles()
73 71
       call s:clear_previous_matches()
74 72
       call s:highlight_variables()
  73
+      call xolox#timer#stop("%s: Highlighted variables in %s in %s.", s:script, bufname, starttime)
75 74
     elseif response == 'goto'
76 75
       if len(b:luainspect_output) < 3
77 76
         call xolox#warning("No variable under cursor!")
@@ -79,17 +78,23 @@ function! luainspect#make_request(action) " {{{1
79 78
         let linenum = b:luainspect_output[1] + 0
80 79
         let colnum = b:luainspect_output[2] + 0
81 80
         call setpos('.', [0, linenum, colnum, 0])
82  
-        call xolox#message("") " Clear any previous message to avoid confusion.
  81
+        call xolox#timer#stop("%s: Jumped to definition in %s in %s.", s:script, bufname, starttime)
  82
+        if &verbose == 0
  83
+          " Clear previous "No variable under cursor!" message to avoid confusion.
  84
+          call xolox#message("")
  85
+        endif
83 86
       endif
84 87
     elseif response == 'tooltip'
85 88
       if len(b:luainspect_output) > 1
  89
+        call xolox#timer#stop("%s: Rendered tool tip for %s in %s.", s:script, bufname, starttime)
86 90
         return join(b:luainspect_output[1:-1], "\n")
87 91
       endif
88 92
     elseif response == 'rename'
89  
-      if len(b:luainspect_output) == 1
90  
-        call xolox#warning("No variable under cursor!")
91  
-      else
  93
+      if len(b:luainspect_output) > 1
  94
+        call xolox#timer#stop("%s: Prepared for rename in %s in %s.", s:script, bufname, starttime)
92 95
         call s:rename_variable()
  96
+      else
  97
+        call xolox#warning("No variable under cursor!")
93 98
       endif
94 99
     endif
95 100
   endif
4  luainspect.vim
... ...
@@ -1,8 +1,8 @@
1 1
 " Vim plug-in
2 2
 " Author: Peter Odding <peter@peterodding.com>
3  
-" Last Change: August 12, 2010
  3
+" Last Change: August 15, 2010
4 4
 " URL: http://peterodding.com/code/vim/lua-inspect/
5  
-" Version: 0.3.8
  5
+" Version: 0.3.9
6 6
 " License: MIT
7 7
 
8 8
 " Support for automatic update using the GLVS plug-in.

0 notes on commit 2a33bcb

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