Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion CTags.sublime-settings
Original file line number Diff line number Diff line change
Expand Up @@ -163,5 +163,11 @@
//
// Different tags generators may generate this non-standard field in
// different formats
"scope_re": "(\\d.*?):(\\d.*?)-(\\d.*?):(\\d.*?)"
"scope_re": "(\\d.*?):(\\d.*?)-(\\d.*?):(\\d.*?)",

// Enable use project options file
"enable_project_option": false,

// Default options file name
"options_file": "ctags.cnf"
}
25 changes: 25 additions & 0 deletions ctagsplugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -821,6 +821,7 @@ def run(self, edit, **args):
recursive = setting('recursive')
opts = setting('opts')
tag_file = setting('tag_file')
opts = self.append_project_options(opts)

if 'dirs' in args and args['dirs']:
paths.extend(args['dirs'])
Expand Down Expand Up @@ -894,6 +895,30 @@ def tags_built(tag_file):

GetAllCTagsList.ctags_list = [] # clear the cached ctags list

def append_project_options(self, opts):
"""
append ctags.cnf path to opts.
"""
window = sublime.active_window()

if setting('enable_project_option') is True:
project_file_path = window.project_file_name()
if project_file_path is None:
return opts
project_file_path = os.path.dirname(project_file_path)
project_path = window.project_data()['folders'][0]['path']
options_file = setting('options_file')
options_file_path = os.path.join(
project_file_path,
project_path,
options_file)
if os.path.isfile(options_file_path) is True:
import platform
if platform.platform().find('Windows') >= 0:
options_file_path = options_file_path.replace('\\', '\\\\')
opts.append('--options=%s' % options_file_path)
return opts

# Autocomplete commands


Expand Down