Skip to content

Commit

Permalink
Merge branch 'master' of http://github.com/phuihock/pyflakes-vim into…
Browse files Browse the repository at this point in the history
… quickfix
  • Loading branch information
kevinw committed Jul 8, 2010
2 parents 1dffdbe + eaeb6d1 commit 80e1680
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions pyflakes.vim
Expand Up @@ -174,12 +174,21 @@ if !exists("*s:RunPyflakes")

let b:matched = []
let b:matchedlines = {}

let b:qf_list = []
python << EOF
for w in check(vim.current.buffer):
vim.command('let s:matchDict = {}')
vim.command("let s:matchDict['lineNum'] = " + str(w.lineno))
vim.command("let s:matchDict['message'] = '%s'" % vim_quote(w.message % w.message_args))
vim.command("let b:matchedlines[" + str(w.lineno) + "] = s:matchDict")

vim.command("let l:qf_item = {}")
vim.command("let l:qf_item.bufnr = bufnr('%')")
vim.command("let l:qf_item.filename = expand('%')")
vim.command("let l:qf_item.lnum = %s" % str(w.lineno))
vim.command("let l:qf_item.text = '%s'" % vim_quote(w.message % w.message_args))
vim.command("let l:qf_item.type = 'E'")

if w.col is None or isinstance(w, SyntaxError):
# without column information, just highlight the whole line
Expand All @@ -189,7 +198,13 @@ for w in check(vim.current.buffer):
# with a column number, highlight the first keyword there
vim.command(r"let s:mID = matchadd('PyFlakes', '^\%" + str(w.lineno) + r"l\_.\{-}\zs\k\+\k\@!\%>" + str(w.col) + r"c')")

vim.command("let l:qf_item.vcol = 1")
vim.command("let l:qf_item.col = %s" % str(w.col + 1))

vim.command("call add(b:matched, s:matchDict)")
vim.command("call add(b:qf_list, l:qf_item)")

vim.command("call setqflist(b:qf_list, 'r')")
EOF
let b:cleared = 0
endfunction
Expand Down

0 comments on commit 80e1680

Please sign in to comment.