adding new stuff

This commit is contained in:
ViktorBarzin 2017-07-09 00:22:01 +03:00
parent f84d7183aa
commit 9ef8a96f9a
1580 changed files with 0 additions and 0 deletions

View file

@ -0,0 +1,81 @@
let g:PymodeLocList= {}
fun! pymode#tools#loclist#init() "{{{
return
endfunction "}}}
fun! g:PymodeLocList.init(raw_list) "{{{
let obj = copy(self)
let loc_list = filter(copy(a:raw_list), 'v:val["valid"] == 1')
call obj.clear()
let obj._title = 'CodeCheck'
return obj
endfunction "}}}
fun! g:PymodeLocList.current() "{{{
if !exists("b:pymode_loclist")
let b:pymode_loclist = g:PymodeLocList.init([])
endif
return b:pymode_loclist
endfunction "}}}
fun! g:PymodeLocList.is_empty() "{{{
return empty(self._loclist)
endfunction "}}}
fun! g:PymodeLocList.clear() "{{{
let self._loclist = []
let self._messages = {}
let self._name = expand('%:t')
endfunction "}}}
fun! g:PymodeLocList.extend(raw_list) "{{{
call extend(self._loclist, a:raw_list)
for issue in a:raw_list
let self._messages[issue.lnum] = issue.text
endfor
return self
endfunction "}}}
fun! g:PymodeLocList.filter(filters) "{{{
let loclist = []
for error in self._loclist
let passes_filters = 1
for key in keys(a:filters)
if get(error, key, '') !=? a:filters[key]
let passes_filters = 0
break
endif
endfor
if passes_filters
call add(loclist, error)
endif
endfor
return loclist
endfunction "}}}
fun! g:PymodeLocList.show() "{{{
call setloclist(0, self._loclist)
if self.is_empty()
lclose
elseif g:pymode_lint_cwindow
let num = winnr()
lopen
setl nowrap
execute max([min([line("$"), g:pymode_quickfix_maxheight]), g:pymode_quickfix_minheight]) . "wincmd _"
if num != winnr()
call setwinvar(winnr(), 'quickfix_title', self._title . ' <' . self._name . '>')
exe num . "wincmd w"
endif
end
endfunction "}}}

View file

@ -0,0 +1,57 @@
let g:PymodeSigns = {}
fun! pymode#tools#signs#init() "{{{
call g:PymodeSigns.setup()
endfunction "}}}
fun! g:PymodeSigns.enabled() "{{{
return (g:pymode_lint_signs && has('signs'))
endfunction "}}}
fun! g:PymodeSigns.setup() "{{{
if self.enabled()
execute 'sign define PymodeW text=' . g:pymode_lint_todo_symbol . " texthl=Todo"
execute 'sign define PymodeD text=' . g:pymode_lint_docs_symbol . " texthl=String"
execute 'sign define PymodeC text=' . g:pymode_lint_comment_symbol . " texthl=Comment"
execute 'sign define PymodeR text=' . g:pymode_lint_visual_symbol . " texthl=Visual"
execute 'sign define PymodeE text=' . g:pymode_lint_error_symbol . " texthl=Error"
execute 'sign define PymodeI text=' . g:pymode_lint_info_symbol . " texthl=Info"
execute 'sign define PymodeF text=' . g:pymode_lint_pyflakes_symbol . " texthl=Info"
endif
let self._sign_ids = []
let self._next_id = 10000
let self._messages = {}
endfunction "}}}
fun! g:PymodeSigns.refresh(loclist) "{{{
if self.enabled()
call self.clear()
call self.place(a:loclist)
endif
endfunction "}}}
fun! g:PymodeSigns.clear() "{{{
let ids = copy(self._sign_ids)
for i in ids
execute "sign unplace " . i
call remove(self._sign_ids, index(self._sign_ids, i))
endfor
endfunction "}}}
fun! g:PymodeSigns.place(loclist) "{{{
let seen = {}
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)
execute printf('sign place %d line=%d name=%s buffer=%d', self._next_id, issue.lnum, "Pymode".issue.type[0], issue.bufnr)
let self._next_id += 1
endif
endfor
endfunction "}}}