Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ keywords = [
requires-python = ">=3.12"
dependencies = [
"pygls>=1.1.0",
"lsprotocol>=2023.0.0",
"lsprotocol>=2025.0.0",
"jsonschema>=4.23.0",
"pyyaml>=6.0.2",
"referencing>=0.36.2",
Expand All @@ -39,18 +39,18 @@ Releases = "https://github.com/batalex/craft-ls/releases"

[dependency-groups]
fmt = [
"ruff >=0.8.0,<0.9.0",
"ruff >=0.14.0,<0.15.0",
]
lint = [
"ruff >=0.8.0,<0.9.0",
"ruff >=0.14.0,<0.15.0",
"mypy >= 1.14.0",
"types-pyyaml",
"types-jsonschema",
]
unit = [
"hypothesis>=6.127.3",
"pytest>=8.3.4",
"pytest-lsp>=0.4.3",
"pytest>=9.0.0",
"pytest-lsp>=1.0.0",
]

[project.scripts]
Expand Down Expand Up @@ -103,6 +103,6 @@ ignore_missing_imports = true
[tool.pyright]
enableReachabilityAnalysis = false # unreliable

[tool.pytest.ini_options]
[tool.pytest]
log_cli_level = "INFO"
asyncio_mode = "auto"
10 changes: 6 additions & 4 deletions src/craft_ls/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@

from lsprotocol import types as lsp

from craft_ls.core import get_diagnostics, get_validator_and_scan
from craft_ls.core import get_diagnostics, get_validator_and_parse, segmentize_nodes
from craft_ls.types_ import ParsedResult

logging.basicConfig()

Expand All @@ -19,13 +20,14 @@ def check(file_name: str) -> None:
file = Path(file_name)

diagnostics: list[lsp.Diagnostic] = []
match get_validator_and_scan(file.stem, file.read_text()):
match get_validator_and_parse(file.stem, file.read_text()):
case None:
print(f"Cannot validate '{file}'", file=sys.stderr)
pass

case validator, scan_result:
diagnostics.extend(get_diagnostics(validator, scan_result))
case validator, ParsedResult(instance=instance, nodes=nodes):
segments = segmentize_nodes(nodes)
diagnostics.extend(get_diagnostics(validator, instance, dict(segments)))

if diagnostics:
for diag in diagnostics:
Expand Down
Loading
Loading