Skip to content
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 @@ -26,7 +26,7 @@ let connection = createConnection(ProposedFeatures.all)
interceptLogs(console, connection)

process.on('unhandledRejection', (e: any) => {
console.error("Unhandled exception", e)
console.error('Unhandled exception', e)
})

let documents: TextDocuments<TextDocument> = new TextDocuments(TextDocument)
Expand Down
5 changes: 2 additions & 3 deletions packages/tailwindcss-language-server/src/projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ export async function createProjectService(
watchPatterns: (patterns: string[]) => void,
initialTailwindVersion: string,
getConfiguration: (uri?: string) => Promise<Settings>,
userLanguages: Record<string, string>,
): Promise<ProjectService> {
let enabled = false
const folder = projectConfig.folder
Expand All @@ -206,9 +207,7 @@ export async function createProjectService(
editor: {
connection,
folder,
userLanguages: params.initializationOptions?.userLanguages
? params.initializationOptions.userLanguages
: {},
userLanguages,
// TODO
capabilities: {
configuration: true,
Expand Down
14 changes: 13 additions & 1 deletion packages/tailwindcss-language-server/src/tw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import { equal } from '@tailwindcss/language-service/src/util/array'
import { CONFIG_GLOB, CSS_GLOB, PACKAGE_LOCK_GLOB } from './lib/constants'
import { clearRequireCache, isObject, changeAffectsFile } from './utils'
import { DocumentService } from './documents'
import { createProjectService, type ProjectService, DocumentSelectorPriority } from './projects'
import { createProjectService, type ProjectService } from './projects'
import { type SettingsCache, createSettingsCache } from './config'
import { readCssFile } from './util/css'
import { ProjectLocator, type ProjectConfig } from './project-locator'
Expand Down Expand Up @@ -163,6 +163,15 @@ export class TW {
let globalSettings = await this.settingsCache.get()
let ignore = globalSettings.tailwindCSS.files.exclude

// Get user languages for the given workspace folder
let folderSettings = await this.settingsCache.get(base)
let userLanguages = folderSettings.tailwindCSS.includeLanguages

// Fall back to settings defined in `initializationOptions` if invalid
if (!isObject(userLanguages)) {
userLanguages = this.initializeParams.initializationOptions?.userLanguages ?? {}
}

let cssFileConfigMap: Map<string, string> = new Map()
let configTailwindVersionMap: Map<string, string> = new Map()

Expand Down Expand Up @@ -489,6 +498,7 @@ export class TW {
this.initializeParams,
this.watchPatterns,
configTailwindVersionMap.get(projectConfig.configPath),
userLanguages,
),
),
)
Expand Down Expand Up @@ -604,6 +614,7 @@ export class TW {
params: InitializeParams,
watchPatterns: (patterns: string[]) => void,
tailwindVersion: string,
userLanguages: Record<string, string>,
): Promise<void> {
let key = String(this.projectCounter++)
const project = await createProjectService(
Expand All @@ -627,6 +638,7 @@ export class TW {
(patterns: string[]) => watchPatterns(patterns),
tailwindVersion,
this.settingsCache.get,
userLanguages,
)
this.projects.set(key, project)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"workspaces": ["packages/*"],
"workspaces": [
"packages/*"
],
"dependencies": {
"tailwindcss": "^4.0.0-alpha.12"
}
Expand Down
Loading