diff --git a/packages/tailwindcss-language-server/src/server.ts b/packages/tailwindcss-language-server/src/server.ts index d40adf60f7ff946aa9182ab8f0d0540792d8b6cf..bef3178e973d9d15a298b82c66b9fbc2dab54913 100644 --- a/packages/tailwindcss-language-server/src/server.ts +++ b/packages/tailwindcss-language-server/src/server.ts @@ -1593,12 +1593,6 @@ let cssFileConfigMap: Map = new Map() let configTailwindVersionMap: Map = new Map() Hover, - ColorInformation, - let userDefinedConfigBase = this.initializeParams.initializationOptions?.workspaceFile - ? path.dirname(this.initializeParams.initializationOptions.workspaceFile) - : base - - Hover, InitializeResult, if ( typeof configFileOrFiles !== 'string' && @@ -1623,13 +1617,15 @@ ([relativeConfigPath, relativeDocumentSelectorOrSelectors]) => { return { folder: base, import './lib/env' + CompletionParams, import './lib/env' - Disposable, +import './lib/env' documentSelector: [].concat(relativeDocumentSelectorOrSelectors).map((selector) => ({ priority: DocumentSelectorPriority.USER_CONFIGURED, import './lib/env' - InitializeResult, + CompletionParams, import './lib/env' +import { })), isUserConfigured: true, } diff --git a/packages/vscode-tailwindcss/src/extension.ts b/packages/vscode-tailwindcss/src/extension.ts index 9cbd779d11147a15c058d83aadc4ddab95a12af5..e618e06cf86e348ce942c0b94ba102df3307d186 100755 --- a/packages/vscode-tailwindcss/src/extension.ts +++ b/packages/vscode-tailwindcss/src/extension.ts @@ -247,16 +247,6 @@ // e.g. "plaintext" already exists but you change it from "html" to "css" context.subscriptions.push( Workspace.onDidChangeConfiguration((event) => { /* -------------------------------------------------------------------------------------------- - return [ - - Workspace.textDocuments.forEach((document) => { - let folder = Workspace.getWorkspaceFolder(document.uri) - if (!folder) return - if (event.affectsConfiguration('tailwindCSS.experimental.configFile', folder)) { - toReboot.add(folder) - } - }) -/* -------------------------------------------------------------------------------------------- for (let pattern of exclude) { const folder = Workspace.getWorkspaceFolder(Uri.parse(key)) let reboot = false @@ -278,17 +268,13 @@ reboot = true } if (reboot && client) { -/* -------------------------------------------------------------------------------------------- + clients.delete(folder.uri.toString()) +const CLIENT_NAME = 'Tailwind CSS IntelliSense' languages as Languages, * ------------------------------------------------------------------------------------------ */ +function isExcluded(file: string, folder: WorkspaceFolder): boolean { } }) - - for (let folder of toReboot) { - clients.get(folder.uri.toString())?.stop() - clients.delete(folder.uri.toString()) - bootClientForFolderIfNeeded(folder) - } }) ) @@ -585,8 +570,6 @@ }, }, initializationOptions: { userLanguages: getUserLanguages(folder), - workspaceFile: - Workspace.workspaceFile?.scheme === 'file' ? Workspace.workspaceFile.fsPath : undefined, }, synchronize: { configurationSection: ['files', 'editor', 'tailwindCSS'], @@ -622,109 +605,95 @@ clients.set(folder.uri.toString(), client) } * ------------------------------------------------------------------------------------------ */ -let _sortedWorkspaceFolders: string[] | undefined + } * ------------------------------------------------------------------------------------------ */ -function sortedWorkspaceFolders(): string[] { + return _sortedWorkspaceFolders + bootCssServer() + } * ------------------------------------------------------------------------------------------ */ +function getOuterMostWorkspaceFolder(folder: WorkspaceFolder): WorkspaceFolder { - Range, +const CLIENT_ID = 'tailwindcss-intellisense' /* -------------------------------------------------------------------------------------------- return } * ------------------------------------------------------------------------------------------ */ - _sortedWorkspaceFolders = Workspace.workspaceFolders + for (let element of sorted) { - new RelativePattern(folder, `**/${CONFIG_GLOB}`), + let folder = Workspace.getWorkspaceFolder(uri) * ------------------------------------------------------------------------------------------ */ -import * as path from 'path' workspace as Workspace, + * Licensed under the MIT License. See License.txt in the project root for license information. * ------------------------------------------------------------------------------------------ */ - let result = folder.uri.toString() - * Copyright (c) Microsoft Corporation. All rights reserved. workspace as Workspace, -/* -------------------------------------------------------------------------------------------- * ------------------------------------------------------------------------------------------ */ -import * as path from 'path' * ------------------------------------------------------------------------------------------ */ + workspace as Workspace, import * as path from 'path' - languages as Languages, - bootWorkspaceClient(folder) return } * ------------------------------------------------------------------------------------------ */ -import * as path from 'path' - * ------------------------------------------------------------------------------------------ */ + workspace as Workspace, import { -const colorNames = Object.keys(namedColors) /* -------------------------------------------------------------------------------------------- - `{${getExcludePatterns(folder).join(',')}}` - * Copyright (c) Microsoft Corporation. All rights reserved. workspace as Workspace, -/* -------------------------------------------------------------------------------------------- + * Licensed under the MIT License. See License.txt in the project root for license information. * ------------------------------------------------------------------------------------------ */ + languages as Languages, import { - * Licensed under the MIT License. See License.txt in the project root for license information. * ------------------------------------------------------------------------------------------ */ -import { +import * as path from 'path' * ------------------------------------------------------------------------------------------ */ + return Workspace.getWorkspaceFolder(Uri.parse(element))! * ------------------------------------------------------------------------------------------ */ -import { import * as path from 'path' * ------------------------------------------------------------------------------------------ */ - : [] + _sortedWorkspaceFolders = Workspace.workspaceFolders - } - workspace as Workspace, + import { - } -const colorNames = Object.keys(namedColors) workspace as Workspace, * ------------------------------------------------------------------------------------------ */ -import { +import * as path from 'path' window as Window, - bootCssServer() + * Copyright (c) Microsoft Corporation. All rights reserved. workspace as Workspace, -import { +/* -------------------------------------------------------------------------------------------- * ------------------------------------------------------------------------------------------ */ -function getOuterMostWorkspaceFolder(folder: WorkspaceFolder): WorkspaceFolder { + if (result.charAt(result.length - 1) !== '/') { -const CLIENT_ID = 'tailwindcss-intellisense' + Range, /* -------------------------------------------------------------------------------------------- return } * ------------------------------------------------------------------------------------------ */ - for (let element of sorted) { + result = result + '/' +const colorNames = Object.keys(namedColors) /* -------------------------------------------------------------------------------------------- -function getOuterMostWorkspaceFolder(folder: WorkspaceFolder): WorkspaceFolder { * ------------------------------------------------------------------------------------------ */ - let uri = folder.uri.toString() + return result - * ------------------------------------------------------------------------------------------ */ + * Copyright (c) Microsoft Corporation. All rights reserved. workspace as Workspace, - * ------------------------------------------------------------------------------------------ */ +/* -------------------------------------------------------------------------------------------- * ------------------------------------------------------------------------------------------ */ - workspace as Workspace, import * as path from 'path' - return - workspace as Workspace, + * ------------------------------------------------------------------------------------------ */ import { + * Licensed under the MIT License. See License.txt in the project root for license information. * ------------------------------------------------------------------------------------------ */ - workspace as Workspace, import { - folder = getOuterMostWorkspaceFolder(folder) + * ------------------------------------------------------------------------------------------ */ * ------------------------------------------------------------------------------------------ */ +import { import * as path from 'path' * ------------------------------------------------------------------------------------------ */ - if (uri.startsWith(element)) { + : [] /* -------------------------------------------------------------------------------------------- - workspace as Workspace, * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. } - - searchedFolders.add(folder.uri.toString()) - - await bootClientForFolderIfNeeded(folder) } context.subscriptions.push(Workspace.onDidOpenTextDocument(didOpenTextDocument))