From 4cf9cfcdff4c9c76b5bea64f2f5b72fe175e0bf4 Mon Sep 17 00:00:00 2001 From: Strahinja Val Markovic Date: Tue, 27 May 2014 14:29:19 -0700 Subject: [PATCH] Updating to latest ycmd Since ycmd doesn't need 'query', 'start_column' and 'line_value' params, we don't send them anymore. --- autoload/youcompleteme.vim | 12 ++++++------ python/ycm/base.py | 16 +++------------- python/ycm/client/base_request.py | 11 +---------- python/ycm/client/completion_request.py | 5 ++--- python/ycm/client/omni_completion_request.py | 3 +-- python/ycm/omni_completer.py | 5 ++--- third_party/ycmd | 2 +- 7 files changed, 16 insertions(+), 38 deletions(-) diff --git a/autoload/youcompleteme.vim b/autoload/youcompleteme.vim index fe011bdc..c287a98c 100644 --- a/autoload/youcompleteme.vim +++ b/autoload/youcompleteme.vim @@ -623,9 +623,9 @@ endfunction python << EOF -def GetCompletions( query ): +def GetCompletionsInner(): request = ycm_state.GetCurrentCompletionRequest() - request.Start( query ) + request.Start() while not request.Done(): if bool( int( vim.eval( 'complete_check()' ) ) ): return { 'words' : [], 'refresh' : 'always'} @@ -635,8 +635,8 @@ def GetCompletions( query ): EOF -function! s:CompletionsForQuery( query ) - py results = GetCompletions( vim.eval( 'a:query' ) ) +function! s:GetCompletions() + py results = GetCompletionsInner() let results = pyeval( 'results' ) let s:searched_and_results_found = len( results.words ) != 0 return results @@ -669,7 +669,7 @@ function! youcompleteme#Complete( findstart, base ) endif return pyeval( 'request.CompletionStartColumn()' ) else - return s:CompletionsForQuery( a:base ) + return s:GetCompletions() endif endfunction @@ -680,7 +680,7 @@ function! youcompleteme#OmniComplete( findstart, base ) py request = ycm_state.CreateCompletionRequest( force_semantic = True ) return pyeval( 'request.CompletionStartColumn()' ) else - return s:CompletionsForQuery( a:base ) + return s:GetCompletions() endif endfunction diff --git a/python/ycm/base.py b/python/ycm/base.py index 2161b032..a56e4545 100644 --- a/python/ycm/base.py +++ b/python/ycm/base.py @@ -21,6 +21,7 @@ import vim from ycm import vimsupport from ycmd import utils from ycmd import user_options_store +from ycmd import request_wrap import ycm_client_support YCM_VAR_PREFIX = 'ycm_' @@ -55,19 +56,8 @@ def LoadJsonDefaultsIntoVim(): def CompletionStartColumn(): - """Returns the 0-based index where the completion string should start. So if - the user enters: - foo.bar^ - with the cursor being at the location of the caret, then the starting column - would be the index of the letter 'b'. - """ - - line = vim.current.line - start_column = vimsupport.CurrentColumn() - - while start_column > 0 and utils.IsIdentifierChar( line[ start_column - 1 ] ): - start_column -= 1 - return start_column + return ( request_wrap.CompletionStartColumn( + vim.current.line, vimsupport.CurrentColumn() + 1 ) - 1 ) def CurrentIdentifierFinished(): diff --git a/python/ycm/client/base_request.py b/python/ycm/client/base_request.py index d48090d1..5f71e076 100644 --- a/python/ycm/client/base_request.py +++ b/python/ycm/client/base_request.py @@ -17,7 +17,6 @@ # You should have received a copy of the GNU General Public License # along with YouCompleteMe. If not, see . -import vim import requests import urlparse from base64 import b64decode, b64encode @@ -134,26 +133,18 @@ class BaseRequest( object ): hmac_secret = '' -def BuildRequestData( start_column = None, - query = None, - include_buffer_data = True ): - if start_column is None: - start_column = 0 +def BuildRequestData( include_buffer_data = True ): line, column = vimsupport.CurrentLineAndColumn() filepath = vimsupport.GetCurrentBufferFilepath() request_data = { 'filetypes': vimsupport.CurrentFiletypes(), 'line_num': line + 1, 'column_num': column + 1, - 'start_column': start_column + 1, - 'line_value': vim.current.line, 'filepath': filepath } if include_buffer_data: request_data[ 'file_data' ] = vimsupport.GetUnsavedAndCurrentBufferData() - if query: - request_data[ 'query' ] = query return request_data diff --git a/python/ycm/client/completion_request.py b/python/ycm/client/completion_request.py index c54e1b4e..2bea8537 100644 --- a/python/ycm/client/completion_request.py +++ b/python/ycm/client/completion_request.py @@ -32,7 +32,7 @@ class CompletionRequest( BaseRequest ): self._completion_start_column = base.CompletionStartColumn() # This field is also used by the omni_completion_request subclass - self.request_data = BuildRequestData( self._completion_start_column ) + self.request_data = BuildRequestData() if extra_data: self.request_data.update( extra_data ) @@ -41,8 +41,7 @@ class CompletionRequest( BaseRequest ): return self._completion_start_column - def Start( self, query ): - self.request_data[ 'query' ] = query + def Start( self ): self._response_future = self.PostDataToHandlerAsync( self.request_data, 'completions', TIMEOUT_SECONDS ) diff --git a/python/ycm/client/omni_completion_request.py b/python/ycm/client/omni_completion_request.py index c7338142..f3de7bad 100644 --- a/python/ycm/client/omni_completion_request.py +++ b/python/ycm/client/omni_completion_request.py @@ -26,8 +26,7 @@ class OmniCompletionRequest( CompletionRequest ): self._omni_completer = omni_completer - def Start( self, query ): - self.request_data[ 'query' ] = query + def Start( self ): self._results = self._omni_completer.ComputeCandidates( self.request_data ) diff --git a/python/ycm/omni_completer.py b/python/ycm/omni_completer.py index 098adb56..9d10650d 100644 --- a/python/ycm/omni_completer.py +++ b/python/ycm/omni_completer.py @@ -19,8 +19,8 @@ import vim from ycm import vimsupport -from ycm import base from ycmd.completers.completer import Completer +from ycmd.request_wrap import RequestWrap from ycm.client.base_request import BuildRequestData OMNIFUNC_RETURNED_BAD_VALUE = 'Omnifunc returned bad value to YCM!' @@ -106,7 +106,6 @@ class OmniCompleter( Completer ): def _BuildRequestDataSubstitute(): - return BuildRequestData( start_column = base.CompletionStartColumn(), - include_buffer_data = False ) + return RequestWrap( BuildRequestData( include_buffer_data = False ) ) diff --git a/third_party/ycmd b/third_party/ycmd index 7a14048f..5ed4d902 160000 --- a/third_party/ycmd +++ b/third_party/ycmd @@ -1 +1 @@ -Subproject commit 7a14048fe2543287b8681544a8b428b409a93858 +Subproject commit 5ed4d902c76369dcd653c59984c1996d7cdc16a5