Bug 1632497 - Make YouCompleteMe clangd completer work. r=jgraham
authorEmilio Cobos Álvarez <emilio@crisal.io>
Tue, 28 Apr 2020 10:08:00 +0000
changeset 593527 6891c18877dea81239eeae837fbf8a0863462f1f
parent 593526 95fac5915a31c26ced5c9634bc25617343d88d80
child 593528 4a20db95098dd4dd7b1d1da1922dabcb633cfc1b
push id2335
push userffxbld-merge
push dateMon, 25 May 2020 13:47:24 +0000
treeherdermozilla-release@69ca1d06f46a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgraham
bugs1632497
milestone77.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1632497 - Make YouCompleteMe clangd completer work. r=jgraham We need to use the new Settings() API, instead of the deprecated FlagsForFile. Though in practice we can just delegate to it and it works out of the box. Differential Revision: https://phabricator.services.mozilla.com/D72152
.ycm_extra_conf.py
--- a/.ycm_extra_conf.py
+++ b/.ycm_extra_conf.py
@@ -27,16 +27,23 @@ def _is_likely_cpp_header(filename):
         return False
 
     if filename.endswith('Inlines.h') or filename.endswith('-inl.h'):
         return True
 
     cpp_file = filename[:-1] + 'cpp'
     return os.path.exists(cpp_file)
 
+
+def Settings(**kwargs):
+    if kwargs[ 'language' ] == 'cfamily':
+        return FlagsForFile(kwargs['filename'])
+    return {}
+
+
 def FlagsForFile(filename):
     output = subprocess.check_output([path, 'compileflags', filename])
     output = output.decode('utf-8')
 
     flag_list = shlex.split(output)
 
     # This flag is added by Fennec for android build and causes ycmd to fail to parse the file.
     # Removing this flag is a workaround until ycmd starts to handle this flag properly.