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

Side by Side Diff: tools/sublime/compile_flags.py

Issue 2129993002: [SublimeText] Get the clang flags with the same script that vim uses (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months 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
« docs/linux_sublime_dev.md ('K') | « docs/linux_sublime_dev.md ('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
(Empty)
1 #!/usr/bin/python
sashab 2016/07/08 00:58:26 Just rename this to ninja_options_script.py and de
jkarlin 2016/07/18 17:48:55 Done. Note that the parameters are different, so t
2 #
3 # Copyright 2016 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file.
6 #
7 # Usage within SublimeClang:
8 # "sublimeclang_options_script": "python
9 # ${project_path}/src/tools/sublime/compile_flags.py \
10 # -d '${project_path}/../depot_tools'"
sashab 2016/07/08 00:58:27 -d '/path/to/depot_tools'
sashab 2016/07/08 00:58:27 -d '/path/to/depot_tools'
jkarlin 2016/07/18 17:48:55 Done.
11 #
12 #
13 # NOTE: ${project_path} expands to the directory of the Sublime project file,
14 # and SublimgClang passes the absolute file path to the current file as an
sashab 2016/07/08 00:58:26 SublimeClang*
jkarlin 2016/07/18 17:48:55 Done.
15 # additional argument. You should change the -d argument to point to your
16 # depot_tools directory.
17
18 import imp
19 import optparse
20 import os
21 import sys
22
23 ycm_module_path = os.path.normpath(
24 os.path.join(os.path.dirname(os.path.abspath(__file__)),
25 '../vim/chromium.ycm_extra_conf.py'))
26 ycm_extra_conf = imp.load_source('ycm_extra_conf', ycm_module_path)
27
28 def main():
29 usage = "usage: %prog [options] file"
30 parser = optparse.OptionParser(usage)
31 parser.add_option("-d", "--depot_tools", dest="depot_path",
32 help="path to depot_tools")
33 (options, args) = parser.parse_args()
34 if options.depot_path:
35 os.environ["PATH"] += ":%s" % options.depot_path
36 if len(args) != 1:
37 parser.error("incorrect number of arguments")
38
39 path = os.path.realpath(args[0])
40 results = ycm_extra_conf.FlagsForFile(path)
41
42 for flag in results['flags']:
43 print flag
44
45 if __name__ == "__main__":
46 main()
OLDNEW
« docs/linux_sublime_dev.md ('K') | « docs/linux_sublime_dev.md ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698