Merge pull request #238 from JacekLach/do-not-cache-omnifunc
Do not cache omnifunc
This commit is contained in:
commit
685c49ceb5
12
README.md
12
README.md
@ -877,6 +877,18 @@ Default: `[see next line]`
|
|||||||
\ 'erlang' : [':'],
|
\ 'erlang' : [':'],
|
||||||
\ }
|
\ }
|
||||||
|
|
||||||
|
### The `g:ycm_cache_omnifunc` option
|
||||||
|
|
||||||
|
Some omnicompletion engines do not work well with the YCM cache - in
|
||||||
|
particular, they might not produce all possible results for a given prefix. By
|
||||||
|
unsetting this option you can ensure that the omnicompletion engine is
|
||||||
|
requeried on every keypress. That will ensure all completions will be
|
||||||
|
presented, but might cause stuttering and lagginess if the omnifunc is slow.
|
||||||
|
|
||||||
|
Default: `1`
|
||||||
|
|
||||||
|
let g:ycm_cache_omnifunc = 1
|
||||||
|
|
||||||
FAQ
|
FAQ
|
||||||
---
|
---
|
||||||
|
|
||||||
|
@ -133,6 +133,8 @@ let g:ycm_semantic_triggers =
|
|||||||
\ 'erlang' : [':'],
|
\ 'erlang' : [':'],
|
||||||
\ } )
|
\ } )
|
||||||
|
|
||||||
|
let g:ycm_cache_omnifunc = 1
|
||||||
|
|
||||||
" On-demand loading. Let's use the autoload folder and not slow down vim's
|
" On-demand loading. Let's use the autoload folder and not slow down vim's
|
||||||
" startup procedure.
|
" startup procedure.
|
||||||
augroup youcompletemeStart
|
augroup youcompletemeStart
|
||||||
|
@ -36,12 +36,28 @@ class OmniCompleter( Completer ):
|
|||||||
return []
|
return []
|
||||||
|
|
||||||
|
|
||||||
|
def ShouldUseCache( self ):
|
||||||
|
return vimsupport.GetBoolValue( "g:ycm_cache_omnifunc" )
|
||||||
|
|
||||||
|
|
||||||
|
def ShouldUseNow( self, start_column ):
|
||||||
|
if self.ShouldUseCache():
|
||||||
|
return super( OmniCompleter, self ).ShouldUseNow( start_column )
|
||||||
|
return self.ShouldUseNowInner( start_column )
|
||||||
|
|
||||||
def ShouldUseNowInner( self, start_column ):
|
def ShouldUseNowInner( self, start_column ):
|
||||||
if not self.omnifunc:
|
if not self.omnifunc:
|
||||||
return False
|
return False
|
||||||
return super( OmniCompleter, self ).ShouldUseNowInner( start_column )
|
return super( OmniCompleter, self ).ShouldUseNowInner( start_column )
|
||||||
|
|
||||||
|
|
||||||
|
def CandidatesForQueryAsync( self, query, unused_start_column ):
|
||||||
|
if self.ShouldUseCache():
|
||||||
|
return super( OmniCompleter, self ).CandidatesForQueryAsync(
|
||||||
|
query, unused_start_column )
|
||||||
|
else:
|
||||||
|
return self.CandidatesForQueryAsyncInner( query, unused_start_column )
|
||||||
|
|
||||||
def CandidatesForQueryAsyncInner( self, query, unused_start_column ):
|
def CandidatesForQueryAsyncInner( self, query, unused_start_column ):
|
||||||
if not self.omnifunc:
|
if not self.omnifunc:
|
||||||
self.stored_candidates = None
|
self.stored_candidates = None
|
||||||
@ -81,6 +97,12 @@ class OmniCompleter( Completer ):
|
|||||||
self.omnifunc = vim.eval( '&omnifunc' )
|
self.omnifunc = vim.eval( '&omnifunc' )
|
||||||
|
|
||||||
|
|
||||||
|
def CandidatesFromStoredRequest( self ):
|
||||||
|
if self.ShouldUseCache():
|
||||||
|
return super( OmniCompleter, self ).CandidatesFromStoredRequest()
|
||||||
|
else:
|
||||||
|
return self.CandidatesFromStoredRequestInner()
|
||||||
|
|
||||||
def CandidatesFromStoredRequestInner( self ):
|
def CandidatesFromStoredRequestInner( self ):
|
||||||
return self.stored_candidates if self.stored_candidates else []
|
return self.stored_candidates if self.stored_candidates else []
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user