Ensuring we are serializing real Python objects
Trying to json.dump Vim dictionaries fails.
This commit is contained in:
parent
60aa5581c1
commit
f0c9878f87
@ -41,7 +41,7 @@ def BuildServerConf():
|
|||||||
"""Builds a dictionary mapping YCM Vim user options to values. Option names
|
"""Builds a dictionary mapping YCM Vim user options to values. Option names
|
||||||
don't have the 'ycm_' prefix."""
|
don't have the 'ycm_' prefix."""
|
||||||
|
|
||||||
vim_globals = vimsupport.GetReadOnlyVimGlobals()
|
vim_globals = vimsupport.GetReadOnlyVimGlobals( force_python_objects = True )
|
||||||
server_conf = {}
|
server_conf = {}
|
||||||
for key, value in vim_globals.items():
|
for key, value in vim_globals.items():
|
||||||
if not key.startswith( YCM_VAR_PREFIX ):
|
if not key.startswith( YCM_VAR_PREFIX ):
|
||||||
|
@ -95,7 +95,10 @@ def LoadDictIntoVimGlobals( new_globals, overwrite = True ):
|
|||||||
|
|
||||||
|
|
||||||
# Changing the returned dict will NOT change the value in Vim.
|
# Changing the returned dict will NOT change the value in Vim.
|
||||||
def GetReadOnlyVimGlobals():
|
def GetReadOnlyVimGlobals( force_python_objects = False ):
|
||||||
|
if force_python_objects:
|
||||||
|
return vim.eval( 'g:' )
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# vim.vars is fairly new so it might not exist
|
# vim.vars is fairly new so it might not exist
|
||||||
return vim.vars
|
return vim.vars
|
||||||
|
Loading…
x
Reference in New Issue
Block a user