diff --git a/pyflakes.vim b/pyflakes.vim index 8aa508b..6d20732 100644 --- a/pyflakes.vim +++ b/pyflakes.vim @@ -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 @@ -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