File: __init__.py

package info (click to toggle)
fortran-language-server 3.2.2%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,268 kB
  • sloc: python: 9,688; f90: 1,195; fortran: 30; makefile: 28; ansic: 20
file content (43 lines) | stat: -rw-r--r-- 976 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
from __future__ import annotations

import sys
from multiprocessing import freeze_support

from .debug import (
    DebugError,
    debug_lsp,
    debug_parser,
    debug_preprocessor,
    is_debug_mode,
)
from .interface import cli
from .jsonrpc import JSONRPC2Connection, ReadWriter
from .langserver import LangServer
from .version import __version__

__all__ = ["__version__"]


def main():
    freeze_support()
    args = cli(__name__).parse_args()

    try:
        if args.debug_parser:
            debug_parser(args)

        elif args.debug_preproc:
            debug_preprocessor(args)

        elif is_debug_mode(args):
            debug_lsp(args, vars(args))

        else:
            stdin, stdout = sys.stdin.buffer, sys.stdout.buffer
            LangServer(
                conn=JSONRPC2Connection(ReadWriter(stdin, stdout)),
                settings=vars(args),
            ).run()
    except DebugError as e:
        print(f"ERROR: {e}")
        sys.exit(-1)