Total Complexity | 2 |
Total Lines | 25 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | # coding=utf-8 |
||
9 | class QuickGotoAnythingOpenFileCommand(sublime_plugin.ApplicationCommand): |
||
10 | """This is a wrapper class for SublimeText's `open_file` command. |
||
11 | |||
12 | The task is to hide the command in menu if `edit_settings` is available. |
||
13 | """ |
||
14 | |||
15 | @staticmethod |
||
16 | def run(file): |
||
17 | """Expand variables and open the resulting file. |
||
18 | |||
19 | NOTE: For some unknown reason the `open_file` command doesn't expand |
||
20 | ${platform} when called by `run_command`, so it is expanded here. |
||
21 | """ |
||
22 | platform_name = { |
||
23 | 'osx': 'OSX', |
||
24 | 'windows': 'Windows', |
||
25 | 'linux': 'Linux', |
||
26 | }[sublime.platform()] |
||
27 | file = file.replace('${platform}', platform_name) |
||
28 | sublime.run_command('open_file', {'file': file}) |
||
29 | |||
30 | @staticmethod |
||
31 | def is_visible(): |
||
32 | """Return True to to show the command in command pallet and menu.""" |
||
33 | return STVER < 3124 |
||
34 | |||
52 |