YouCompleteMe/python/ycm/client/omni_completion_request.py

53 lines
1.6 KiB
Python
Raw Permalink Normal View History

# Copyright (C) 2013 Google Inc.
2013-10-07 18:47:48 -04:00
#
# This file is part of YouCompleteMe.
#
# YouCompleteMe is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# YouCompleteMe is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with YouCompleteMe. If not, see <http://www.gnu.org/licenses/>.
2016-02-27 19:12:24 -05:00
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
# Not installing aliases from python-future; it's unreliable and slow.
2016-02-27 19:12:24 -05:00
from builtins import * # noqa
2013-10-07 18:47:48 -04:00
from ycm.client.completion_request import CompletionRequest
class OmniCompletionRequest( CompletionRequest ):
def __init__( self, omni_completer, request_data ):
2014-05-28 13:20:54 -04:00
super( OmniCompletionRequest, self ).__init__( request_data )
2013-10-07 18:47:48 -04:00
self._omni_completer = omni_completer
def Start( self ):
2013-10-07 18:47:48 -04:00
self._results = self._omni_completer.ComputeCandidates( self.request_data )
def Done( self ):
return True
def Response( self ):
return {
'line': self.request_data[ 'line_num' ],
'column': self.request_data[ 'column_num' ],
'completion_start_column': self.request_data[ 'start_column' ],
'completions': self._results
}
def OnCompleteDone( self ):
pass