# Path: examples/json-extension/server/server.py
# COUNT_DOWN_START_IN_SECONDS = 10
# COUNT_DOWN_SLEEP_IN_SECONDS = 1
#     CMD_COUNT_DOWN_BLOCKING = 'countDownBlocking'
#     CMD_COUNT_DOWN_NON_BLOCKING = 'countDownNonBlocking'
#     CMD_PROGRESS = 'progress'
#     CMD_REGISTER_COMPLETIONS = 'registerCompletions'
#     CMD_SHOW_CONFIGURATION_ASYNC = 'showConfigurationAsync'
#     CMD_SHOW_CONFIGURATION_CALLBACK = 'showConfigurationCallback'
#     CMD_SHOW_CONFIGURATION_THREAD = 'showConfigurationThread'
#     CMD_UNREGISTER_COMPLETIONS = 'unregisterCompletions'
#     CONFIGURATION_SECTION = 'jsonServer'
#     TOKENS = re.compile('".*"(?=:)')
# class JsonLanguageServer(LanguageServer):
#     def __init__(self):
# def _validate(ls, params):
# def _validate_json(source):
# def completions(params: Optional[CompletionParams] = None) -> CompletionList:
# def count_down_10_seconds_blocking(ls, *args):
# async def count_down_10_seconds_non_blocking(ls, *args):
# def did_change(ls, params: DidChangeTextDocumentParams):
# def did_close(server: JsonLanguageServer, params: DidCloseTextDocumentParams):
# async def did_open(ls, params: DidOpenTextDocumentParams):
# def semantic_tokens(ls: JsonLanguageServer, params: SemanticTokensParams):
# async def progress(ls: JsonLanguageServer, *args):
# async def register_completions(ls: JsonLanguageServer, *args):
# async def show_configuration_async(ls: JsonLanguageServer, *args):
# def show_configuration_callback(ls: JsonLanguageServer, *args):
#     def _config_callback(config):
# def show_configuration_thread(ls: JsonLanguageServer, *args):
# async def unregister_completions(ls: JsonLanguageServer, *args):


import argparse
import logging
from .server import json_server

def add_arguments(parser):
    parser.description = "simple json server example"

    parser.add_argument(
        "--tcp", action="store_true",
        help="Use TCP server"
    )
    parser.add_argument(
        "--ws", action="store_true",
        help="Use WebSocket server"
    )
    parser.add_argument(
        "--host", default="127.0.0.1",
        help="Bind to this address"
    )
    parser.add_argument(
        "--port", type=int, default=2087,
        help="Bind to this port"
    )


def main():
    parser = argparse.ArgumentParser()
    add_arguments(parser)
    args = parser.parse_args()

    if args.tcp:
        json_server.start_tcp(args.host, args.port)
    elif args.ws:

# Path: examples/json-extension/server/server.py
# COUNT_DOWN_START_IN_SECONDS = 10
# COUNT_DOWN_SLEEP_IN_SECONDS = 1
#     CMD_COUNT_DOWN_BLOCKING = 'countDownBlocking'
#     CMD_COUNT_DOWN_NON_BLOCKING = 'countDownNonBlocking'
#     CMD_PROGRESS = 'progress'
#     CMD_REGISTER_COMPLETIONS = 'registerCompletions'
#     CMD_SHOW_CONFIGURATION_ASYNC = 'showConfigurationAsync'
#     CMD_SHOW_CONFIGURATION_CALLBACK = 'showConfigurationCallback'
#     CMD_SHOW_CONFIGURATION_THREAD = 'showConfigurationThread'
#     CMD_UNREGISTER_COMPLETIONS = 'unregisterCompletions'
#     CONFIGURATION_SECTION = 'jsonServer'
#     TOKENS = re.compile('".*"(?=:)')
# class JsonLanguageServer(LanguageServer):
#     def __init__(self):
# def _validate(ls, params):
# def _validate_json(source):
# def completions(params: Optional[CompletionParams] = None) -> CompletionList:
# def count_down_10_seconds_blocking(ls, *args):
# async def count_down_10_seconds_non_blocking(ls, *args):
# def did_change(ls, params: DidChangeTextDocumentParams):
# def did_close(server: JsonLanguageServer, params: DidCloseTextDocumentParams):
# async def did_open(ls, params: DidOpenTextDocumentParams):
# def semantic_tokens(ls: JsonLanguageServer, params: SemanticTokensParams):
# async def progress(ls: JsonLanguageServer, *args):
# async def register_completions(ls: JsonLanguageServer, *args):
# async def show_configuration_async(ls: JsonLanguageServer, *args):
# def show_configuration_callback(ls: JsonLanguageServer, *args):
#     def _config_callback(config):
# def show_configuration_thread(ls: JsonLanguageServer, *args):
# async def unregister_completions(ls: JsonLanguageServer, *args):


# Path: examples/json-extension/server/__main__.py
import argparse
import logging
from .server import json_server


def add_arguments(parser):
    parser.description = "simple json server example"

    parser.add_argument(
        "--tcp", action="store_true",
        help="Use TCP server"
    )
    parser.add_argument(
        "--ws", action="store_true",
        help="Use WebSocket server"
    )
    parser.add_argument(
        "--host", default="127.0.0.1",
        help="Bind to this address"
    )
    parser.add_argument(
        "--port", type=int, default=2087,
        help="Bind to this port"
    )


def main():
    parser = argparse.ArgumentParser()
    add_arguments(parser)
    args = parser.parse_args()

    if args.tcp:
        json_server.start_tcp(args.host, args.port)
    elif args.ws:

        json_server.start_ws(args.host, args.port)