From bb3044c7e3e6db4fbafaf9e1de8b4b8831c73436 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=20=C3=84lgmyr?= Date: Fri, 28 Sep 2018 07:55:41 +0200 Subject: [PATCH] Add support for "arguments" in database --- rplugin/python3/deoplete/sources/deoplete_clang2.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/rplugin/python3/deoplete/sources/deoplete_clang2.py b/rplugin/python3/deoplete/sources/deoplete_clang2.py index 56d60fc..b9d6abc 100644 --- a/rplugin/python3/deoplete/sources/deoplete_clang2.py +++ b/rplugin/python3/deoplete/sources/deoplete_clang2.py @@ -350,8 +350,16 @@ def find_db_flags(self, context): for entry in json.load(fp): directory = entry.get('directory', cwd) file, ext = os.path.splitext(entry.get('file', '')) + + if 'command' in entry: + command = entry.get('command') + elif 'arguments' in entry: + command = ' '.join(entry.get('arguments')) + else: + raise Exception('Either "command" or "arguments" is required in compilation database') + for item in re.finditer(r'(-[IDFW]|' + flag_pattern + - ')\s*(\S+)', entry.get('command')): + ')\s*(\S+)', command): flag = item.group(1) val = item.group(2)