Skip to content

Commit 5a021ad

Browse files
committed
Only enable @source inline code lenses on Tailwind CSS v4.1
1 parent 58d3b61 commit 5a021ad

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

packages/tailwindcss-language-server/tests/code-lens/source-inline.test.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ defineTest({
1010
`,
1111
},
1212
prepare: async ({ root }) => ({
13-
client: await createClient({ root }),
13+
client: await createClient({
14+
root,
15+
features: ['source-inline'],
16+
}),
1417
}),
1518
handle: async ({ client }) => {
1619
let document = await client.open({
@@ -46,7 +49,10 @@ defineTest({
4649
`,
4750
},
4851
prepare: async ({ root }) => ({
49-
client: await createClient({ root }),
52+
client: await createClient({
53+
root,
54+
features: ['source-inline'],
55+
}),
5056
}),
5157
handle: async ({ client }) => {
5258
let document = await client.open({

packages/tailwindcss-language-service/src/codeLensProvider.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ export async function getCodeLens(state: State, doc: TextDocument): Promise<Code
2020

2121
const SOURCE_INLINE_PATTERN = /@source(?:\s+not)?\s*inline\((?<glob>'[^']+'|"[^"]+")/dg
2222
async function sourceInlineCodeLens(state: State, doc: TextDocument): Promise<CodeLens[]> {
23+
if (!state.features.includes('source-inline')) return []
24+
2325
let text = doc.getText()
2426

2527
let countFormatter = new Intl.NumberFormat('en', {

0 commit comments

Comments
 (0)