Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

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

Finn Eversb058edab1808
diff --git a/.github/workflows/extension_tests.yml b/.github/workflows/extension_tests.yml
index 622f4c8f103..4003f41c273 100644
--- a/.github/workflows/extension_tests.yml
+++ b/.github/workflows/extension_tests.yml
@@ -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"
diff --git a/tooling/xtask/src/tasks/workflows/extension_tests.rs b/tooling/xtask/src/tasks/workflows/extension_tests.rs
index a83a0ab9a2a..56aeb677eac 100644
--- a/tooling/xtask/src/tasks/workflows/extension_tests.rs
+++ b/tooling/xtask/src/tasks/workflows/extension_tests.rs
@@ -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));
diff --git a/tooling/xtask/src/tasks/workflows/run_tests.rs b/tooling/xtask/src/tasks/workflows/run_tests.rs
index 0bbff446a75..b0eac45847a 100644
--- a/tooling/xtask/src/tasks/workflows/run_tests.rs
+++ b/tooling/xtask/src/tasks/workflows/run_tests.rs
@@ -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)),
)
}