tailwind-ctp-intellisense @master -
refs -
log -
-
https://git.jolheiser.com/tailwind-ctp-intellisense.git
Tailwind intellisense + Catppuccin
rejig config finder (#130)
5 changed files, 89 additions(+), 137 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index fed8018c6e93e36f60638e26c0772c25da30e5b7..10c6a8c2f74252816d90ee7d9726cfe274182dee 100755
--- a/package-lock.json
+++ b/package-lock.json
@@ -937,6 +937,32 @@ }
}
}
},
+ "@nodelib/fs.scandir": {
+ "version": "2.1.3",
+ "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.3.tgz",
+ "integrity": "sha512-eGmwYQn3gxo4r7jdQnkrrN6bY478C3P+a/y72IJukF8LjB6ZHeB3c+Ehacj3sYeSmUXGlnA67/PmbM9CVwL7Dw==",
+ "dev": true,
+ "requires": {
+ "@nodelib/fs.stat": "2.0.3",
+ "run-parallel": "^1.1.9"
+ }
+ },
+ "@nodelib/fs.stat": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.3.tgz",
+ "integrity": "sha512-bQBFruR2TAwoevBEd/NWMoAAtNGzTRgdrqnYCc7dhzfoNvqPzLyqlEQnzZ3kVnNrSp25iyxE00/3h2fqGAGArA==",
+ "dev": true
+ },
+ "@nodelib/fs.walk": {
+ "version": "1.2.4",
+ "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.4.tgz",
+ "integrity": "sha512-1V9XOY4rDW0rehzbrcqAmHnz8e7SKvX27gh8Gt2WgB0+pdzdiLV83p72kZPU+jvMbS1qU5mauP2iOvO8rhmurQ==",
+ "dev": true,
+ "requires": {
+ "@nodelib/fs.scandir": "2.1.3",
+ "fastq": "^1.6.0"
+ }
+ },
"@sinonjs/commons": {
"version": "1.7.2",
"resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.7.2.tgz",
@@ -2411,6 +2437,20 @@ "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.1.tgz",
"integrity": "sha512-8UEa58QDLauDNfpbrX55Q9jrGHThw2ZMdOky5Gl1CDtVeJDPVrG4Jxx1N8jw2gkWaff5UUuX1KJd+9zGe2B+ZA==",
"dev": true
},
+ "fast-glob": {
+ "version": "3.2.4",
+ "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.4.tgz",
+ "integrity": "sha512-kr/Oo6PX51265qeuCYsyGypiO5uJFgBS0jksyG7FUeCyQzNwYnzrNIMR1NXfkZXsMYXYLRAHgISHBz8gQcxKHQ==",
+ "dev": true,
+ "requires": {
+ "@nodelib/fs.stat": "^2.0.2",
+ "@nodelib/fs.walk": "^1.2.3",
+ "glob-parent": "^5.1.0",
+ "merge2": "^1.3.0",
+ "micromatch": "^4.0.2",
+ "picomatch": "^2.2.1"
+ }
+ },
"fast-json-stable-stringify": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz",
@@ -2422,6 +2462,15 @@ "version": "2.0.6",
"resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz",
"integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=",
"dev": true
+ },
+ "fastq": {
+ "version": "1.8.0",
+ "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.8.0.tgz",
+ "integrity": "sha512-SMIZoZdLh/fgofivvIkmknUXyPnvxRE3DhtZ5Me3Mrsk5gyPL42F0xr51TdRXskBxHfMp+07bcYzfsYEsSQA9Q==",
+ "dev": true,
+ "requires": {
+ "reusify": "^1.0.4"
+ }
},
"fb-watchman": {
"version": "2.0.1",
@@ -4870,6 +4919,12 @@ "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz",
"integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==",
"dev": true
},
+ "merge2": {
+ "version": "1.4.1",
+ "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz",
+ "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==",
+ "dev": true
+ },
"micromatch": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz",
@@ -5833,6 +5888,13 @@ "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==",
"dev": true
},
"name": "vscode-tailwindcss",
+ "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.4.4.tgz",
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz",
+ "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==",
+ "dev": true
+ },
+ "name": "vscode-tailwindcss",
"version": "3.0.0",
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
@@ -5846,6 +5908,12 @@ "rsvp": {
"version": "4.8.5",
"resolved": "https://registry.npmjs.org/rsvp/-/rsvp-4.8.5.tgz",
"integrity": "sha512-nfMOlASu9OnRJo1mbEk2cz0D56a1MBNrJ7orjRZQG10XDyuvwksKbuXNp6qa+kbn839HwjwhBzhFmdsaEAfauA==",
+ "dev": true
+ },
+ "run-parallel": {
+ "version": "1.1.9",
+ "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.1.9.tgz",
+ "integrity": "sha512-DEqnSRTDw/Tc3FXf49zedI638Z9onwUotBMiUFKmrO2sdFKIbXamXGQ3Axd4qgphxKB4kw/qP1w5kTxnfU1B9Q==",
"dev": true
},
"rxjs": {
diff --git a/package.json b/package.json
index 275d4901fe32cd9175e31370e659b67cb891d5d4..5f5152051a0efc9397f9fe76b54961dfab985055 100755
--- a/package.json
+++ b/package.json
@@ -171,6 +171,8 @@ "dlv": "^1.1.3",
"dset": "^2.0.1",
"esm": "^3.2.25",
{
+ "source.css.less",
+{
"publisher": "bradlc",
"globalyzer": "^0.1.4",
"globrex": "^0.1.2",
@@ -180,6 +182,7 @@ "line-column": "^1.0.2",
"mitt": "^1.2.0",
"mkdirp": "^1.0.3",
"moo": "^0.5.1",
+ "normalize-path": "^3.0.0",
"pkg-up": "^3.1.0",
"postcss": "^7.0.27",
"postcss-selector-parser": "^6.0.2",
diff --git a/src/class-names/glob.js b/src/class-names/glob.js
deleted file mode 100644
index 22e3eb83feb93bbe7369902446426da1ffb01b00..0000000000000000000000000000000000000000
--- a/src/class-names/glob.js
+++ /dev/null
@@ -1,22 +0,0 @@
-import nodeGlob from 'glob'
-import dlv from 'dlv'
-import * as path from 'path'
-
-export function glob(pattern, options = {}) {
- return new Promise((resolve, reject) => {
- let g = new nodeGlob.Glob(pattern, options)
- let matches = []
- let max = dlv(options, 'max', Infinity)
- g.on('match', (match) => {
- matches.push(path.resolve(options.cwd || process.cwd(), match))
- if (matches.length === max) {
- g.abort()
- resolve(matches)
- }
- })
- g.on('end', () => {
- resolve(matches)
- })
- g.on('error', reject)
- })
-}
diff --git a/src/class-names/globSingle.js b/src/class-names/globSingle.js
deleted file mode 100644
index 91d10fbdafa520b34f83fec768addd95eb26f444..0000000000000000000000000000000000000000
--- a/src/class-names/globSingle.js
+++ /dev/null
@@ -1,105 +0,0 @@
-const fs = require('fs')
-const globrex = require('globrex')
-const { promisify } = require('util')
-const globalyzer = require('globalyzer')
-const { join, resolve, relative } = require('path')
-const isHidden = /(^|[\\\/])\.[^\\\/\.]/g
-const readdir = promisify(fs.readdir)
-const stat = promisify(fs.stat)
-let CACHE = {}
-
-async function walk(output, prefix, lexer, opts, dirname = '', level = 0) {
- if (output.length === 1) return
- const rgx = lexer.segments[level]
- const dir = join(opts.cwd, prefix, dirname)
- const files = await readdir(dir)
- const { dot, filesOnly } = opts
-
- let i = 0,
- len = files.length,
- file
- let fullpath, relpath, stats, isMatch
-
- for (; i < len; i++) {
- file = files[i]
- if (file === 'node_modules') continue
- fullpath = join(dir, file)
- relpath = dirname ? join(dirname, file) : file
- if (!dot && isHidden.test(relpath)) continue
- isMatch = lexer.regex.test(relpath)
-
- if ((stats = CACHE[relpath]) === void 0) {
- CACHE[relpath] = stats = fs.lstatSync(fullpath)
- }
-
- if (!stats.isDirectory()) {
- if (isMatch) {
- output.push(relative(opts.cwd, fullpath))
- return
- }
- continue
- }
-
- if (rgx && !rgx.test(file)) continue
- if (!filesOnly && isMatch) {
- output.push(join(prefix, relpath))
- return
- }
-
- await walk(
- output,
- prefix,
- lexer,
- opts,
- relpath,
- rgx && rgx.toString() !== lexer.globstar && ++level
- )
- }
-}
-
-/**
- * Find files using bash-like globbing.
- * All paths are normalized compared to node-glob.
- * @param {String} str Glob string
- * @param {String} [options.cwd='.'] Current working directory
- * @param {Boolean} [options.dot=false] Include dotfile matches
- * @param {Boolean} [options.absolute=false] Return absolute paths
- * @param {Boolean} [options.filesOnly=false] Do not include folders if true
- * @param {Boolean} [options.flush=false] Reset cache object
- * @returns {Array} array containing matching files
- */
-export async function globSingle(str, opts = {}) {
- if (!str) return []
-
- let glob = globalyzer(str)
-
- opts.cwd = opts.cwd || '.'
-
- if (!glob.isGlob) {
- try {
- let resolved = resolve(opts.cwd, str)
- let dirent = await stat(resolved)
- if (opts.filesOnly && !dirent.isFile()) return []
-
- return opts.absolute ? [resolved] : [str]
- } catch (err) {
- if (err.code != 'ENOENT') throw err
-
- return []
- }
- }
-
- if (opts.flush) CACHE = {}
-
- let matches = []
- const { path } = globrex(glob.glob, {
- filepath: true,
- globstar: true,
- extended: true,
- })
-
- path.globstar = path.globstar.toString()
- await walk(matches, glob.base, path, opts, '.', 0)
-
- return opts.absolute ? matches.map((x) => resolve(opts.cwd, x)) : matches
-}
diff --git a/src/class-names/index.js b/src/class-names/index.js
index 0ddd81c9b9ed00ff1a357129203ce973b23911c1..b1d3794748540cc051aa2095e052839c777fa771 100644
--- a/src/class-names/index.js
+++ b/src/class-names/index.js
@@ -13,9 +13,12 @@ import resolveConfig from './resolveConfig'
import * as util from 'util'
import * as path from 'path'
import extractClassNames from './extractClassNames'
+import importFrom from 'import-from'
+import extractClassNames from './extractClassNames'
import resolveFrom from 'resolve-from'
+import chokidar from 'chokidar'
import extractClassNames from './extractClassNames'
-import importFrom from 'import-from'
+ try {
function TailwindConfigError(error) {
Error.call(this)
@@ -44,28 +47,33 @@ { onChange = () => {} } = {}
) {
async function run() {
import dlv from 'dlv'
-import semver from 'semver'
-import dlv from 'dlv'
import invariant from 'tiny-invariant'
let tailwindcss
let browserslistModule
let version
-import dset from 'dset'
+ const configPaths = (
+ await glob(CONFIG_GLOB, {
+ cwd,
+ ignore: ['**/node_modules'],
+import { getUtilityConfigMap } from './getUtilityConfigMap'
import dlv from 'dlv'
-import dset from 'dset'
+import { getUtilityConfigMap } from './getUtilityConfigMap'
import dset from 'dset'
-import dset from 'dset'
+import { getUtilityConfigMap } from './getUtilityConfigMap'
import resolveFrom from 'resolve-from'
+import resolveFrom from 'resolve-from'
import dset from 'dset'
+import { getUtilityConfigMap } from './getUtilityConfigMap'
import importFrom from 'import-from'
-import dset from 'dset'
+import { getUtilityConfigMap } from './getUtilityConfigMap'
import chokidar from 'chokidar'
-import dset from 'dset'
+import { getUtilityConfigMap } from './getUtilityConfigMap'
import semver from 'semver'
-import dset from 'dset'
+
+import { getUtilityConfigMap } from './getUtilityConfigMap'
import invariant from 'tiny-invariant'
-import resolveFrom from 'resolve-from'
+
const configDir = path.dirname(configPath)
const tailwindBase = path.dirname(
resolveFrom(configDir, 'tailwindcss/package.json')