Skip to content

Commit 5de135f

Browse files
committed
Added relative paths and Updated documentation
1 parent f7cb05c commit 5de135f

3 files changed

Lines changed: 25 additions & 17 deletions

File tree

.codeintel/config

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"Python": {
3+
"pythonExtraPaths": [ "./libs/" ]
4+
}
5+
}
6+

README.markdown

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,33 +44,33 @@ Don't forget to add key or mouse bindings. For "Jump to Symbol Declaration":
4444
`{ "button": "button1", "modifiers": ["super"], "command": "goto_python_definition", "press_command": "drag_select" }`
4545

4646

47-
Configuration files (`~/.codeintel/config' or `project_root/.codeintel/config'). Example::
47+
Configuration files (`~/.codeintel/config' or `project_root/.codeintel/config'). All configurations are optional. Example::
4848

4949
{
5050
"PHP": {
5151
"php": '/usr/bin/php',
5252
"phpExtraPaths": [],
53-
"phpConfigFile": 'php.ini',
53+
"phpConfigFile": 'php.ini'
5454
},
5555
"JavaScript": {
56-
"javascriptExtraPaths": [],
56+
"javascriptExtraPaths": []
5757
},
5858
"Perl": {
5959
"perl": "/usr/bin/perl",
60-
"perlExtraPaths": [],
60+
"perlExtraPaths": []
6161
},
6262
"Perl": {
6363
"ruby": "/usr/bin/ruby",
64-
"rubyExtraPaths": [],
64+
"rubyExtraPaths": []
6565
},
6666
"Python": {
6767
"python": '/usr/bin/python',
68-
"pythonExtraPaths": [],
68+
"pythonExtraPaths": []
6969
},
7070
"Python3": {
7171
"python": '/usr/bin/python3',
72-
"pythonExtraPaths": [],
73-
},
72+
"pythonExtraPaths": []
73+
}
7474
}
7575

7676
Using

python_codeintel.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,32 +9,32 @@
99
...or in User Mouse Bindings (Packages/User/Default.sublime-mousemap):
1010
{ "button": "button1", "modifiers": ["super"], "command": "goto_python_definition", "press_command": "drag_select" }
1111
12-
Configuration files (`~/.codeintel/config' or `project_root/.codeintel/config'). Example:
12+
Configuration files (`~/.codeintel/config' or `project_root/.codeintel/config'). All configurations are optional. Example:
1313
{
1414
"PHP": {
1515
"php": '/usr/bin/php',
1616
"phpExtraPaths": [],
17-
"phpConfigFile": 'php.ini',
17+
"phpConfigFile": 'php.ini'
1818
},
1919
"JavaScript": {
20-
"javascriptExtraPaths": [],
20+
"javascriptExtraPaths": []
2121
},
2222
"Perl": {
2323
"perl": "/usr/bin/perl",
24-
"perlExtraPaths": [],
24+
"perlExtraPaths": []
2525
},
2626
"Perl": {
2727
"ruby": "/usr/bin/ruby",
28-
"rubyExtraPaths": [],
28+
"rubyExtraPaths": []
2929
},
3030
"Python": {
3131
"python": '/usr/bin/python',
32-
"pythonExtraPaths": [],
32+
"pythonExtraPaths": []
3333
},
3434
"Python3": {
3535
"python": '/usr/bin/python3',
36-
"pythonExtraPaths": [],
37-
},
36+
"pythonExtraPaths": []
37+
}
3838
}
3939
4040
"""
@@ -247,11 +247,13 @@ def codeintel_scan(view, path, content, lang):
247247
project_dir = path and find_folder(path, '.codeintel')
248248
if project_dir:
249249
tryReadCodeIntelDict(os.path.join(project_dir, 'config'), _config)
250+
else:
251+
project_dir = os.path.expanduser(os.path.join('~', '.codeintel'))
250252
config.update(_config.get(lang, {}))
251253
for conf in [ 'pythonExtraPaths', 'rubyExtraPaths', 'perlExtraPaths', 'javascriptExtraPaths', 'phpExtraPaths' ]:
252254
v = config.get(conf)
253255
if v and isinstance(v, (list, tuple)):
254-
config[conf] = os.pathsep.join(v)
256+
config[conf] = os.pathsep.join(p if p.startswith('/') else os.path.abspath(os.path.join(project_dir, '..', p)) for p in v)
255257

256258
env = SimplePrefsEnvironment(**config)
257259

0 commit comments

Comments
 (0)