Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(190)

Side by Side Diff: tools/vim/chromium.ycm_extra_conf.py

Issue 1430673002: Headless demo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Better javascript Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « headless/public/web_node.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 # Autocompletion config for YouCompleteMe in Chromium. 5 # Autocompletion config for YouCompleteMe in Chromium.
6 # 6 #
7 # USAGE: 7 # USAGE:
8 # 8 #
9 # 1. Install YCM [https://github.com/Valloric/YouCompleteMe] 9 # 1. Install YCM [https://github.com/Valloric/YouCompleteMe]
10 # (Googlers should check out [go/ycm]) 10 # (Googlers should check out [go/ycm])
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 import os 51 import os
52 import os.path 52 import os.path
53 import re 53 import re
54 import shlex 54 import shlex
55 import subprocess 55 import subprocess
56 import sys 56 import sys
57 57
58 # Flags from YCM's default config. 58 # Flags from YCM's default config.
59 _default_flags = [ 59 _default_flags = [
60 '-DUSE_CLANG_COMPLETER', 60 '-DUSE_CLANG_COMPLETER',
61 '-std=c++11',
62 '-x',
63 'c++',
64 ] 61 ]
65 62
66 63
67 def PathExists(*args): 64 def PathExists(*args):
68 return os.path.exists(os.path.join(*args)) 65 return os.path.exists(os.path.join(*args))
69 66
70 67
71 def FindChromeSrcFromFilename(filename): 68 def FindChromeSrcFromFilename(filename):
72 """Searches for the root of the Chromium checkout. 69 """Searches for the root of the Chromium checkout.
73 70
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 Args: 237 Args:
241 clang_commandline: (String) Full Clang invocation. 238 clang_commandline: (String) Full Clang invocation.
242 out_dir: (String) Absolute path to ninja build directory. Relative paths in 239 out_dir: (String) Absolute path to ninja build directory. Relative paths in
243 the command line are relative to |out_dir|. 240 the command line are relative to |out_dir|.
244 additional_flags: (List of String) Additional flags to return. 241 additional_flags: (List of String) Additional flags to return.
245 242
246 Returns: 243 Returns:
247 (List of Strings) The list of command line flags for this source file. Can 244 (List of Strings) The list of command line flags for this source file. Can
248 be empty. 245 be empty.
249 """ 246 """
247 print clang_commandline, out_dir, additional_flags
250 clang_flags = [] + additional_flags 248 clang_flags = [] + additional_flags
251 249
252 # Parse flags that are important for YCM's purposes. 250 # Parse flags that are important for YCM's purposes.
253 clang_tokens = shlex.split(clang_commandline) 251 clang_tokens = shlex.split(clang_commandline)
254 for flag_index, flag in enumerate(clang_tokens): 252 for flag_index, flag in enumerate(clang_tokens):
255 if flag.startswith('-I'): 253 if flag.startswith('-I'):
256 # Relative paths need to be resolved, because they're relative to the 254 # Relative paths need to be resolved, because they're relative to the
257 # output dir, not the source. 255 # output dir, not the source.
258 if flag[2] == '/': 256 if flag[2] == '/':
259 clang_flags.append(flag) 257 clang_flags.append(flag)
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 # transient failure. Preventing YCM from caching the flags allows us to try to 343 # transient failure. Preventing YCM from caching the flags allows us to try to
346 # determine the flags again. 344 # determine the flags again.
347 should_cache_flags_for_file = bool(clang_flags) 345 should_cache_flags_for_file = bool(clang_flags)
348 346
349 final_flags = _default_flags + clang_flags 347 final_flags = _default_flags + clang_flags
350 348
351 return { 349 return {
352 'flags': final_flags, 350 'flags': final_flags,
353 'do_cache': should_cache_flags_for_file 351 'do_cache': should_cache_flags_for_file
354 } 352 }
OLDNEW
« no previous file with comments | « headless/public/web_node.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698