Skip to content

Commit

Permalink
commit c02be2e
Browse files Browse the repository at this point in the history
c02be2e fix(extensions): isActive should not true during activate
76f407d refactor(plugin): disable semantic highlights by default
a56c2e8 fix(completion): use triggerCharacter for manual invoke
fb123ed Fix command with complete but no nargs (#3211)
  • Loading branch information
chemzqm committed Jul 15, 2021
1 parent acc2b95 commit a72b075
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
12 changes: 12 additions & 0 deletions autoload/coc.vim
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ endfunction

function! coc#start(...)
let opt = coc#util#get_complete_option()
let char = s:get_trigger_character()
if !empty(char)
let opt['triggerCharacter'] = char
endif
call CocActionAsync('startCompletion', extend(opt, get(a:, 1, {})))
return ''
endfunction
Expand Down Expand Up @@ -192,3 +196,11 @@ function! coc#do_notify(id, method, result)
call Fn(a:result)
endif
endfunction

function! s:get_trigger_character()
if col('.') <= 1
return ''
endif
let before_cursor = getline('.')[:col('.')-2]
return strcharpart(before_cursor, strchars(before_cursor)-1)
endfunction
4 changes: 2 additions & 2 deletions build/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion doc/coc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2784,7 +2784,7 @@ CocSem_* *CocSem*
Basic defaults are provided for the "standard" token kinds, but any kind
supported by the server can be highlighted by creating the highlight group.

Default (disable by setting `g:coc_default_semantic_highlight_groups = 0`):
Default (enabled by setting `g:coc_default_semantic_highlight_groups = 1`):
`hi default link CocSem_namespace Identifier`
`hi default link CocSem_type Type`
`hi default link CocSem_class Structure`
Expand Down
4 changes: 2 additions & 2 deletions plugin/coc.vim
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ function! s:Hi() abort
endif
call s:AddAnsiGroups()

if get(g:, 'coc_default_semantic_highlight_groups', 1) == 1
if get(g:, 'coc_default_semantic_highlight_groups', 0) == 1
hi default link CocSem_namespace Identifier
hi default link CocSem_type Type
hi default link CocSem_class Structure
Expand Down Expand Up @@ -481,7 +481,7 @@ command! -nargs=+ -complete=custom,s:ExtensionList CocUninstall :call CocAction
command! -nargs=* -complete=custom,s:CommandList -range CocCommand :call coc#rpc#notify('runCommand', [<f-args>])
command! -nargs=* -complete=custom,coc#list#options CocList :call coc#rpc#notify('openList', [<f-args>])
command! -nargs=? -complete=custom,coc#list#names CocListResume :call coc#rpc#notify('listResume', [<f-args>])
command! -nargs=0 -complete=custom,coc#list#names CocListCancel :call coc#rpc#notify('listCancel', [])
command! -nargs=? -complete=custom,coc#list#names CocListCancel :call coc#rpc#notify('listCancel', [])
command! -nargs=? -complete=custom,coc#list#names CocPrev :call coc#rpc#notify('listPrev', [<f-args>])
command! -nargs=? -complete=custom,coc#list#names CocNext :call coc#rpc#notify('listNext', [<f-args>])
command! -nargs=? -complete=custom,coc#list#names CocFirst :call coc#rpc#notify('listFirst', [<f-args>])
Expand Down

0 comments on commit a72b075

Please sign in to comment.