-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #159 from ember-tooling/sync-injections-with-nvim-…
…treesitter Sync injections with nvim treesitter
- Loading branch information
Showing
7 changed files
with
623 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: Linting | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- master | ||
- main | ||
|
||
concurrency: | ||
group: ${{github.workflow}}-${{github.ref}} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
js: | ||
name: "JavaScript" | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
- run: npm install | ||
- run: npm exec prettier --check . | ||
|
||
format-queries: | ||
name: Queries | ||
runs-on: ubuntu-latest | ||
env: | ||
NVIM_TAG: nightly | ||
# NVIM_TAG: stable | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Prepare | ||
run: | | ||
bash ./scripts/ci-install.sh | ||
- name: Lint | ||
run: | | ||
nvim --version | ||
nvim --headless -c "TSInstallSync query" -c "q" | ||
nvim -l scripts/format-queries.lua | ||
git diff --exit-code |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
[ | ||
(element_node (element_node_start)) | ||
(block_statement) | ||
(element_node | ||
(element_node_start)) | ||
(block_statement) | ||
] @fold |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,34 @@ | ||
[ | ||
(element_node (element_node_start)) | ||
(element_node | ||
(element_node_start)) | ||
(element_node_void) | ||
(block_statement (block_statement_start)) | ||
(block_statement | ||
(block_statement_start)) | ||
(mustache_statement) | ||
] @indent.begin | ||
|
||
(element_node (element_node_end [">"] @indent.end)) | ||
(element_node_void "/>" @indent.end) | ||
(element_node | ||
(element_node_end | ||
">" @indent.end)) | ||
|
||
(element_node_void | ||
"/>" @indent.end) | ||
|
||
[ | ||
">" | ||
"/>" | ||
"</" | ||
">" | ||
"/>" | ||
"</" | ||
"{{/" | ||
"}}" | ||
] @indent.branch | ||
] @indent.branch | ||
|
||
(mustache_statement | ||
(helper_invocation helper: (identifier) @_identifier (#lua-match? @_identifier "else")) | ||
) @indent.branch | ||
(mustache_statement ((identifier) @_identifier (#lua-match? @_identifier "else"))) @indent.branch | ||
(helper_invocation | ||
helper: (identifier) @_identifier | ||
(#eq? @_identifier "else"))) @indent.branch | ||
|
||
(mustache_statement | ||
((identifier) @_identifier | ||
(#eq? @_identifier "else"))) @indent.branch | ||
|
||
(comment_statement) @indent.ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,21 @@ | ||
; comments | ||
((comment_statement) @injection.content | ||
(#set! injection.language "comment")) | ||
(#set! injection.language "comment")) | ||
|
||
; <style> tags | ||
((element_node | ||
(element_node_start | ||
(tag_name) @_tag_name | ||
(#eq? @_tag_name "style") | ||
) | ||
) | ||
@injection.content | ||
(#eq? @_tag_name "style"))) @injection.content | ||
(#offset! @injection.content 0 7 0 -8) | ||
(#set! injection.language "css") | ||
(#set! injection.include-children) | ||
) | ||
(#set! injection.include-children)) | ||
|
||
; <script> tags | ||
((element_node | ||
(element_node_start | ||
(tag_name) @_tag_name | ||
(#eq? @_tag_name "script") | ||
) | ||
) | ||
@injection.content | ||
(#eq? @_tag_name "script"))) @injection.content | ||
(#offset! @injection.content 0 8 0 -9) | ||
(#set! injection.language "glimmer_javascript") | ||
(#set! injection.include-children) | ||
) | ||
(#set! injection.include-children)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
mkdir -p /tmp/ci-linting/ | ||
cd /tmp/ci-linting/ | ||
git clone https://github.com/nvim-treesitter/nvim-treesitter.git | ||
cd nvim-treesitter | ||
|
||
os=$(uname -s) | ||
if [[ $os == Linux ]]; then | ||
wget https://github.com/neovim/neovim/releases/download/${NVIM_TAG}/nvim-linux64.tar.gz | ||
tar -zxf nvim-linux64.tar.gz | ||
sudo ln -s "$PWD"/nvim-linux64/bin/nvim /usr/local/bin | ||
rm -rf "$PWD"/nvim-linux64/lib/nvim/parser | ||
mkdir -p ~/.local/share/nvim/site/pack/nvim-treesitter/start | ||
ln -s "$PWD" ~/.local/share/nvim/site/pack/nvim-treesitter/start | ||
elif [[ $os == Darwin ]]; then | ||
RELEASE_NAME="nvim-macos-$(uname -m)" | ||
curl -L "https://github.com/neovim/neovim/releases/download/${NVIM_TAG}/$RELEASE_NAME.tar.gz" | tar -xz | ||
sudo ln -s "$PWD/$RELEASE_NAME/bin/nvim" /usr/local/bin | ||
rm -rf "$PWD/$RELEASE_NAME/lib/nvim/parser" | ||
mkdir -p ~/.local/share/nvim/site/pack/nvim-treesitter/start | ||
ln -s "$PWD" ~/.local/share/nvim/site/pack/nvim-treesitter/start | ||
else | ||
curl -L https://github.com/neovim/neovim/releases/download/${NVIM_TAG}/nvim-win64.zip -o nvim-win64.zip | ||
unzip nvim-win64 | ||
mkdir -p ~/AppData/Local/nvim/pack/nvim-treesitter/start | ||
mkdir -p ~/AppData/Local/nvim-data | ||
cp -r "$PWD" ~/AppData/Local/nvim/pack/nvim-treesitter/start | ||
fi |
Oops, something went wrong.