Skip to content

Commit 381d70a

Browse files
Add support for <script type=“text/babel”> (#932)
* Add support for `<script type=“text/babel”>` * Update changelog
1 parent f7534ae commit 381d70a

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

packages/tailwindcss-language-service/src/util/getLanguageBoundaries.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { getTextWithoutComments } from './doc'
1010
import { isCssLanguage } from './css'
1111

1212
export type LanguageBoundary = {
13-
type: 'html' | 'js' | 'css' | (string & {});
13+
type: 'html' | 'js' | 'jsx' | 'css' | (string & {});
1414
range: Range
1515
lang?: string
1616
}
@@ -24,6 +24,11 @@ let htmlScriptTypes = [
2424
'text/x-handlebars-template',
2525
]
2626

27+
let jsxScriptTypes = [
28+
// https://github.com/tailwindlabs/tailwindcss-intellisense/issues/906
29+
'text/babel',
30+
]
31+
2732
let text = { text: { match: /[^]/, lineBreaks: true } }
2833

2934
let states = {
@@ -190,6 +195,8 @@ export function getLanguageBoundaries(
190195
boundaries[boundaries.length - 1].type = token.text
191196
} else if (token.type === 'type' && htmlScriptTypes.includes(token.text)) {
192197
boundaries[boundaries.length - 1].type = 'html'
198+
} else if (token.type === 'type' && jsxScriptTypes.includes(token.text)) {
199+
boundaries[boundaries.length - 1].type = 'jsx'
193200
}
194201
}
195202
offset += token.text.length

packages/vscode-tailwindcss/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- Fix crash when class regex matches an empty string (#897)
66
- Support Astro's `class:list` attribute by default (#890)
77
- Fix hovers and CSS conflict detection in Vue `<style lang="sass">` blocks (#930)
8+
- Add support for `<script type="text/babel">` (#932)
89

910
## 0.10.5
1011

0 commit comments

Comments
 (0)