Wouldn't it be better to use the OS' native "save as" dialog, instead of an input panel?
I realize that there is no API to ask the user to choose a file, but wouldn't the following suffice?
import sublime
import sublime_plugin
class SaveCopyAsCommand(sublime_plugin.TextCommand):
def run(self, edit):
previous_path = self.view.file_name()
self.view.run_command('prompt_save_as')
self.view.retarget(previous_path or '')
def is_enabled(self):
return self.view.file_name() is not None
i.e. let ST show it's normal Save As prompt, then set the view back to tracking the original file path
Wouldn't it be better to use the OS' native "save as" dialog, instead of an input panel?
I realize that there is no API to ask the user to choose a file, but wouldn't the following suffice?
i.e. let ST show it's normal Save As prompt, then set the view back to tracking the original file path