astro-vscode 2.16.11 → 2.16.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -21,6 +21,7 @@
21
21
  "</html>",
22
22
  ],
23
23
  "description": "Page with full HTML",
24
+ "include": "*.astro",
24
25
  },
25
26
  "page_layout": {
26
27
  "prefix": "page_layout",
@@ -36,6 +37,7 @@
36
37
  "</$1>",
37
38
  ],
38
39
  "description": "Page from Layout",
40
+ "include": "*.astro",
39
41
  },
40
42
  "component": {
41
43
  "prefix": "component",
@@ -43,5 +45,6 @@
43
45
  "scope": "astro",
44
46
  "body": ["---", "$1", "---", "", "$0"],
45
47
  "description": "Component",
48
+ "include": "*.astro",
46
49
  },
47
50
  }
package/package.json CHANGED
@@ -24,7 +24,7 @@
24
24
  "color": "#17191E",
25
25
  "theme": "dark"
26
26
  },
27
- "version": "2.16.11",
27
+ "version": "2.16.13",
28
28
  "author": "withastro",
29
29
  "license": "MIT",
30
30
  "publisher": "astro-build",
@@ -235,7 +235,7 @@
235
235
  ]
236
236
  },
237
237
  "devDependencies": {
238
- "@astrojs/language-server": "^2.16.4",
238
+ "@astrojs/language-server": "^2.16.6",
239
239
  "@astrojs/ts-plugin": "^1.10.7",
240
240
  "@types/mocha": "^10.0.10",
241
241
  "@types/node": "^20.9.0",
@@ -3,7 +3,7 @@
3
3
  "scopeName": "source.astro",
4
4
  "fileTypes": ["astro"],
5
5
  "injections": {
6
- "L:(meta.script.astro) (meta.lang.json) - (meta source)": {
6
+ "L:(meta.script.astro) (meta.lang.json) - (meta.embedded.block source)": {
7
7
  "patterns": [
8
8
  {
9
9
  "begin": "(?<=>)(?!</)",
@@ -18,7 +18,7 @@
18
18
  }
19
19
  ]
20
20
  },
21
- "L:(meta.script.astro) (meta.lang.js | meta.lang.javascript | meta.lang.partytown | meta.lang.node) - (meta source)": {
21
+ "L:(meta.script.astro) (meta.lang.js | meta.lang.javascript | meta.lang.partytown | meta.lang.node) - (meta.embedded.block source)": {
22
22
  "patterns": [
23
23
  {
24
24
  "begin": "(?<=>)(?=[^\\n]+</script[\\s>])",
@@ -44,7 +44,7 @@
44
44
  }
45
45
  ]
46
46
  },
47
- "L:(meta.script.astro) (meta.lang.ts | meta.lang.typescript) - (meta source)": {
47
+ "L:(meta.script.astro) (meta.lang.ts | meta.lang.typescript) - (meta.embedded.block source)": {
48
48
  "patterns": [
49
49
  {
50
50
  "begin": "(?<=>)(?=[^\\n]+</script[\\s>])",
@@ -70,7 +70,7 @@
70
70
  }
71
71
  ]
72
72
  },
73
- "L:meta.script.astro - meta.lang - (meta source)": {
73
+ "L:meta.script.astro - meta.lang - (meta.embedded.block source)": {
74
74
  "patterns": [
75
75
  {
76
76
  "begin": "(?<=>)(?=[^\\n]+</script[\\s>])",
@@ -96,7 +96,7 @@
96
96
  }
97
97
  ]
98
98
  },
99
- "L:meta.style.astro meta.lang.stylus - (meta source)": {
99
+ "L:meta.style.astro meta.lang.stylus - (meta.embedded.block source)": {
100
100
  "patterns": [
101
101
  {
102
102
  "begin": "(?<=>)(?!</)",
@@ -111,7 +111,7 @@
111
111
  }
112
112
  ]
113
113
  },
114
- "L:meta.style.astro meta.lang.sass - (meta source)": {
114
+ "L:meta.style.astro meta.lang.sass - (meta.embedded.block source)": {
115
115
  "patterns": [
116
116
  {
117
117
  "begin": "(?<=>)(?!</)",
@@ -126,7 +126,7 @@
126
126
  }
127
127
  ]
128
128
  },
129
- "L:meta.style.astro meta.lang.css - (meta source)": {
129
+ "L:meta.style.astro meta.lang.css - (meta.embedded.block source)": {
130
130
  "patterns": [
131
131
  {
132
132
  "begin": "(?<=>)(?!</)",
@@ -141,7 +141,7 @@
141
141
  }
142
142
  ]
143
143
  },
144
- "L:meta.style.astro meta.lang.scss - (meta source)": {
144
+ "L:meta.style.astro meta.lang.scss - (meta.embedded.block source)": {
145
145
  "patterns": [
146
146
  {
147
147
  "begin": "(?<=>)(?!</)",
@@ -156,7 +156,7 @@
156
156
  }
157
157
  ]
158
158
  },
159
- "L:meta.style.astro meta.lang.less - (meta source)": {
159
+ "L:meta.style.astro meta.lang.less - (meta.embedded.block source)": {
160
160
  "patterns": [
161
161
  {
162
162
  "begin": "(?<=>)(?!</)",
@@ -171,7 +171,7 @@
171
171
  }
172
172
  ]
173
173
  },
174
- "L:meta.style.astro meta.lang.postcss - (meta source)": {
174
+ "L:meta.style.astro meta.lang.postcss - (meta.embedded.block source)": {
175
175
  "patterns": [
176
176
  {
177
177
  "begin": "(?<=>)(?!</)",
@@ -186,7 +186,7 @@
186
186
  }
187
187
  ]
188
188
  },
189
- "L:meta.style.astro - meta.lang - (meta source)": {
189
+ "L:meta.style.astro - meta.lang - (meta.embedded.block source)": {
190
190
  "patterns": [
191
191
  {
192
192
  "begin": "(?<=>)(?!</)",
@@ -200,6 +200,13 @@
200
200
  ]
201
201
  }
202
202
  ]
203
+ },
204
+ "L:meta.embedded.expression.astro - meta.embedded.block": {
205
+ "patterns": [
206
+ {
207
+ "include": "#tags-lang"
208
+ }
209
+ ]
203
210
  }
204
211
  },
205
212
  "patterns": [
@@ -9,13 +9,13 @@ injections:
9
9
  # ---- EMBEDDED LANGUAGES
10
10
 
11
11
  # Format:
12
- # 'L:meta.<script|style|template>.astro (meta.lang.<lang> | meta.lang.<langalternative> | ...) - (meta source)'
12
+ # 'L:meta.<script|style|template>.astro (meta.lang.<lang> | meta.lang.<langalternative> | ...) - (meta.embedded.block source)'
13
13
  # patterns: [{begin: '(?<=>)(?!</)', end: '(?=</)', name: meta.embedded.block.astro,
14
14
  # contentName: source.<lang>, patterns: [{ include: source.<lang> }]}]
15
15
 
16
16
  # Style/Script Languages
17
17
  # JSON | 'application/ld+json'
18
- 'L:(meta.script.astro) (meta.lang.json) - (meta source)':
18
+ 'L:(meta.script.astro) (meta.lang.json) - (meta.embedded.block source)':
19
19
  patterns:
20
20
  [
21
21
  {
@@ -28,7 +28,7 @@ injections:
28
28
  ]
29
29
 
30
30
  # JavaScript | 'javascript' | 'source.js' | 'partytown'
31
- 'L:(meta.script.astro) (meta.lang.js | meta.lang.javascript | meta.lang.partytown | meta.lang.node) - (meta source)':
31
+ 'L:(meta.script.astro) (meta.lang.js | meta.lang.javascript | meta.lang.partytown | meta.lang.node) - (meta.embedded.block source)':
32
32
  patterns:
33
33
  [
34
34
  {
@@ -48,7 +48,7 @@ injections:
48
48
  ]
49
49
 
50
50
  # TypeScript | 'ts'
51
- 'L:(meta.script.astro) (meta.lang.ts | meta.lang.typescript) - (meta source)':
51
+ 'L:(meta.script.astro) (meta.lang.ts | meta.lang.typescript) - (meta.embedded.block source)':
52
52
  patterns:
53
53
  [
54
54
  {
@@ -69,7 +69,7 @@ injections:
69
69
 
70
70
  # Script Languages
71
71
  # Default (JavaScript)
72
- 'L:meta.script.astro - meta.lang - (meta source)':
72
+ 'L:meta.script.astro - meta.lang - (meta.embedded.block source)':
73
73
  patterns:
74
74
  [
75
75
  {
@@ -92,7 +92,7 @@ injections:
92
92
 
93
93
  # Style Languages
94
94
  # Stylus | 'stylus' | 'source.stylus'
95
- 'L:meta.style.astro meta.lang.stylus - (meta source)':
95
+ 'L:meta.style.astro meta.lang.stylus - (meta.embedded.block source)':
96
96
  patterns:
97
97
  [
98
98
  {
@@ -105,7 +105,7 @@ injections:
105
105
  ]
106
106
 
107
107
  # Sass | 'sass' | 'source.sass'
108
- 'L:meta.style.astro meta.lang.sass - (meta source)':
108
+ 'L:meta.style.astro meta.lang.sass - (meta.embedded.block source)':
109
109
  patterns:
110
110
  [
111
111
  {
@@ -118,7 +118,7 @@ injections:
118
118
  ]
119
119
 
120
120
  # CSS | 'css' | 'source.css'
121
- 'L:meta.style.astro meta.lang.css - (meta source)':
121
+ 'L:meta.style.astro meta.lang.css - (meta.embedded.block source)':
122
122
  patterns:
123
123
  [
124
124
  {
@@ -131,7 +131,7 @@ injections:
131
131
  ]
132
132
 
133
133
  # SCSS | 'scss' | 'source.css.scss'
134
- 'L:meta.style.astro meta.lang.scss - (meta source)':
134
+ 'L:meta.style.astro meta.lang.scss - (meta.embedded.block source)':
135
135
  patterns:
136
136
  [
137
137
  {
@@ -144,7 +144,7 @@ injections:
144
144
  ]
145
145
 
146
146
  # Less | 'less' | 'source.css.less'
147
- 'L:meta.style.astro meta.lang.less - (meta source)':
147
+ 'L:meta.style.astro meta.lang.less - (meta.embedded.block source)':
148
148
  patterns:
149
149
  [
150
150
  {
@@ -157,7 +157,7 @@ injections:
157
157
  ]
158
158
 
159
159
  # PostCSS | 'postcss' | 'source.css.postcss'
160
- 'L:meta.style.astro meta.lang.postcss - (meta source)':
160
+ 'L:meta.style.astro meta.lang.postcss - (meta.embedded.block source)':
161
161
  patterns:
162
162
  [
163
163
  {
@@ -170,7 +170,7 @@ injections:
170
170
  ]
171
171
 
172
172
  # Default (CSS)
173
- 'L:meta.style.astro - meta.lang - (meta source)':
173
+ 'L:meta.style.astro - meta.lang - (meta.embedded.block source)':
174
174
  patterns:
175
175
  [
176
176
  {
@@ -182,6 +182,14 @@ injections:
182
182
  },
183
183
  ]
184
184
 
185
+ # ---- SCRIPT/STYLE INSIDE EXPRESSIONS
186
+ # Inside expressions ({...}), content is scoped as source.tsx. We need to inject
187
+ # script/style tag handling so they get proper language injection instead of being
188
+ # treated as plain JSX elements.
189
+ 'L:meta.embedded.expression.astro - meta.embedded.block':
190
+ patterns:
191
+ - include: '#tags-lang'
192
+
185
193
  # Start of grammar.
186
194
  patterns:
187
195
  - include: '#scope'
@@ -0,0 +1,13 @@
1
+ ---
2
+ const view = 'Gallery';
3
+ ---
4
+
5
+ {view === 'Gallery' ? (
6
+ <script>
7
+ for (let index = 0; index < 10; index++) {
8
+ console.log(index);
9
+ }
10
+ </script>
11
+ ) : null}
12
+
13
+ {view === 'Gallery' && <script>console.log("inline")</script>}
@@ -0,0 +1,42 @@
1
+ >---
2
+ #^^^ source.astro comment
3
+ >const view = 'Gallery';
4
+ #^^^^^^^^^^^^^^^^^^^^^^^^ source.astro meta.embedded.block.astro source.ts
5
+ >---
6
+ #^^^ source.astro comment
7
+ >
8
+ >{view === 'Gallery' ? (
9
+ #^ source.astro punctuation.section.embedded.begin.astro
10
+ # ^^^^^^^^^^^^^^^^^^^^^^^ source.astro meta.embedded.expression.astro source.tsx
11
+ > <script>
12
+ #^^ source.astro meta.embedded.expression.astro source.tsx
13
+ # ^ source.astro meta.embedded.expression.astro source.tsx meta.scope.tag.script.astro meta.script.astro meta.tag.start.astro punctuation.definition.tag.begin.astro
14
+ # ^^^^^^ source.astro meta.embedded.expression.astro source.tsx meta.scope.tag.script.astro meta.script.astro meta.tag.start.astro entity.name.tag.astro
15
+ # ^ source.astro meta.embedded.expression.astro source.tsx meta.scope.tag.script.astro meta.script.astro meta.tag.start.astro punctuation.definition.tag.end.astro
16
+ > for (let index = 0; index < 10; index++) {
17
+ #^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.astro meta.embedded.expression.astro source.tsx meta.scope.tag.script.astro meta.script.astro meta.embedded.block.astro source.js
18
+ > console.log(index);
19
+ #^^^^^^^^^^^^^^^^^^^^^^^^^^ source.astro meta.embedded.expression.astro source.tsx meta.scope.tag.script.astro meta.script.astro meta.embedded.block.astro source.js
20
+ > }
21
+ #^^^^^^ source.astro meta.embedded.expression.astro source.tsx meta.scope.tag.script.astro meta.script.astro meta.embedded.block.astro source.js
22
+ > </script>
23
+ #^^ source.astro meta.embedded.expression.astro source.tsx meta.scope.tag.script.astro meta.script.astro
24
+ # ^^ source.astro meta.embedded.expression.astro source.tsx meta.scope.tag.script.astro meta.script.astro meta.tag.end.astro punctuation.definition.tag.begin.astro
25
+ # ^^^^^^ source.astro meta.embedded.expression.astro source.tsx meta.scope.tag.script.astro meta.script.astro meta.tag.end.astro entity.name.tag.astro
26
+ # ^ source.astro meta.embedded.expression.astro source.tsx meta.scope.tag.script.astro meta.script.astro meta.tag.end.astro punctuation.definition.tag.end.astro
27
+ >) : null}
28
+ #^^^^^^^^ source.astro meta.embedded.expression.astro source.tsx
29
+ # ^ source.astro punctuation.section.embedded.end.astro
30
+ >
31
+ >{view === 'Gallery' && <script>console.log("inline")</script>}
32
+ #^ source.astro punctuation.section.embedded.begin.astro
33
+ # ^^^^^^^^^^^^^^^^^^^^^^ source.astro meta.embedded.expression.astro source.tsx
34
+ # ^ source.astro meta.embedded.expression.astro source.tsx meta.scope.tag.script.astro meta.script.astro meta.tag.start.astro punctuation.definition.tag.begin.astro
35
+ # ^^^^^^ source.astro meta.embedded.expression.astro source.tsx meta.scope.tag.script.astro meta.script.astro meta.tag.start.astro entity.name.tag.astro
36
+ # ^ source.astro meta.embedded.expression.astro source.tsx meta.scope.tag.script.astro meta.script.astro meta.tag.start.astro punctuation.definition.tag.end.astro
37
+ # ^^^^^^^^^^^^^^^^^^^^^ source.astro meta.embedded.expression.astro source.tsx meta.scope.tag.script.astro meta.script.astro meta.embedded.block.astro source.js
38
+ # ^^ source.astro meta.embedded.expression.astro source.tsx meta.scope.tag.script.astro meta.script.astro meta.tag.end.astro punctuation.definition.tag.begin.astro
39
+ # ^^^^^^ source.astro meta.embedded.expression.astro source.tsx meta.scope.tag.script.astro meta.script.astro meta.tag.end.astro entity.name.tag.astro
40
+ # ^ source.astro meta.embedded.expression.astro source.tsx meta.scope.tag.script.astro meta.script.astro meta.tag.end.astro punctuation.definition.tag.end.astro
41
+ # ^ source.astro punctuation.section.embedded.end.astro
42
+ >
@@ -0,0 +1,11 @@
1
+ ---
2
+ const view = 'Gallery';
3
+ ---
4
+
5
+ {view === 'Gallery' ? (
6
+ <style>
7
+ .gallery { display: grid; }
8
+ </style>
9
+ ) : null}
10
+
11
+ {view === 'Gallery' && <style>.inline { color: red; }</style>}
@@ -0,0 +1,38 @@
1
+ >---
2
+ #^^^ source.astro comment
3
+ >const view = 'Gallery';
4
+ #^^^^^^^^^^^^^^^^^^^^^^^^ source.astro meta.embedded.block.astro source.ts
5
+ >---
6
+ #^^^ source.astro comment
7
+ >
8
+ >{view === 'Gallery' ? (
9
+ #^ source.astro punctuation.section.embedded.begin.astro
10
+ # ^^^^^^^^^^^^^^^^^^^^^^^ source.astro meta.embedded.expression.astro source.tsx
11
+ > <style>
12
+ #^^ source.astro meta.embedded.expression.astro source.tsx
13
+ # ^ source.astro meta.embedded.expression.astro source.tsx meta.scope.tag.style.astro meta.style.astro meta.tag.start.astro punctuation.definition.tag.begin.astro
14
+ # ^^^^^ source.astro meta.embedded.expression.astro source.tsx meta.scope.tag.style.astro meta.style.astro meta.tag.start.astro entity.name.tag.astro
15
+ # ^ source.astro meta.embedded.expression.astro source.tsx meta.scope.tag.style.astro meta.style.astro meta.tag.start.astro punctuation.definition.tag.end.astro
16
+ > .gallery { display: grid; }
17
+ #^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.astro meta.embedded.expression.astro source.tsx meta.scope.tag.style.astro meta.style.astro meta.embedded.block.astro source.css
18
+ > </style>
19
+ #^^ source.astro meta.embedded.expression.astro source.tsx meta.scope.tag.style.astro meta.style.astro meta.embedded.block.astro source.css
20
+ # ^^ source.astro meta.embedded.expression.astro source.tsx meta.scope.tag.style.astro meta.style.astro meta.tag.end.astro punctuation.definition.tag.begin.astro
21
+ # ^^^^^ source.astro meta.embedded.expression.astro source.tsx meta.scope.tag.style.astro meta.style.astro meta.tag.end.astro entity.name.tag.astro
22
+ # ^ source.astro meta.embedded.expression.astro source.tsx meta.scope.tag.style.astro meta.style.astro meta.tag.end.astro punctuation.definition.tag.end.astro
23
+ >) : null}
24
+ #^^^^^^^^ source.astro meta.embedded.expression.astro source.tsx
25
+ # ^ source.astro punctuation.section.embedded.end.astro
26
+ >
27
+ >{view === 'Gallery' && <style>.inline { color: red; }</style>}
28
+ #^ source.astro punctuation.section.embedded.begin.astro
29
+ # ^^^^^^^^^^^^^^^^^^^^^^ source.astro meta.embedded.expression.astro source.tsx
30
+ # ^ source.astro meta.embedded.expression.astro source.tsx meta.scope.tag.style.astro meta.style.astro meta.tag.start.astro punctuation.definition.tag.begin.astro
31
+ # ^^^^^ source.astro meta.embedded.expression.astro source.tsx meta.scope.tag.style.astro meta.style.astro meta.tag.start.astro entity.name.tag.astro
32
+ # ^ source.astro meta.embedded.expression.astro source.tsx meta.scope.tag.style.astro meta.style.astro meta.tag.start.astro punctuation.definition.tag.end.astro
33
+ # ^^^^^^^^^^^^^^^^^^^^^^^ source.astro meta.embedded.expression.astro source.tsx meta.scope.tag.style.astro meta.style.astro meta.embedded.block.astro source.css
34
+ # ^^ source.astro meta.embedded.expression.astro source.tsx meta.scope.tag.style.astro meta.style.astro meta.tag.end.astro punctuation.definition.tag.begin.astro
35
+ # ^^^^^ source.astro meta.embedded.expression.astro source.tsx meta.scope.tag.style.astro meta.style.astro meta.tag.end.astro entity.name.tag.astro
36
+ # ^ source.astro meta.embedded.expression.astro source.tsx meta.scope.tag.style.astro meta.style.astro meta.tag.end.astro punctuation.definition.tag.end.astro
37
+ # ^ source.astro punctuation.section.embedded.end.astro
38
+ >