Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Improve syntax error messages for unnamed buffers

  • Loading branch information...
commit 3cbe412883edda9ce4cc87368d6b8f2ddbc29978 1 parent 07d1f44
@xolox authored
Showing with 15 additions and 7 deletions.
  1. +11 −3 autoload.vim
  2. +2 −2 luainspect.vim
  3. +2 −2 luainspect4vim.lua
View
14 autoload.vim
@@ -1,6 +1,6 @@
" Vim script.
" Author: Peter Odding <peter@peterodding.com>
-" Last Change: August 19, 2010
+" Last Change: August 21, 2010
" URL: http://peterodding.com/code/vim/lua-inspect/
" License: MIT
@@ -38,7 +38,11 @@ endfunction
function! luainspect#make_request(action) " {{{1
let starttime = xolox#timer#start()
- let bufname = fnamemodify(bufname(a:action != 'tooltip' ? '%' : v:beval_bufnr), ':p')
+ let bufnr = a:action != 'tooltip' ? bufnr('%') : v:beval_bufnr
+ let bufname = bufname(bufnr)
+ if bufname != ''
+ let bufname = fnamemodify(bufname, ':p')
+ endif
if a:action == 'tooltip'
let lines = getbufline(v:beval_bufnr, 1, "$")
call insert(lines, v:beval_col)
@@ -53,7 +57,11 @@ function! luainspect#make_request(action) " {{{1
call s:parse_text(join(lines, "\n"), s:prepare_search_path())
if !empty(b:luainspect_output)
let response = b:luainspect_output[0]
- let friendlyname = fnamemodify(bufname, ':~')
+ if bufname == ''
+ let friendlyname = 'buffer #' . bufnr
+ else
+ let friendlyname = fnamemodify(bufname, ':~')
+ endif
if response == 'syntax_error' && len(b:luainspect_output) >= 4
" Never perform syntax error highlighting in non-Lua buffers!
let linenum = b:luainspect_output[1] + 0
View
4 luainspect.vim
@@ -1,8 +1,8 @@
" Vim plug-in
" Author: Peter Odding <peter@peterodding.com>
-" Last Change: August 19, 2010
+" Last Change: August 21, 2010
" URL: http://peterodding.com/code/vim/lua-inspect/
-" Version: 0.4.5
+" Version: 0.4.6
" License: MIT
" Support for automatic update using the GLVS plug-in.
View
4 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 19, 2010
+ Last Change: August 21, 2010
URL: http://peterodding.com/code/vim/lua-inspect/
License: MIT
@@ -180,7 +180,7 @@ end
return function(src)
local action, file, line, column
- action, file, line, column, src = src:match '^(%S+)\n([^\n]+)\n(%d+)\n(%d+)\n(.*)$'
+ action, file, line, column, src = src:match '^(%S+)\n([^\n]*)\n(%d+)\n(%d+)\n(.*)$'
line = tonumber(line)
-- This adjustment was found by trial and error :-|
column = tonumber(column) - 1

0 comments on commit 3cbe412

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