From d5ef249335e17a1f2e22502545289bef9c79e91e Mon Sep 17 00:00:00 2001 From: Jordan Pittman Date: Thu, 6 Feb 2025 09:56:56 -0500 Subject: [PATCH 1/3] =?UTF-8?q?Treat=20``=20as=20a=20JSX=20block?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/util/getLanguageBoundaries.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/tailwindcss-language-service/src/util/getLanguageBoundaries.ts b/packages/tailwindcss-language-service/src/util/getLanguageBoundaries.ts index 5aec503a..42a4a495 100644 --- a/packages/tailwindcss-language-service/src/util/getLanguageBoundaries.ts +++ b/packages/tailwindcss-language-service/src/util/getLanguageBoundaries.ts @@ -197,6 +197,14 @@ export function getLanguageBoundaries( boundaries.push({ type: defaultType, range: { start: position, end: undefined } }) } else if (token.type === 'lang') { boundaries[boundaries.length - 1].type = token.text + + if (token.text === 'tsx') { + boundaries[boundaries.length - 1].type = 'jsx' + boundaries[boundaries.length - 1].lang = 'tsx' + } else if (token.text === 'ts') { + boundaries[boundaries.length - 1].type = 'js' + boundaries[boundaries.length - 1].lang = 'ts' + } } else if (token.type === 'type' && htmlScriptTypes.includes(token.text)) { boundaries[boundaries.length - 1].type = 'html' } else if (token.type === 'type' && jsxScriptTypes.includes(token.text)) { From afe167ad5c995c152dbd98507d490c69f6b99fb3 Mon Sep 17 00:00:00 2001 From: Jordan Pittman Date: Thu, 6 Feb 2025 09:58:05 -0500 Subject: [PATCH 2/3] Update changelog --- packages/vscode-tailwindcss/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/vscode-tailwindcss/CHANGELOG.md b/packages/vscode-tailwindcss/CHANGELOG.md index 090cb831..30a5cbf4 100644 --- a/packages/vscode-tailwindcss/CHANGELOG.md +++ b/packages/vscode-tailwindcss/CHANGELOG.md @@ -3,6 +3,7 @@ ## Prerelease - Ensure hover information for `theme(…)` and other functions are shown when used in `@media` queries ([#1172](https://github.com/tailwindlabs/tailwindcss-intellisense/pull/1172)) +- Treat ` + `, + }) + + let hover = await c.sendRequest(HoverRequest.type, { + textDocument: document, + + // return
+ // ^ + position: { line: 2, character: 24 }, + }) + + expect(hover).toEqual({ + contents: { + language: 'css', + value: dedent` + .bg-black { + background-color: var(--color-black) /* #000 = #000000 */; + } + `, + }, + range: { + start: { line: 2, character: 23 }, + end: { line: 2, character: 31 }, + }, + }) + }, +})