Skip to content

Modify loclist to separate errors from warnings #798

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion autoload/pymode/lint.vim
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ fun! pymode#lint#check() "{{{
call loclist.show()

call pymode#lint#show_errormessage()
call pymode#wide_message('Found errors and warnings: ' . len(loclist._loclist))
call pymode#wide_message('Found ' . loclist.num_errors() . ' error(s) and ' . loclist.num_warnings() . ' warning(s)')

endfunction " }}}

Expand Down
32 changes: 26 additions & 6 deletions autoload/pymode/tools/loclist.vim
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,37 @@ endfunction "}}}


fun! g:PymodeLocList.is_empty() "{{{
return empty(self._loclist)
return empty(self._errlist) && empty(self._warnlist)
endfunction "}}}

fun! g:PymodeLocList.loclist() "{{{
let loclist = copy(self._errlist)
call extend(loclist, self._warnlist)
return loclist
endfunction "}}}

fun! g:PymodeLocList.num_errors() "{{{
return len(self._errlist)
endfunction "}}}

fun! g:PymodeLocList.num_warnings() "{{{
return len(self._warnlist)
endfunction "}}}


fun! g:PymodeLocList.clear() "{{{
let self._loclist = []
let self._errlist = []
let self._warnlist = []
let self._messages = {}
let self._name = expand('%:t')
endfunction "}}}


fun! g:PymodeLocList.extend(raw_list) "{{{
call extend(self._loclist, a:raw_list)
let err_list = filter(copy(a:raw_list), 'v:val["type"] == "E"')
let warn_list = filter(copy(a:raw_list), 'v:val["type"] != "E"')
call extend(self._errlist, err_list)
call extend(self._warnlist, warn_list)
for issue in a:raw_list
let self._messages[issue.lnum] = issue.text
endfor
Expand All @@ -46,7 +64,7 @@ endfunction "}}}

fun! g:PymodeLocList.filter(filters) "{{{
let loclist = []
for error in self._loclist
for error in self.loclist()
let passes_filters = 1
for key in keys(a:filters)
if get(error, key, '') !=? a:filters[key]
Expand All @@ -65,8 +83,9 @@ endfunction "}}}


fun! g:PymodeLocList.show() "{{{
call setloclist(0, self._loclist)
if self.is_empty()
call setloclist(0, self.loclist())
"if self.is_empty()
if self.num_errors() == 0
lclose
elseif g:pymode_lint_cwindow
let num = winnr()
Expand All @@ -77,5 +96,6 @@ fun! g:PymodeLocList.show() "{{{
call setwinvar(winnr(), 'quickfix_title', self._title . ' <' . self._name . '>')
exe num . "wincmd w"
endif
lfirst
end
endfunction "}}}
2 changes: 1 addition & 1 deletion autoload/pymode/tools/signs.vim
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ endfunction "}}}

fun! g:PymodeSigns.place(loclist) "{{{
let seen = {}
for issue in a:loclist._loclist
for issue in a:loclist.loclist()
if !has_key(seen, issue.lnum)
let seen[issue.lnum] = 1
call add(self._sign_ids, self._next_id)
Expand Down
2 changes: 1 addition & 1 deletion pymode/rope.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def find_it():
text=env.lines[oc.lineno - 1] if oc.resource.real_path == env.curbuf.name else "", # noqa
lnum=oc.lineno,
))
env.let('loclist._loclist', lst)
env.run('g:PymodeLocList.current().extend', lst)


def update_python_path(paths):
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy