Skip to content

Commit df7958d

Browse files
committed
Add features to state
1 parent 4377591 commit df7958d

File tree

2 files changed

+7
-1
lines changed
  • packages

2 files changed

+7
-1
lines changed

packages/tailwindcss-language-server/src/projects.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ export async function createProjectService(
216216

217217
let state: State = {
218218
enabled: false,
219+
features: [],
219220
completionItemData: {
220221
_projectKey: projectKey,
221222
},
@@ -466,6 +467,7 @@ export async function createProjectService(
466467
// and this should be determined there and passed in instead
467468
let features = supportedFeatures(tailwindcssVersion, tailwindcss)
468469
log(`supported features: ${JSON.stringify(features)}`)
470+
state.features = features
469471

470472
if (!features.includes('css-at-theme')) {
471473
tailwindcss = tailwindcss.default ?? tailwindcss
@@ -692,6 +694,7 @@ export async function createProjectService(
692694
state.v4 = true
693695
state.v4Fallback = true
694696
state.jit = true
697+
state.features = features
695698
state.modules = {
696699
tailwindcss: { version: tailwindcssVersion, module: tailwindcss },
697700
postcss: { version: null, module: null },
@@ -1154,7 +1157,7 @@ export async function createProjectService(
11541157
},
11551158
tryInit,
11561159
async dispose() {
1157-
state = { enabled: false }
1160+
state = { enabled: false, features: [] }
11581161
for (let disposable of disposables) {
11591162
;(await disposable).dispose()
11601163
}

packages/tailwindcss-language-service/src/util/state.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import type { Postcss } from 'postcss'
44
import type { KeywordColor } from './color'
55
import type * as culori from 'culori'
66
import type { DesignSystem } from './v4'
7+
import type { Feature } from '../features'
78

89
export type ClassNamesTree = {
910
[key: string]: ClassNamesTree
@@ -142,6 +143,7 @@ export interface State {
142143
classListContainsMetadata?: boolean
143144
pluginVersions?: string
144145
completionItemData?: Record<string, any>
146+
features: Feature[]
145147
// postcssPlugins?: { before: any[]; after: any[] }
146148
}
147149

@@ -223,6 +225,7 @@ export function createState(
223225
): State {
224226
return {
225227
enabled: true,
228+
features: [],
226229
...partial,
227230
editor: {
228231
get connection(): Connection {

0 commit comments

Comments
 (0)