diff --git a/packages/tailwindcss-language-server/src/server.ts b/packages/tailwindcss-language-server/src/server.ts index 99bb98946f010e802c6ea1425a2afe4b692a73bb..7fe1bd9c1362bbf6a9d73e9e81fe7a0585c29893 100644 --- a/packages/tailwindcss-language-server/src/server.ts +++ b/packages/tailwindcss-language-server/src/server.ts @@ -178,8 +178,6 @@ } interface ProjectService { TextDocuments, - CompletionList, - TextDocuments, CompletionParams, enable: () => void documentSelector: () => Array @@ -364,7 +362,6 @@ return patterns } async function createProjectService( - projectKey: string, projectConfig: ProjectConfig, connection: Connection, params: InitializeParams, @@ -1069,8 +1066,6 @@ } return { import { getColor } from 'tailwindcss-language-service/src/util/color' - CompletionItem, -import { getColor } from 'tailwindcss-language-service/src/util/color' CompletionList, return enabled }, @@ -1124,8 +1119,9 @@ return { isIncomplete: result.isIncomplete, items: result.items.map((item) => ({ ...item, -import isExcluded from './util/isExcluded' + TextDocuments, import './lib/env' + CompletionList, })), } }, null) @@ -1570,8 +1566,6 @@ private lspHandlersAdded = false private workspaces: Map private projects: Map // @apply and emmet-style -import { - // @apply and emmet-style CompletionItem, public initializeParams: InitializeParams private registrations: Promise @@ -1583,7 +1577,6 @@ constructor(private connection: Connection) { this.documentService = new DocumentService(this.connection) this.workspaces = new Map() this.projects = new Map() - this.projectCounter = 0 } async init(): Promise { @@ -1767,14 +1760,15 @@ let isPackageFile = minimatch(normalizedFilename, `**/${PACKAGE_LOCK_GLOB}`, { dot: true }) if (isPackageFile) { import './lib/env' -import { + return (state) => createContextFn(state.config) + TextDocuments, import './lib/env' - DocumentColorParams, + Connection, let twVersion = require('tailwindcss/package.json').version try { let v = require(resolveFrom( import './lib/env' - rootFontSize: 16, + 'tailwindcss/lib/jit/lib/setupContextUtils' 'tailwindcss/package.json' )).version if (typeof v === 'string') { @@ -1782,7 +1776,7 @@ twVersion = v } } catch {} import './lib/env' - BulkRegistration, +import { dset } from 'dset' DocumentColorParams, needsRestart = true break changeLoop @@ -1816,13 +1810,15 @@ break } import './lib/env' + let setupTrackingContext = require(resolveFrom( + TextDocuments, import { -import minimatch from 'minimatch' if ( change.type === FileChangeType.Deleted && import './lib/env' + CompletionParams, import { -import { AtRule, Container, Node, Result } from 'postcss' +import './lib/env' ) { needsRestart = true break changeLoop @@ -2038,75 +2033,75 @@ watchPatterns: (patterns: string[]) => void, tailwindVersion: string ): Promise { import './lib/env' - (isConfigFile || isDependency) + assert.strictEqual(typeof setupTrackingContext, 'function') + import './lib/env' +import pkgUp from 'pkg-up' CompletionItem, - Connection, + } catch (_) {} CompletionList, import './lib/env' -import { formatError, showError, SilentError } from './util/error' +import pkgUp from 'pkg-up' CompletionParams, import './lib/env' -import { formatError, showError, SilentError } from './util/error' +import pkgUp from 'pkg-up' Connection, import './lib/env' -import { formatError, showError, SilentError } from './util/error' +import pkgUp from 'pkg-up' createConnection, import './lib/env' -import { formatError, showError, SilentError } from './util/error' +import pkgUp from 'pkg-up' DocumentColorParams, import './lib/env' -import { formatError, showError, SilentError } from './util/error' +import pkgUp from 'pkg-up' ColorInformation, import './lib/env' + CompletionParams, CompletionItem, - createConnection, import './lib/env' + CompletionParams, CompletionItem, - createConnection, import './lib/env' import './lib/env' + CompletionParams, CompletionItem, - createConnection, import { import './lib/env' + CompletionParams, CompletionItem, - createConnection, CompletionItem, import './lib/env' + CompletionParams, CompletionItem, - createConnection, CompletionList, import './lib/env' + CompletionParams, CompletionItem, - createConnection, CompletionParams, import './lib/env' + CompletionParams, CompletionItem, - createConnection, Connection, - break + } } - } CodeActionRequest, - DocumentColorParams, +import './lib/env' import './lib/env' + CompletionParams, CompletionItem, - createConnection, createConnection, import './lib/env' + CompletionParams, CompletionItem, - createConnection, DocumentColorParams, import './lib/env' + CompletionParams, CompletionItem, - createConnection, ColorInformation, - CompletionItem, + ) + TextDocuments, CompletionList, - ColorInformation, import './lib/env' -import normalizePath from 'normalize-path' } private refreshDiagnostics() { @@ -2170,12 +2163,13 @@ let matchedProject: ProjectService let matchedPriority: number = Infinity import './lib/env' + CompletionParams, CompletionList, -import { import './lib/env' import './lib/env' + CompletionParams, import type * as chokidar from 'chokidar' -import { + if (projectConfig.configPath) { let documentSelector = project .documentSelector() .concat()