Sublime Forum

Run commands after show_overlay is closed

#1

I wanted to create a command to ignore file_exclude_patterns:

FILE_EXCLUDE_PATTERNS = config('file_exclude_patterns')

config('file_exclude_patterns', [])

self.view.window().run_command('show_overlay', {
    "overlay": "goto", "show_files": True
})

config('file_exclude_patterns', FILE_EXCLUDE_PATTERNS)

The problem is: last line is called while overlay is open, How to do that when overlay is closed?

0 Likes

#2

Offhand I don’t think there’s a direct way to do that in a foolproof manner. It may also not do what you want just based on how modifying the file catalog might incur a time cost in having to index the newly exposed files.

0 Likes

#3

As far as I know, Sublime doesn’t have a direct callback for this. One workaround could be setting up a periodic check using a timer to see if the overlay is still active. Once it’s closed, you can then reset your file_exclude_patterns. It’s a bit more complex and not as clean as a direct callback, but it should do the trick.

1 Like