From aa73ea01750b2e17320143a8259116e407d813a9 Mon Sep 17 00:00:00 2001 From: micbou Date: Mon, 7 Dec 2015 18:15:29 +0100 Subject: [PATCH] Set buffer filetypes for UltiSnips This fixes #1818. --- python/ycm/youcompleteme.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/python/ycm/youcompleteme.py b/python/ycm/youcompleteme.py index 77b81a0a..cdb7e793 100644 --- a/python/ycm/youcompleteme.py +++ b/python/ycm/youcompleteme.py @@ -602,7 +602,14 @@ def _AddUltiSnipsDataIfNeeded( extra_data ): return try: - rawsnips = UltiSnips_Manager._snips( '', 1 ) + # Since UltiSnips may run in a different python interpreter (python 3) than + # YCM, UltiSnips_Manager singleton is not necessary the same as the one + # used by YCM. In particular, it means that we cannot rely on UltiSnips to + # set the current filetypes to the singleton. We need to do it ourself. + UltiSnips_Manager.reset_buffer_filetypes() + UltiSnips_Manager.add_buffer_filetypes( + vimsupport.GetVariableValue( '&filetype' ) ) + rawsnips = UltiSnips_Manager._snips( '', True ) except: return