Fixing ycmd startup under py3

Some syntax rules are different for py3 plus the standard bytes vs
unicode nonsense.
This commit is contained in:
Val Markovic 2016-02-28 14:41:09 -08:00
parent 92346d2bcc
commit 123c5c4acb

View File

@ -104,17 +104,18 @@ class YouCompleteMe( object ):
self._SetupServer()
self._ycmd_keepalive.Start()
self._complete_done_hooks = {
'cs': lambda( self ): self._OnCompleteDone_Csharp()
'cs': lambda self: self._OnCompleteDone_Csharp()
}
def _SetupServer( self ):
self._available_completers = {}
server_port = utils.GetUnusedLocalhostPort()
# The temp options file is deleted by ycmd during startup
with tempfile.NamedTemporaryFile( delete = False ) as options_file:
with tempfile.NamedTemporaryFile( delete = False, mode = 'w+' ) as options_file:
hmac_secret = os.urandom( HMAC_SECRET_LENGTH )
options_dict = dict( self._user_options )
options_dict[ 'hmac_secret' ] = base64.b64encode( hmac_secret )
options_dict[ 'hmac_secret' ] = utils.ToUnicode(
base64.b64encode( hmac_secret ) )
json.dump( options_dict, options_file )
options_file.flush()