Updating to latest ycmd

Since ycmd doesn't need 'query', 'start_column' and 'line_value' params, we
don't send them anymore.
This commit is contained in:
Strahinja Val Markovic 2014-05-27 14:29:19 -07:00
parent bb1114fe4c
commit 4cf9cfcdff
7 changed files with 16 additions and 38 deletions

View File

@ -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

View File

@ -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():

View File

@ -17,7 +17,6 @@
# You should have received a copy of the GNU General Public License
# along with YouCompleteMe. If not, see <http://www.gnu.org/licenses/>.
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

View File

@ -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 )

View File

@ -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 )

View File

@ -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 ) )

2
third_party/ycmd vendored

@ -1 +1 @@
Subproject commit 7a14048fe2543287b8681544a8b428b409a93858
Subproject commit 5ed4d902c76369dcd653c59984c1996d7cdc16a5