1# Copyright (C) 2013  Google Inc.
2#
3# This file is part of YouCompleteMe.
4#
5# YouCompleteMe is free software: you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation, either version 3 of the License, or
8# (at your option) any later version.
9#
10# YouCompleteMe is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13# GNU General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
16# along with YouCompleteMe.  If not, see <http://www.gnu.org/licenses/>.
17
18from ycm.client.base_request import BaseRequest, BuildRequestData
19
20
21class CompleterAvailableRequest( BaseRequest ):
22  def __init__( self, filetypes ):
23    super( CompleterAvailableRequest, self ).__init__()
24    self.filetypes = filetypes
25    self._response = None
26
27
28  def Start( self ):
29    request_data = BuildRequestData()
30    request_data.update( { 'filetypes': self.filetypes } )
31    self._response = self.PostDataToHandler( request_data,
32                                             'semantic_completion_available' )
33
34
35  def Response( self ):
36    return self._response
37
38
39def SendCompleterAvailableRequest( filetypes ):
40  request = CompleterAvailableRequest( filetypes )
41  # This is a blocking call.
42  request.Start()
43  return request.Response()
44