Skip to content

Commit

Permalink
Removed top-level 'filetypes' request param
Browse files Browse the repository at this point in the history
This is now a computed property as well.
  • Loading branch information
Valloric committed May 29, 2014
1 parent 89f95be commit 1b609be
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
1 change: 0 additions & 1 deletion examples/example_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,6 @@ def BuildRequestData( test_filename = None,
contents = open( test_path ).read()

return {
'filetypes': [ filetype ],
'line_num': line_num,
'column_num': column_num,
'filepath': test_path,
Expand Down
6 changes: 6 additions & 0 deletions ycmd/request_wrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def __init__( self, request ):
'line_value': self._CurrentLine,
'start_column': self._CompletionStartColumn,
'query': self._Query,
'filetypes': self._Filetypes,
}

self._query = None
Expand Down Expand Up @@ -80,6 +81,11 @@ def _Query( self ):
return self._query


def _Filetypes( self ):
path = self[ 'filepath' ]
return self[ 'file_data' ][ path ][ 'filetypes' ]


def CompletionStartColumn( line_value, column_num ):
"""Returns the 1-based index where the completion query should start. So if
the user enters:
Expand Down
7 changes: 6 additions & 1 deletion ycmd/tests/misc_handlers_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@
def SemanticCompletionAvailable_Works_test():
app = TestApp( handlers.app )
request_data = {
'filetypes': ['python']
'filepath': '/foo',
'file_data': {
'/foo': {
'filetypes': ['python'],
}
}
}

ok_( app.post_json( '/semantic_completion_available',
Expand Down
1 change: 0 additions & 1 deletion ycmd/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ def BuildRequest( **kwargs ):
request = {
'line_num': 1,
'column_num': 1,
'filetypes': [ filetype ],
'filepath': filepath,
'file_data': {
filepath: {
Expand Down

0 comments on commit 1b609be

Please sign in to comment.