From 38b596b846c74b718c925044e33d8c45fc8e4ddc Mon Sep 17 00:00:00 2001 From: Brad Cornes Date: Fri, 10 Sep 2021 14:46:00 +0100 Subject: [PATCH 1/8] bump language server version --- packages/tailwindcss-language-server/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/tailwindcss-language-server/package.json b/packages/tailwindcss-language-server/package.json index e075b8e..4ee6e4f 100644 --- a/packages/tailwindcss-language-server/package.json +++ b/packages/tailwindcss-language-server/package.json @@ -2,7 +2,7 @@ "name": "@tailwindcss/language-server", "description": "Tailwind CSS Language Server", "license": "MIT", - "version": "0.0.3", + "version": "0.0.4", "scripts": { "build": "npm run clean && ncc build src/server.ts -o bin --minify && mv bin/index.js bin/tailwindcss-language-server && npm run hashbang", "clean": "rimraf dist", From fa68c54a01767746c8787d44d97ddf285a9f2a41 Mon Sep 17 00:00:00 2001 From: Brad Cornes Date: Fri, 10 Sep 2021 14:46:27 +0100 Subject: [PATCH 2/8] find config files hiding in hidden folders (#389) --- packages/tailwindcss-language-server/src/server.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/tailwindcss-language-server/src/server.ts b/packages/tailwindcss-language-server/src/server.ts index 04da927..23bc520 100644 --- a/packages/tailwindcss-language-server/src/server.ts +++ b/packages/tailwindcss-language-server/src/server.ts @@ -414,6 +414,7 @@ async function createProjectService( onlyFiles: true, absolute: true, suppressErrors: true, + dot: true, concurrency: Math.max(os.cpus().length, 1), }) ) From b089cc3833baa5e1d2dfb928b4b3eda4b0ed2fd1 Mon Sep 17 00:00:00 2001 From: Brad Cornes Date: Fri, 17 Sep 2021 15:55:41 +0100 Subject: [PATCH 3/8] fix file event handler when file is in a dot folder (#389) --- packages/tailwindcss-language-server/src/server.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/tailwindcss-language-server/src/server.ts b/packages/tailwindcss-language-server/src/server.ts index 23bc520..9b761ee 100644 --- a/packages/tailwindcss-language-server/src/server.ts +++ b/packages/tailwindcss-language-server/src/server.ts @@ -228,13 +228,13 @@ async function createProjectService( let file = normalizePath(change.file) for (let ignorePattern of ignore) { - if (minimatch(file, ignorePattern)) { + if (minimatch(file, ignorePattern, { dot: true })) { continue } } - let isConfigFile = minimatch(file, `**/${CONFIG_FILE_GLOB}`) - let isPackageFile = minimatch(file, '**/package.json') + let isConfigFile = minimatch(file, `**/${CONFIG_FILE_GLOB}`, { dot: true }) + let isPackageFile = minimatch(file, '**/package.json', { dot: true }) let isDependency = state.dependencies && state.dependencies.includes(change.file) if (!isConfigFile && !isPackageFile && !isDependency) continue @@ -268,6 +268,7 @@ async function createProjectService( if (params.capabilities.workspace?.didChangeWatchedFiles?.dynamicRegistration) { connection.onDidChangeWatchedFiles(({ changes }) => { + console.log('watched file changed') onFileEvents( changes.map(({ uri, type }) => ({ file: URI.parse(uri).fsPath, From 1bd1d0e504dbabfbf68077beadf642cb4eec5483 Mon Sep 17 00:00:00 2001 From: Brad Cornes Date: Fri, 17 Sep 2021 16:04:38 +0100 Subject: [PATCH 4/8] disable extension in virtual workspaces (#398) --- packages/vscode-tailwindcss/package.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/vscode-tailwindcss/package.json b/packages/vscode-tailwindcss/package.json index fc706e0..2c34616 100755 --- a/packages/vscode-tailwindcss/package.json +++ b/packages/vscode-tailwindcss/package.json @@ -39,6 +39,9 @@ "onStartupFinished" ], "main": "dist/extension/index.js", + "capabilities": { + "virtualWorkspaces": false + }, "contributes": { "commands": [ { From dce390d98ca75bc6a0cf19d29e16ca6422faa924 Mon Sep 17 00:00:00 2001 From: Brad Cornes Date: Fri, 17 Sep 2021 17:48:16 +0100 Subject: [PATCH 5/8] remove log --- packages/tailwindcss-language-server/src/server.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/tailwindcss-language-server/src/server.ts b/packages/tailwindcss-language-server/src/server.ts index 9b761ee..1dea503 100644 --- a/packages/tailwindcss-language-server/src/server.ts +++ b/packages/tailwindcss-language-server/src/server.ts @@ -268,7 +268,6 @@ async function createProjectService( if (params.capabilities.workspace?.didChangeWatchedFiles?.dynamicRegistration) { connection.onDidChangeWatchedFiles(({ changes }) => { - console.log('watched file changed') onFileEvents( changes.map(({ uri, type }) => ({ file: URI.parse(uri).fsPath, From 7e2b53cd116d31b108c855208c0f9501a11f1261 Mon Sep 17 00:00:00 2001 From: Brad Cornes Date: Fri, 24 Sep 2021 15:05:07 +0100 Subject: [PATCH 6/8] avoid false positives when parsing colors (#415) --- .../tailwindcss-language-service/src/util/color.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/tailwindcss-language-service/src/util/color.ts b/packages/tailwindcss-language-service/src/util/color.ts index 04e2326..2001b05 100644 --- a/packages/tailwindcss-language-service/src/util/color.ts +++ b/packages/tailwindcss-language-service/src/util/color.ts @@ -40,9 +40,9 @@ function getKeywordColor(value: unknown): KeywordColor | null { // https://github.com/khalilgharbaoui/coloregex const colorRegex = new RegExp( - `(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\\((-?[\\d.]+%?[,\\s]+){2,3}\\s*([\\d.]+%?|var\\([^)]+\\))?\\)|transparent|currentColor|${Object.keys( + `(?:^|\\s|,)(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\\((-?[\\d.]+%?[,\\s]+){2,3}\\s*([\\d.]+%?|var\\([^)]+\\))?\\)|transparent|currentColor|${Object.keys( colorNames - ).join('|')})`, + ).join('|')})(?:$|\\s|,)`, 'gi' ) @@ -52,7 +52,12 @@ function getColorsInString(str: string): (TinyColor | KeywordColor)[] { return ( str .match(colorRegex) - ?.map((color) => color.replace(/var\([^)]+\)/, '1')) + ?.map((color) => + color + .trim() + .replace(/^,|,$/g, '') + .replace(/var\([^)]+\)/, '1') + ) .map((color) => getKeywordColor(color) ?? new TinyColor(color)) .filter((color) => (color instanceof TinyColor ? color.isValid : true)) ?? [] ) From 1253902e88d085ee82e0e4abb4e60de17fa925ab Mon Sep 17 00:00:00 2001 From: Brad Cornes Date: Fri, 24 Sep 2021 16:11:23 +0100 Subject: [PATCH 7/8] add `phoenix-heex` language (#407) --- packages/tailwindcss-language-service/src/util/languages.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/tailwindcss-language-service/src/util/languages.ts b/packages/tailwindcss-language-service/src/util/languages.ts index ba99c0e..53c3593 100644 --- a/packages/tailwindcss-language-service/src/util/languages.ts +++ b/packages/tailwindcss-language-service/src/util/languages.ts @@ -24,6 +24,7 @@ export const htmlLanguages = [ 'mustache', 'njk', 'nunjucks', + 'phoenix-heex', 'php', 'razor', 'slim', From 365281ca611461fbdf6fb132b24c82ef7b14d3e1 Mon Sep 17 00:00:00 2001 From: Brad Cornes Date: Fri, 24 Sep 2021 17:47:01 +0100 Subject: [PATCH 8/8] update resolver options to support `exports` fields (#412) --- packages/tailwindcss-language-server/src/util/resolveFrom.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/tailwindcss-language-server/src/util/resolveFrom.ts b/packages/tailwindcss-language-server/src/util/resolveFrom.ts index fa6ef20..0fd209b 100644 --- a/packages/tailwindcss-language-server/src/util/resolveFrom.ts +++ b/packages/tailwindcss-language-server/src/util/resolveFrom.ts @@ -6,9 +6,7 @@ function createResolver(options: Partial = {}): Resolver { fileSystem: new CachedInputFileSystem(fs, 4000), useSyncFileSystemCalls: true, // cachePredicate: () => false, - exportsFields: [], - conditionNames: ['node'], - extensions: ['.js', '.json', '.node'], + conditionNames: ['node', 'require'], ...options, }) }