Fixing str/unicode mismatch

Sending a unicode filepath to CompilationDatabase doesn't work and causes
exceptions; it has to be a (utf-8 encoded) str object.
This commit is contained in:
Strahinja Val Markovic 2014-01-17 10:18:29 -08:00
parent 433b3b64f0
commit 47a0048f34
2 changed files with 4 additions and 2 deletions

View File

@ -103,6 +103,7 @@ class Flags( object ):
def _CallExtraConfFlagsForFile( module, filename, client_data ):
filename = ToUtf8IfNeeded( filename )
# For the sake of backwards compatibility, we need to first check whether the
# FlagsForFile function in the extra conf module even allows keyword args.
if inspect.getargspec( module.FlagsForFile ).keywords:

View File

@ -22,6 +22,7 @@ import re
from ycm.completers.completer import Completer
from ycm.completers.cpp.clang_completer import InCFamilyFile
from ycm.completers.cpp.flags import Flags
from ycm.utils import ToUtf8IfNeeded
from ycm.server import responses
class FilenameCompleter( Completer ):
@ -55,7 +56,7 @@ class FilenameCompleter( Completer ):
def AtIncludeStatementStart( self, request_data ):
start_column = request_data[ 'start_column' ]
current_line = request_data[ 'line_value' ]
filepath = request_data[ 'filepath' ]
filepath = ToUtf8IfNeeded( request_data[ 'filepath' ] )
filetypes = request_data[ 'file_data' ][ filepath ][ 'filetypes' ]
return ( InCFamilyFile( filetypes ) and
self._include_start_regex.match(
@ -76,7 +77,7 @@ class FilenameCompleter( Completer ):
def ComputeCandidatesInner( self, request_data ):
current_line = request_data[ 'line_value' ]
start_column = request_data[ 'start_column' ]
filepath = request_data[ 'filepath' ]
filepath = ToUtf8IfNeeded( request_data[ 'filepath' ] )
filetypes = request_data[ 'file_data' ][ filepath ][ 'filetypes' ]
line = current_line[ :start_column ]