Home

tailwind-ctp-intellisense @master - refs - log -
-
https://git.jolheiser.com/tailwind-ctp-intellisense.git
Tailwind intellisense + Catppuccin
tree log patch
vary @tailwind completions based on version
Brad Cornes <brad@parall.ax>
4 years ago
5 changed files, 28 additions(+), 9 deletions(-)
M packages/tailwindcss-class-names/src/index.js -> packages/tailwindcss-class-names/src/index.js
diff --git a/packages/tailwindcss-class-names/src/index.js b/packages/tailwindcss-class-names/src/index.js
index e7a78ef2631705cd256f89f1009e49e20ab74eaa..c87d27116ef7914b5891b043b54098c27d74b42e 100644
--- a/packages/tailwindcss-class-names/src/index.js
+++ b/packages/tailwindcss-class-names/src/index.js
@@ -93,6 +93,7 @@
     const resolvedConfig = resolveConfig({ cwd, config })
 
     return {
+      version,
       configPath,
       config: resolvedConfig,
       separator: typeof userSeperator === 'undefined' ? ':' : userSeperator,
M packages/tailwindcss-language-server/package-lock.json -> packages/tailwindcss-language-server/package-lock.json
diff --git a/packages/tailwindcss-language-server/package-lock.json b/packages/tailwindcss-language-server/package-lock.json
index 2bf6cb961576e19d3af90115b19038b1353d5c31..280ac2ebe660d37b9dddf0fab85e78f903071363 100644
--- a/packages/tailwindcss-language-server/package-lock.json
+++ b/packages/tailwindcss-language-server/package-lock.json
@@ -151,6 +151,12 @@       "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
       "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=",
       "dev": true
     },
+    "semver": {
+      "version": "7.3.2",
+      "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz",
+      "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==",
+      "dev": true
+    },
     "subarg": {
       "version": "1.0.0",
       "resolved": "https://registry.npmjs.org/subarg/-/subarg-1.0.0.tgz",
M packages/tailwindcss-language-server/package.json -> packages/tailwindcss-language-server/package.json
diff --git a/packages/tailwindcss-language-server/package.json b/packages/tailwindcss-language-server/package.json
index 14590add68740a7cce2c2ba9a5bafee7c03dc964..dba232f7a0c640616b694a4e3210e0d5bf158d86 100644
--- a/packages/tailwindcss-language-server/package.json
+++ b/packages/tailwindcss-language-server/package.json
@@ -22,6 +22,7 @@     "dlv": "^1.1.3",
     "emmet-helper": "0.0.1",
     "glob-exec": "^0.1.1",
     "line-column": "^1.0.2",
+    "semver": "^7.3.2",
     "tailwindcss-class-names": "0.0.1",
     "typescript": "^3.8.3",
     "vscode-languageserver": "^5.2.1",
M packages/tailwindcss-language-server/src/providers/completionProvider.ts -> packages/tailwindcss-language-server/src/providers/completionProvider.ts
diff --git a/packages/tailwindcss-language-server/src/providers/completionProvider.ts b/packages/tailwindcss-language-server/src/providers/completionProvider.ts
index 3dccb9f324c01a8d13166b5f4e89e2f6ce56af25..53a123832495f72ff618c7d8724ade318dbe70de 100644
--- a/packages/tailwindcss-language-server/src/providers/completionProvider.ts
+++ b/packages/tailwindcss-language-server/src/providers/completionProvider.ts
@@ -21,6 +21,7 @@ import { isValidLocationForEmmetAbbreviation } from '../util/isValidLocationForEmmetAbbreviation'
 import { getDocumentSettings } from '../util/getDocumentSettings'
 import { isJsContext } from '../util/js'
 import { naturalExpand } from '../util/naturalExpand'
+import semver from 'semver'
 
 function completionsFromClassList(
   state: State,
@@ -306,7 +307,7 @@     }),
   }
 }
 
-// TODO: vary items based on Tailwind version
+// TODO: vary docs links based on Tailwind version
 function provideTailwindDirectiveCompletions(
   state: State,
   { position, textDocument }: CompletionParams
@@ -329,14 +330,23 @@
   return {
     isIncomplete: false,
     items: [
-      {
-        label: 'base',
-        documentation: {
-          kind: MarkupKind.Markdown,
-          value:
-            'This injects Tailwind’s base styles and any base styles registered by plugins.\n\n[Tailwind CSS Documentation](https://tailwindcss.com/docs/functions-and-directives/#tailwind)',
-        },
-      },
+      semver.gte(state.version, '1.0.0-beta.1')
+        ? {
+            label: 'base',
+            documentation: {
+              kind: MarkupKind.Markdown,
+              value:
+                'This injects Tailwind’s base styles and any base styles registered by plugins.\n\n[Tailwind CSS Documentation](https://tailwindcss.com/docs/functions-and-directives/#tailwind)',
+            },
+          }
+        : {
+            label: 'preflight',
+            documentation: {
+              kind: MarkupKind.Markdown,
+              value:
+                'This injects Tailwind’s base styles, which is a combination of Normalize.css and some additional base styles.\n\n[Tailwind CSS Documentation](https://v0.tailwindcss.com/docs/functions-and-directives/#tailwind)',
+            },
+          },
       {
         label: 'components',
         documentation: {
M packages/tailwindcss-language-server/src/util/state.ts -> packages/tailwindcss-language-server/src/util/state.ts
diff --git a/packages/tailwindcss-language-server/src/util/state.ts b/packages/tailwindcss-language-server/src/util/state.ts
index d41127d6272e6bbf5b719b96ba602362395c67b9..401cedfeb2252fe7752dc2768aa7f880f44c21fa 100644
--- a/packages/tailwindcss-language-server/src/util/state.ts
+++ b/packages/tailwindcss-language-server/src/util/state.ts
@@ -29,6 +29,7 @@ }
 
 export type State = null | {
   enabled: boolean
+  version?: string
   configPath?: string
   config?: any
   separator?: string