Skip to content

Use native OS save as dialog #2

@keith-hall

Description

@keith-hall

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions