Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for <script type=“text/babel”> #932

Merged
merged 2 commits into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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