extension_ci: Fix formatting check failing on grammar queries (#56788)

Since we download the grammars into the `./grammars` directory, the
formatting check can fail on unformatted query files that are present in
the grammars directory, as observed in
https://github.com/zed-extensions/log/pull/18

Thus, this PR changes the check to be more specific to just the queries
in the `languages` directory.

Release Notes:

- N/A
This commit is contained in:
Finn Evers authored and GitHub committed 2026-05-14 19:17:01 +00:00
1 parent d10729feaf
commit 86bd5b6ecd
3 files changed
+18 -7

No files matched your search

+1 -1
View File
@@ -149,7 +149,7 @@ jobs:
- name: run_tests::run_ts_query_ls
run: |-
tar -xf "$GITHUB_WORKSPACE/ts_query_ls-x86_64-unknown-linux-gnu.tar.gz" -C "$GITHUB_WORKSPACE"
"$GITHUB_WORKSPACE/ts_query_ls" format --check . || {
"$GITHUB_WORKSPACE/ts_query_ls" format --check languages || {
echo "Found unformatted queries, please format them with ts_query_ls."
echo "For easy use, install the Tree-sitter query extension:"
echo "zed://extension/tree-sitter-query"
@@ -3,7 +3,9 @@ use indoc::indoc;
use crate::tasks::workflows::{
extension_bump::compare_versions,
run_tests::{fetch_ts_query_ls, orchestrate_for_extension, run_ts_query_ls, tests_pass},
run_tests::{
RunContext, fetch_ts_query_ls, orchestrate_for_extension, run_ts_query_ls, tests_pass,
},
runners,
steps::{
self, BASH_SHELL, CommonJobConditions, FluentBuilder, NamedJob,
@@ -146,7 +148,7 @@ pub(crate) fn check_extension() -> NamedJob {
.add_step(cache_rust_dependencies_namespace()) // Extensions can compile Rust, so provide the cache if needed.
.add_step(check())
.add_step(fetch_ts_query_ls())
.add_step(run_ts_query_ls())
.add_step(run_ts_query_ls(RunContext::Extension))
.add_step(check_version_job)
.add_step(verify_version_did_not_change(version_changed));
+13 -4
View File
@@ -391,15 +391,24 @@ pub(crate) fn fetch_ts_query_ls() -> Step<Use> {
.add_with(("file", TS_QUERY_LS_FILE))
}
pub(crate) fn run_ts_query_ls() -> Step<Run> {
pub(crate) enum RunContext {
ZedRepository,
Extension,
}
pub(crate) fn run_ts_query_ls(context: RunContext) -> Step<Run> {
named::bash(formatdoc!(
r#"tar -xf "$GITHUB_WORKSPACE/{TS_QUERY_LS_FILE}" -C "$GITHUB_WORKSPACE"
"$GITHUB_WORKSPACE/ts_query_ls" format --check . || {{
"$GITHUB_WORKSPACE/ts_query_ls" format --check {directory} || {{
echo "Found unformatted queries, please format them with ts_query_ls."
echo "For easy use, install the Tree-sitter query extension:"
echo "zed://extension/tree-sitter-query"
false
}}"#
}}"#,
directory = match context {
RunContext::Extension => "languages",
RunContext::ZedRepository => ".",
}
))
}
@@ -425,7 +434,7 @@ fn check_style() -> NamedJob {
.add_step(steps::script("./script/check-keymaps"))
.add_step(check_for_typos())
.add_step(fetch_ts_query_ls())
.add_step(run_ts_query_ls()),
.add_step(run_ts_query_ls(RunContext::ZedRepository)),
)
}