valid_FileExtensions.append('txt')
valid_FileExtensions.append('myCustomFileExtension')
window = view.window()
fileExtension = window.extract_variables()['file_extension']
file_IsValid = False
for entry in valid_FileExtensions:
    if fileExtension == entry:
        file_IsValid = True
if file_IsValid == False:
    return
How to allow a Sublime Text 3 package for certain file syntax only?