Skip to content

Commit

Permalink
🚸 Add --check
Browse files Browse the repository at this point in the history
  • Loading branch information
Freed-Wu committed Feb 14, 2024
1 parent 12a010b commit 9807028
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion src/mutt_language_server/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,18 @@ def get_parser():
default=2,
help="generated json's indent",
)
parser.add_argument(
"--check",
nargs="*",
default={},
help="check file's errors and warnings",
)
parser.add_argument(
"--color",
choices=["auto", "always", "never"],
default="auto",
help="when to display color, default: %(default)s",
)
parser.add_argument(
"--output-format",
choices=["json", "yaml", "toml"],
Expand All @@ -56,8 +68,12 @@ def main() -> None:
r"""Parse arguments and provide shell completions."""
args = get_parser().parse_args()

if args.generate_schema:
if args.generate_schema or args.check:
from tree_sitter_lsp.diagnose import check
from tree_sitter_lsp.utils import pprint
from tree_sitter_muttrc import parser

from .finders import DIAGNOSTICS_FINDER_CLASSES

if args.generate_schema:
from .misc import get_schema
Expand All @@ -68,6 +84,15 @@ def main() -> None:
indent=args.indent,
)
return None
exit(
check(
args.check,
parser.parse,
DIAGNOSTICS_FINDER_CLASSES,
None,
args.color,
)
)

from .server import MuttLanguageServer

Expand Down

0 comments on commit 9807028

Please sign in to comment.