Skip to content

Commit 7d348f5

Browse files
Kasper Kondzielskighostbuster91
Kasper Kondzielski
andauthored
fix: Incorrect string interpolation highlighting group (#196)
* fix: Incorrect string interpolation highlighting group Co-authored-by: ghostbuster91 <[email protected]>
1 parent 6f9bc5a commit 7d348f5

File tree

7 files changed

+52
-13
lines changed

7 files changed

+52
-13
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,22 +98,22 @@ jobs:
9898
DOTTY_DIR: dotty
9999
run: script/smoke_test.sh
100100

101-
- name: copy nvim-treesitter highlight queries
101+
- name: copy nvim-treesitter queries
102102
if: ${{ runner.os == 'Linux' }}
103103
shell: bash
104-
run: cp ./nvim_treesitter/queries/scala/highlights.scm ./queries/scala/highlights.scm
104+
run: cp ./nvim_treesitter/queries/scala/*.scm ./queries/
105105

106-
- name: Check if highlight queries are out of sync with nvim-treesitter
106+
- name: Check if queries are out of sync with nvim-treesitter
107107
if: ${{ runner.os == 'Linux' }}
108108
uses: tj-actions/verify-changed-files@v13
109109
id: verify-changed-files
110110
with:
111111
files: |
112-
queries/scala/highlights.scm
112+
queries/scala/*.scm
113113

114114
- name: Test quries if out of sync with nvim-treesitter
115115
if: steps.verify-changed-files.outputs.files_changed == 'true'
116116
run: |
117-
echo "::warning file=queries/scala/highlights.scm::Queries in this repo are out of sync with nvim-treesitter"
118-
git diff queries/scala/highlights.scm
117+
echo "::warning Queries in ${{ steps.verify-changed-files.outputs.changed_files }} in this repo are out of sync with nvim-treesitter"
118+
git diff queries/scala/
119119
npm run test

bindings/rust/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ pub const NODE_TYPES: &'static str = include_str!("../../src/node-types.json");
3737

3838
pub const HIGHLIGHTS_QUERY: &'static str = include_str!("../../queries/scala/highlights.scm");
3939
// pub const INJECTIONS_QUERY: &'static str = include_str!("../../queries/injections.scm");
40-
// pub const LOCALS_QUERY: &'static str = include_str!("../../queries/locals.scm");
40+
pub const LOCALS_QUERY: &'static str = include_str!("../../queries/scala/locals.scm");
4141
// pub const TAGS_QUERY: &'static str = include_str!("../../queries/tags.scm");
4242

4343
#[cfg(test)]

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
"file-types": [
2626
"scala"
2727
],
28-
"highlights": "queries/scala/highlights.scm"
28+
"highlights": "queries/scala/highlights.scm",
29+
"locals": "queries/scala/locals.scm"
2930
}
3031
]
3132
}

queries/scala/highlights.scm

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@
2323
(class_parameter
2424
name: (identifier) @parameter)
2525

26-
(interpolation) @none
26+
(self_type (identifier) @parameter)
27+
28+
(interpolation (identifier) @none)
29+
(interpolation (block) @none)
2730

2831
;; types
2932

queries/scala/locals.scm

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
(template_body) @local.scope
2+
(lambda_expression) @local.scope
3+
4+
5+
(function_declaration
6+
name: (identifier) @local.definition) @local.scope
7+
8+
(function_definition
9+
name: (identifier) @local.definition)
10+
11+
(parameter
12+
name: (identifier) @local.definition)
13+
14+
(binding
15+
name: (identifier) @local.definition)
16+
17+
(val_definition
18+
pattern: (identifier) @local.definition)
19+
20+
(var_definition
21+
pattern: (identifier) @local.definition)
22+
23+
(val_declaration
24+
name: (identifier) @local.definition)
25+
26+
(var_declaration
27+
name: (identifier) @local.definition)
28+
29+
(identifier) @local.reference

test/highlight/basics.scala

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ object Hello {
5757
// ^ keyword
5858
// ^ type
5959
self: X =>
60-
// ^type
60+
// ^parameter
6161
// ^type
6262
}
6363

@@ -70,8 +70,14 @@ object Hello {
7070
// ^keyword
7171
// ^type.definition
7272

73-
val hello = c"some $stuff"
73+
val hello = c"some $mutation ${1}"
7474
// ^function.call
7575
// ^punctuation.special
76+
// ^variable
77+
// ^number
78+
def meth = ???
79+
// ^method
80+
val hello2 = c"some $meth"
81+
// ^method
7682
}
7783

test/highlight/scala3.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,9 @@ class Copier:
141141

142142
export scanUnit.scan
143143
// ^ include
144-
// ^namespace
144+
// ^variable
145145
export printUnit.{status as _, *}
146146
// ^ include
147-
// ^namespace
147+
// ^variable
148148

149149
def status: List[String] = printUnit.status ++ scanUnit.status

0 commit comments

Comments
 (0)