-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
72 lines (60 loc) · 2.23 KB
/
Copy pathMakefile
File metadata and controls
72 lines (60 loc) · 2.23 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# Makefile for LSP Types Generator
.PHONY: help download-schemas generate-lsp-schema generate-types generate-latest-types
# Use bash for shell commands
SHELL := /bin/bash
# Default target
.DEFAULT_GOAL := help
# Suppress echoing of commands
.SILENT:
# All generated files (formatted after generation to keep the tree reproducible)
GENERATED_FILES := \
lsp_types/types.py \
lsp_types/requests.py \
lsp_types/methods.py \
assets/scripts/lsp_schema.py \
lsp_types/pyright/config_schema.py
# Colors for help text
BLUE := \033[36m
NC := \033[0m
help: ## Show this help message
echo -e "Usage: make [target]\n"
echo -e "Targets:"
grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " $(BLUE)%-15s$(NC) %s\n", $$1, $$2}'
download-schemas: ## Download latest LSP schemas (run this before generate-types)
echo "Downloading latest LSP schemas..."
uv run python -m assets.scripts.download_schemas
echo "Done."
generate-lsp-schema:
uv run datamodel-codegen \
--input ./assets/lsprotocol/lsp.schema.json \
--output ./assets/scripts/lsp_schema.py \
--output-model-type "typing.TypedDict" \
--target-python-version "3.12" \
--input-file-type "jsonschema" \
--use-field-description \
--use-schema-description \
--use-double-quotes \
--disable-timestamp \
--formatters black isort
uvx ruff format assets/scripts/lsp_schema.py
generate-pyright-schema:
uv run datamodel-codegen \
--input ./assets/lsps/pyright.schema.json \
--output ./lsp_types/pyright/config_schema.py \
--output-model-type "typing.TypedDict" \
--target-python-version "3.12" \
--input-file-type "jsonschema" \
--use-field-description \
--use-schema-description \
--use-double-quotes \
--disable-timestamp \
--formatters black isort
uvx ruff format lsp_types/pyright/config_schema.py
generate-types: ## Generate LSP type definitions
echo "Generating LSP type definitions..."
uv run python -m assets.scripts.generate
echo "Formatting generated files..."
uvx ruff format $(GENERATED_FILES)
uvx ruff check $(GENERATED_FILES) --fix --silent || true
echo "Done."
generate-latest-types: download-schemas generate-lsp-schema generate-pyright-schema generate-types ## Download latest LSP schemas and generate type definitions