summaryrefslogtreecommitdiffstats
path: root/scripts/check_client_is_uptodate.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/check_client_is_uptodate.py')
-rw-r--r--scripts/check_client_is_uptodate.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/scripts/check_client_is_uptodate.py b/scripts/check_client_is_uptodate.py
new file mode 100644
index 0000000..1c5b1be
--- /dev/null
+++ b/scripts/check_client_is_uptodate.py
@@ -0,0 +1,20 @@
+import sys
+import subprocess
+
+AUTOGENERATED_CLIENT_FILE = "pygls/lsp/client.py"
+
+subprocess.run(["poe", "generate_client"])
+
+result = subprocess.run(
+ ["git", "diff", "--exit-code", AUTOGENERATED_CLIENT_FILE], stdout=subprocess.DEVNULL
+)
+
+if result.returncode == 0:
+ print("✅ Pygls client is up to date")
+else:
+ print(
+ "🔴 Pygls client not uptodate\n"
+ "1. Generate with: `poetry run poe generate_client`\n"
+ "2. Commit"
+ )
+ sys.exit(result.returncode)