Skip to content

Commit 3d57bc6

Browse files
committed
Only show @source not suggestion for newer Tailwind CSS versions
1 parent df7958d commit 3d57bc6

File tree

2 files changed

+19
-11
lines changed

2 files changed

+19
-11
lines changed

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

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1866,16 +1866,18 @@ function provideCssDirectiveCompletions(
18661866
},
18671867
})
18681868

1869-
items.push({
1870-
label: '@source not',
1871-
documentation: {
1872-
kind: 'markdown' as typeof MarkupKind.Markdown,
1873-
value: `Use the \`@source not\` directive to ignore files when scanning.\n\n[Tailwind CSS Documentation](${docsUrl(
1874-
state.version,
1875-
'functions-and-directives/#source',
1876-
)})`,
1877-
},
1878-
})
1869+
if (state.features.includes('source-not')) {
1870+
items.push({
1871+
label: '@source not',
1872+
documentation: {
1873+
kind: 'markdown' as typeof MarkupKind.Markdown,
1874+
value: `Use the \`@source not\` directive to ignore files when scanning.\n\n[Tailwind CSS Documentation](${docsUrl(
1875+
state.version,
1876+
'functions-and-directives/#source',
1877+
)})`,
1878+
},
1879+
})
1880+
}
18791881

18801882
items.push({
18811883
label: '@plugin',

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ export type Feature =
1515
| 'jit'
1616
| 'separator:root'
1717
| 'separator:options'
18+
| 'source-not'
19+
| 'source-inline'
1820

1921
/**
2022
* Determine a list of features that are supported by the given Tailwind CSS version
@@ -39,10 +41,14 @@ export function supportedFeatures(version: string, mod?: unknown): Feature[] {
3941
}
4042

4143
if (isInsidersV4) {
42-
return ['css-at-theme', 'layer:base', 'content-list']
44+
return ['css-at-theme', 'layer:base', 'content-list', 'source-inline', 'source-not']
4345
}
4446

4547
if (!isInsidersV3) {
48+
if (semver.gte(version, '4.1.0')) {
49+
return ['css-at-theme', 'layer:base', 'content-list', 'source-inline', 'source-not']
50+
}
51+
4652
if (semver.gte(version, '4.0.0-alpha.1')) {
4753
return ['css-at-theme', 'layer:base', 'content-list']
4854
}

0 commit comments

Comments
 (0)