Skip to content
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

syntax: add goCoverage specific highlights #962

Merged
merged 1 commit into from
Jul 26, 2016
Merged
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
11 changes: 4 additions & 7 deletions autoload/go/coverage.vim
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,9 @@ endfunction
" Generates matches to be added to matchaddpos for the given coverage profile
" block
function! go#coverage#genmatch(cov)
let color = 'covered'
let color = 'goCoverageCovered'
if a:cov.cnt == 0
let color = 'uncover'
let color = 'goCoverageUncover'
endif

let matches = []
Expand Down Expand Up @@ -195,12 +195,12 @@ function! go#coverage#overlay(file)
" contains matches for matchaddpos()
let matches = []

" first mark all lines as normaltext. We use a custom group to not
" first mark all lines as goCoverageNormalText. We use a custom group to not
" interfere with other buffers highlightings. Because the priority is
" lower than the cover and uncover matches, it'll be overriden.
let cnt = 1
while cnt <= line('$')
call add(matches, {'group': 'normaltext', 'pos': [cnt], 'priority': 1})
call add(matches, {'group': 'goCoverageNormalText', 'pos': [cnt], 'priority': 1})
let cnt += 1
endwhile

Expand Down Expand Up @@ -234,9 +234,6 @@ function! go#coverage#overlay(file)
endfor

syntax manual
highlight normaltext term=bold ctermfg=darkgrey guifg=#75715E
highlight covered term=bold ctermfg=green guifg=#A6E22E
highlight uncover term=bold ctermfg=red guifg=#F92672

" clear the matches if we leave the buffer
autocmd BufWinLeave <buffer> call go#coverage#Clear()
Expand Down
6 changes: 6 additions & 0 deletions syntax/go.vim
Original file line number Diff line number Diff line change
Expand Up @@ -366,8 +366,14 @@ if g:go_highlight_build_constraints != 0
hi def link goPackageComment Comment
endif

" :GoSameIds
hi def goSameId term=bold cterm=bold ctermbg=white ctermfg=black

" :GoCoverage commands
hi def link goCoverageNormalText Comment
hi def goCoverageCovered ctermfg=green
hi def goCoverageUncover ctermfg=red

" Search backwards for a global declaration to start processing the syntax.
"syn sync match goSync grouphere NONE /^\(const\|var\|type\|func\)\>/

Expand Down