Skip to content

Commit

Permalink
Add support for <script type=“text/babel”> (#932)
Browse files Browse the repository at this point in the history
* Add support for `<script type=“text/babel”>`

* Update changelog
  • Loading branch information
thecrypticace committed Mar 22, 2024
1 parent f7534ae commit 381d70a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { getTextWithoutComments } from './doc'
import { isCssLanguage } from './css'

export type LanguageBoundary = {
type: 'html' | 'js' | 'css' | (string & {});
type: 'html' | 'js' | 'jsx' | 'css' | (string & {});
range: Range
lang?: string
}
Expand All @@ -24,6 +24,11 @@ let htmlScriptTypes = [
'text/x-handlebars-template',
]

let jsxScriptTypes = [
// https://github.com/tailwindlabs/tailwindcss-intellisense/issues/906
'text/babel',
]

let text = { text: { match: /[^]/, lineBreaks: true } }

let states = {
Expand Down Expand Up @@ -190,6 +195,8 @@ export function getLanguageBoundaries(
boundaries[boundaries.length - 1].type = token.text
} else if (token.type === 'type' && htmlScriptTypes.includes(token.text)) {
boundaries[boundaries.length - 1].type = 'html'
} else if (token.type === 'type' && jsxScriptTypes.includes(token.text)) {
boundaries[boundaries.length - 1].type = 'jsx'
}
}
offset += token.text.length
Expand Down
1 change: 1 addition & 0 deletions packages/vscode-tailwindcss/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- Fix crash when class regex matches an empty string (#897)
- Support Astro's `class:list` attribute by default (#890)
- Fix hovers and CSS conflict detection in Vue `<style lang="sass">` blocks (#930)
- Add support for `<script type="text/babel">` (#932)

## 0.10.5

Expand Down

0 comments on commit 381d70a

Please sign in to comment.