# 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
                # but on_query_completions needs to have the completion list
                # already available
                current_view.run_command('auto_complete',{
                    'disable_auto_insert': True,
                    'api_completions_only': True,
                    'next_completion_if_showing': True
                })
                Debug('autocomplete', " -> (sublime cmd finished)" )

            self.project.tsserver.complete(view.file_name(), cursor_line, autocomplete_col, is_member_str, async_react_completions_available)




    # ENTRY KEY
    def _get_list_key(self,entry):

        #{'name': 'SVGLineElement',
        # 'kind': 'var',
        # 'kindModifiers': 'declare',
        # 'type': 'interface SVGLineElement\nvar SVGLineElement: {\n    new (): SVGLineElement;\n    prototype: SVGLineElement;\n}',
        # 'docComment': ''}


        kindModifiers = get_prefix(entry['kindModifiers'])
        kind = get_prefix(entry['kind'])
        type_ = entry['type'] if 'type' in entry else entry['name']
        type_ = type_.split('\n')[0]

        if kindModifiers == "" and kind == "":

# 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

                # but on_query_completions needs to have the completion list
                # already available
                current_view.run_command('auto_complete',{
                    'disable_auto_insert': True,
                    'api_completions_only': True,
                    'next_completion_if_showing': True
                })
                Debug('autocomplete', " -> (sublime cmd finished)" )

            self.project.tsserver.complete(view.file_name(), cursor_line, autocomplete_col, is_member_str, async_react_completions_available)




    # ENTRY KEY
    def _get_list_key(self,entry):

        #{'name': 'SVGLineElement',
        # 'kind': 'var',
        # 'kindModifiers': 'declare',
        # 'type': 'interface SVGLineElement\nvar SVGLineElement: {\n    new (): SVGLineElement;\n    prototype: SVGLineElement;\n}',
        # 'docComment': ''}


        kindModifiers = get_prefix(entry['kindModifiers'])
        kind = get_prefix(entry['kind'])
        type_ = entry['type'] if 'type' in entry else entry['name']
        type_ = type_.split('\n')[0]

        if kindModifiers == "" and kind == "":

            kind = get_prefix(type_.split(' ')[0])