# Path: lib/utils/debug.py
# def Debug(classification, text):
#     if 'all' in print_classifications or classification in print_classifications:
#         print("ArcticTypescript: %s: %s" % (classification.ljust(8), text))
#     if classification not in possible_classifications:
#         print("ArcticTypescript: debug: got unknown debug message classification: %s. " \
#             "Consider adding this to possible_classifications" % classification)
#     sys.stdout.flush()
# 
# Path: lib/utils/pathutils.py
# def add_usr_local_bin_to_path_on_osx():
# def find_tsconfigdir(rootdir):
# def expand_variables(path, project=None, use_cache=False):
# def get_tss_path():
# def get_expandglob_path():
# def default_node_path(node_path, project=None):
# def default_tsc_path(tsc_path=None, project=None):
# def search_node_modules(rootdir):
# 
# Path: lib/utils/disabling.py
# def set_plugin_temporarily_disabled(folder=None):
#     """ Enables the plugin globally or for folder.
#         Folder can be a view """
#     if folder is None:
#         if not is_plugin_globally_disabled():
#             plugin_disabled_for_folders.append("*global")
#     else:
#         if isinstance(folder, sublime.View):
#             folder = os.path.dirname(folder.file_name())
#         folder = os.path.normcase(folder)
#         Debug('project', 'Disable ArcticTypescript for %s' % folder)
#         if folder not in plugin_disabled_for_folders:
#             plugin_disabled_for_folders.append(folder)
# 
# def set_plugin_temporarily_enabled(folder=None):
#     """ Disables the plugin globally or for folder.
#         Folder can be a view """
#     if folder is None:
#         if is_plugin_globally_disabled():
#             plugin_disabled_for_folders.remove("*global")
#     else:
#         if isinstance(folder, sublime.View):
#             folder = os.path.dirname(folder.file_name())
#         folder = os.path.normcase(folder)
#         Debug('project', 'Enable ArcticTypescript for %s' % folder)
#         if folder in plugin_disabled_for_folders:
#             plugin_disabled_for_folders.remove(folder)
# 
# def is_plugin_temporarily_disabled(folder=None):
#     """ Returns True if the plugin is disabled globally or for folder.
#         Folder can be a view """
#     if is_plugin_globally_disabled() or folder is None:
#         return is_plugin_globally_disabled()
#     if folder is not None and isinstance(folder, sublime.View):
#         if folder.file_name() is None:
#             return is_plugin_globally_disabled()
#         folder = os.path.dirname(folder.file_name())
#     folder = os.path.normcase(folder)
#     return folder in plugin_disabled_for_folders


import sublime
import json
import os
from ..utils import package_path, Debug
from ..utils.disabling import set_plugin_temporarily_disabled, \
                               set_plugin_temporarily_enabled, \
                               is_plugin_temporarily_disabled


    def handle_tsconfig_error(self, tsconfigfile, message=""):
        """ User will be asked to create a tsconfig.json file """
        self._prepare(message)

        self.messages.append(['> Open your tsconfig.json and Edit it'])
        self.actions.append(lambda: [self.window.open_file(tsconfigfile), self._cleanup()])

        self.messages.append(['> Show tsconfig.json example'])
        self.actions.append(lambda: [self.window.open_file(package_path + '/examples/basic_browser_project/tsconfig.json'), self._cleanup()])

        self.messages.append(['> Documentation: README ', 'see Chapter Settings'])
        self.actions.append(lambda: [self.window.open_file(package_path + '/README.md'), self._cleanup()])

        self._show_and_action()


    def new_tsconfig_wizzard(self, message=""):
        """ User will be asked to create a new tsconfig.json file """
        self._prepare(message, action_default=lambda: self.new_tsconfig_wizzard(message))

        self.messages.append(['Choose an option from below:'])
        self.actions.append(None)

        self.messages.append(['> Create a tsconfig.json file',
                              '(You will be asked questions at the bottom of the window.)'])
        self.actions.append(lambda: self._create_tsconfigjson())

        self.messages.append(['> I don\'t understand please show me the README file'])

# Path: lib/utils/debug.py
# def Debug(classification, text):
#     if 'all' in print_classifications or classification in print_classifications:
#         print("ArcticTypescript: %s: %s" % (classification.ljust(8), text))
#     if classification not in possible_classifications:
#         print("ArcticTypescript: debug: got unknown debug message classification: %s. " \
#             "Consider adding this to possible_classifications" % classification)
#     sys.stdout.flush()
# 
# Path: lib/utils/pathutils.py
# def add_usr_local_bin_to_path_on_osx():
# def find_tsconfigdir(rootdir):
# def expand_variables(path, project=None, use_cache=False):
# def get_tss_path():
# def get_expandglob_path():
# def default_node_path(node_path, project=None):
# def default_tsc_path(tsc_path=None, project=None):
# def search_node_modules(rootdir):
# 
# Path: lib/utils/disabling.py
# def set_plugin_temporarily_disabled(folder=None):
#     """ Enables the plugin globally or for folder.
#         Folder can be a view """
#     if folder is None:
#         if not is_plugin_globally_disabled():
#             plugin_disabled_for_folders.append("*global")
#     else:
#         if isinstance(folder, sublime.View):
#             folder = os.path.dirname(folder.file_name())
#         folder = os.path.normcase(folder)
#         Debug('project', 'Disable ArcticTypescript for %s' % folder)
#         if folder not in plugin_disabled_for_folders:
#             plugin_disabled_for_folders.append(folder)
# 
# def set_plugin_temporarily_enabled(folder=None):
#     """ Disables the plugin globally or for folder.
#         Folder can be a view """
#     if folder is None:
#         if is_plugin_globally_disabled():
#             plugin_disabled_for_folders.remove("*global")
#     else:
#         if isinstance(folder, sublime.View):
#             folder = os.path.dirname(folder.file_name())
#         folder = os.path.normcase(folder)
#         Debug('project', 'Enable ArcticTypescript for %s' % folder)
#         if folder in plugin_disabled_for_folders:
#             plugin_disabled_for_folders.remove(folder)
# 
# def is_plugin_temporarily_disabled(folder=None):
#     """ Returns True if the plugin is disabled globally or for folder.
#         Folder can be a view """
#     if is_plugin_globally_disabled() or folder is None:
#         return is_plugin_globally_disabled()
#     if folder is not None and isinstance(folder, sublime.View):
#         if folder.file_name() is None:
#             return is_plugin_globally_disabled()
#         folder = os.path.dirname(folder.file_name())
#     folder = os.path.normcase(folder)
#     return folder in plugin_disabled_for_folders


# Path: lib/system/ProjectWizzard.py
import sublime
import json
import os
from ..utils import package_path, Debug
from ..utils.disabling import set_plugin_temporarily_disabled, \
                               set_plugin_temporarily_enabled, \
                               is_plugin_temporarily_disabled



    def handle_tsconfig_error(self, tsconfigfile, message=""):
        """ User will be asked to create a tsconfig.json file """
        self._prepare(message)

        self.messages.append(['> Open your tsconfig.json and Edit it'])
        self.actions.append(lambda: [self.window.open_file(tsconfigfile), self._cleanup()])

        self.messages.append(['> Show tsconfig.json example'])
        self.actions.append(lambda: [self.window.open_file(package_path + '/examples/basic_browser_project/tsconfig.json'), self._cleanup()])

        self.messages.append(['> Documentation: README ', 'see Chapter Settings'])
        self.actions.append(lambda: [self.window.open_file(package_path + '/README.md'), self._cleanup()])

        self._show_and_action()


    def new_tsconfig_wizzard(self, message=""):
        """ User will be asked to create a new tsconfig.json file """
        self._prepare(message, action_default=lambda: self.new_tsconfig_wizzard(message))

        self.messages.append(['Choose an option from below:'])
        self.actions.append(None)

        self.messages.append(['> Create a tsconfig.json file',
                              '(You will be asked questions at the bottom of the window.)'])
        self.actions.append(lambda: self._create_tsconfigjson())

        self.messages.append(['> I don\'t understand please show me the README file'])

        self.actions.append(lambda: [self.window.open_file(package_path + '/README.md'), self._cleanup()])