# 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/uiutils.py
# def get_prefix(token):
#     if token in PREFIXES:
#         return PREFIXES[token]
#     else:
#         return ''
# 
# Path: lib/utils/viewutils.py
# def get_file_infos(view):
#     return (view.file_name(), get_lines(view), get_content(view))
# 
# def get_content_of_line_at(view, pos):
#     return view.substr(sublime.Region(view.line(pos-1).a, pos))


import re
import json
import sublime
from ..utils import Debug
from ..utils.uiutils import get_prefix
from ..utils.viewutils import get_file_infos, get_content_of_line_at
                Debug('autocomplete', "Autocompletion results available for line %i , %i" % (line+1, col+1) )

                i = self.prepare_list(tss_result_json)
                Debug('autocomplete', " -> prepare List (%i items)" % i )

                # view or line changed
                current_view = sublime.active_window().active_view()
                current_cursor_pos = current_view.sel()[0].begin()
                (current_cursor_line, current_cursor_col) = current_view.rowcol(current_cursor_pos)

                Debug('autocomplete', " => CL: {0}, L: {1}, efcr: {2}, ccc: {3}, col: {4}, ismstr: {5}"
                        .format(current_cursor_line,
                                line,
                                self.enabled_for_col_reference,
                                current_cursor_col,
                                col,
                                is_member_str))

                if current_view.id() != self.enabled_for['viewid'] or filename != current_view.file_name():
                    Debug('autocomplete', " -> file changed since activation of autocomplete or out-dated request -> cancel")
                    return
                if current_cursor_line != self.enabled_for['line'] or current_cursor_line != line:
                    Debug('autocomplete', " -> line changed since start of autocomplete (%i to %i) or out-dated request -> cancel" % (current_cursor_line, line) )
                    return
                if self.enabled_for_col_reference == 'cursor' \
                    and (current_cursor_col != self.enabled_for['col'] or current_cursor_col != col):
                    Debug('autocomplete', " -> cursor changed position (current col: %i ; at command issue: %i) or out-dated request -> cancel" % (current_cursor_col, col) )
                    return

                if is_member_str == 'true':

# 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/uiutils.py
# def get_prefix(token):
#     if token in PREFIXES:
#         return PREFIXES[token]
#     else:
#         return ''
# 
# Path: lib/utils/viewutils.py
# def get_file_infos(view):
#     return (view.file_name(), get_lines(view), get_content(view))
# 
# def get_content_of_line_at(view, pos):
#     return view.substr(sublime.Region(view.line(pos-1).a, pos))


# Path: lib/system/Completion.py
import re
import json
import sublime
from ..utils import Debug
from ..utils.uiutils import get_prefix
from ..utils.viewutils import get_file_infos, get_content_of_line_at

                Debug('autocomplete', "Autocompletion results available for line %i , %i" % (line+1, col+1) )

                i = self.prepare_list(tss_result_json)
                Debug('autocomplete', " -> prepare List (%i items)" % i )

                # view or line changed
                current_view = sublime.active_window().active_view()
                current_cursor_pos = current_view.sel()[0].begin()
                (current_cursor_line, current_cursor_col) = current_view.rowcol(current_cursor_pos)

                Debug('autocomplete', " => CL: {0}, L: {1}, efcr: {2}, ccc: {3}, col: {4}, ismstr: {5}"
                        .format(current_cursor_line,
                                line,
                                self.enabled_for_col_reference,
                                current_cursor_col,
                                col,
                                is_member_str))

                if current_view.id() != self.enabled_for['viewid'] or filename != current_view.file_name():
                    Debug('autocomplete', " -> file changed since activation of autocomplete or out-dated request -> cancel")
                    return
                if current_cursor_line != self.enabled_for['line'] or current_cursor_line != line:
                    Debug('autocomplete', " -> line changed since start of autocomplete (%i to %i) or out-dated request -> cancel" % (current_cursor_line, line) )
                    return
                if self.enabled_for_col_reference == 'cursor' \
                    and (current_cursor_col != self.enabled_for['col'] or current_cursor_col != col):
                    Debug('autocomplete', " -> cursor changed position (current col: %i ; at command issue: %i) or out-dated request -> cancel" % (current_cursor_col, col) )
                    return

                if is_member_str == 'true':

                    current_dot_col = get_col_after_last_dot( get_content_of_line_at(view, current_cursor_pos) )