Skip to content

Commit 9217ebd

Browse files
author
Erin van der Veen
authored
Merge pull request #699 from lavigneer/css
Add CSS formatter
2 parents a7fee4d + 1314d2a commit 9217ebd

File tree

16 files changed

+5106
-1
lines changed

16 files changed

+5106
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ This name should be decided amongst the team before the release.
4646

4747
### Added
4848
- [#697](https://github.com/tweag/topiary/pull/697) Setting the log level to INFO now outputs the pattern locations in a (row, column) way.
49+
- [#699](https://github.com/tweag/topiary/pull/699) Added support for CSS, thanks to @lavigneer
4950

5051
## v0.3.0 - Dreamy Dracaena - 2023-09-22
5152

Cargo.lock

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ tokio-test = "0.4"
7575
toml = "0.8"
7676
tree-sitter = "=0.20.10"
7777
tree-sitter-bash = { git = "https://github.com/tree-sitter/tree-sitter-bash", rev = "1b0321ee85701d5036c334a6f04761cdc672e64c" }
78+
tree-sitter-css = { git = "https://github.com/tree-sitter/tree-sitter-css.git", rev = "02b4ee757654b7d54fe35352fd8e53a8a4385d42" }
7879
tree-sitter-json = { git = "https://github.com/tree-sitter/tree-sitter-json.git", rev = "3b129203f4b72d532f58e72c5310c0a7db3b8e6d" }
7980
tree-sitter-nickel = { git = "https://github.com/nickel-lang/tree-sitter-nickel", rev = "58baf89db8fdae54a84bcf22c80ff10ee3f929ed" }
8081
tree-sitter-ocaml = { git = "https://github.com/tree-sitter/tree-sitter-ocaml.git", rev = "9965d208337d88bbf1a38ad0b0fe49e5f5ec9677" }

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ specifying the path to their query files.
104104
* [Rust]
105105
* [Bash]
106106
* [Tree Sitter Queries][tree-sitter-query]
107+
* [CSS]
107108

108109
## Getting Started
109110

@@ -1477,6 +1478,7 @@ of choice open in another.
14771478
[badge-release-link]: https://github.com/tweag/topiary/releases/latest
14781479
[bash]: https://www.gnu.org/software/bash
14791480
[contributing]: CONTRIBUTING.md
1481+
[css]: https://en.wikipedia.org/wiki/CSS
14801482
[difftastic]: https://difftastic.wilfred.me.uk
14811483
[format-all]: https://melpa.org/#/format-all
14821484
[gofmt-slides]: https://go.dev/talks/2015/gofmt-en.slide#1

bin/update-wasm-grammars.sh

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,19 @@ tree-sitter-query() {
123123
echo -e "${GREEN}Query: Done${NC}"
124124
}
125125

126-
(trap 'kill 0' SIGINT; json & nickel & ocaml & ocamllex & bash & rust & toml & tree-sitter-query & wait)
126+
css() {
127+
echo -e "${BLUE}CSS: Fetching${NC}"
128+
git clone --depth=1 https://github.com/tree-sitter/tree-sitter-css.git "${WORKDIR}/tree-sitter-css" &> /dev/null
129+
REV=$(ref_for_language "css")
130+
pushd "${WORKDIR}/tree-sitter-css" &> /dev/null
131+
git checkout "$REV" &> /dev/null
132+
popd &> /dev/null
133+
echo -e "${ORANGE}CSS: Building${NC}"
134+
tree-sitter build-wasm "${WORKDIR}/tree-sitter-css"
135+
echo -e "${GREEN}CSS: Done${NC}"
136+
}
137+
138+
139+
(trap 'kill 0' SIGINT; json & nickel & ocaml & ocamllex & bash & rust & toml & tree-sitter-query & css & wait)
127140

128141
echo -e "${GREEN}Done! All grammars have been updated${NC}"

topiary-cli/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ topiary-queries = { path = "../topiary-queries" }
4444
topiary-tree-sitter-facade = { workspace = true }
4545

4646
tree-sitter-json = { workspace = true }
47+
tree-sitter-css = { workspace = true }
4748
tree-sitter-rust = { workspace = true }
4849
tree-sitter-toml = { workspace = true }
4950
tree-sitter-bash = { workspace = true }

topiary-cli/src/io.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,7 @@ where
324324
{
325325
match name.as_ref() {
326326
"bash" => Ok(topiary_queries::bash().into()),
327+
"css" => Ok(topiary_queries::css().into()),
327328
"json" => Ok(topiary_queries::json().into()),
328329
"nickel" => Ok(topiary_queries::nickel().into()),
329330
"ocaml" => Ok(topiary_queries::ocaml().into()),

0 commit comments

Comments
 (0)