tailwind-ctp-intellisense @master -
refs -
log -
-
https://git.jolheiser.com/tailwind-ctp-intellisense.git
Tailwind intellisense + Catppuccin
replace js-levenshtein with sift-string
3 changed files, 9 additions(+), 18 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index 1992a2d93506b81f689a45031e694a69cb864b55..9184c0f6d4d60cb918f95cc528656182719d94a9 100755
--- a/package-lock.json
+++ b/package-lock.json
@@ -1027,12 +1027,6 @@ "@types/istanbul-lib-coverage": "*",
"@types/istanbul-lib-report": "*"
}
},
- "@types/js-levenshtein": {
- "version": "1.1.0",
- "resolved": "https://registry.npmjs.org/@types/js-levenshtein/-/js-levenshtein-1.1.0.tgz",
- "integrity": "sha512-14t0v1ICYRtRVcHASzes0v/O+TIeASb8aD55cWF1PidtInhFWSXcmhzhHqGjUWf9SUq1w70cvd1cWKUULubAfQ==",
- "dev": true
- },
"@types/mocha": {
"version": "5.2.1",
"resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-5.2.1.tgz",
@@ -4603,12 +4597,6 @@ }
}
}
},
- "js-levenshtein": {
- "version": "1.1.6",
- "resolved": "https://registry.npmjs.org/js-levenshtein/-/js-levenshtein-1.1.6.tgz",
- "integrity": "sha512-X2BB11YZtrRqY4EnQcLX5Rh373zbK4alC1FW7D7MBhL2gtcC17cTnr6DmfHZeS0s2rTHjUTMMHfG7gO8SSdw+g==",
- "dev": true
- },
"js-tokens": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
@@ -6101,6 +6089,12 @@ "resolved": "https://registry.npmjs.org/shellwords/-/shellwords-0.1.1.tgz",
"integrity": "sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww==",
"dev": true,
"optional": true
+ },
+ "sift-string": {
+ "version": "0.0.2",
+ "resolved": "https://registry.npmjs.org/sift-string/-/sift-string-0.0.2.tgz",
+ "integrity": "sha1-G7ArEhslu4sHRwQr+afh2s+PuJw=",
+ "dev": true
},
"signal-exit": {
"version": "3.0.3",
diff --git a/package.json b/package.json
index bf55ce613253e1ee6350bb89244b6b5e2be37a30..f399df99c40cb8d1c9083f46fc85ccf23f4a8d96 100755
--- a/package.json
+++ b/package.json
@@ -156,7 +156,6 @@ "test": "jest"
},
"devDependencies": {
"@ctrl/tinycolor": "^3.1.0",
- "@types/js-levenshtein": "^1.1.0",
"@types/mocha": "^5.2.0",
"@types/moo": "^0.5.3",
"@types/node": "^13.9.3",
@@ -175,7 +174,6 @@ "globalyzer": "^0.1.4",
"globrex": "^0.1.2",
"import-from": "^3.0.0",
"jest": "^25.5.4",
- "js-levenshtein": "^1.1.6",
"line-column": "^1.0.2",
"mitt": "^1.2.0",
"mkdirp": "^1.0.3",
@@ -186,6 +184,7 @@ "postcss-selector-parser": "^6.0.2",
"resolve-from": "^5.0.0",
"rimraf": "^3.0.2",
"semver": "^7.3.2",
+ "sift-string": "0.0.2",
"stack-trace": "0.0.10",
"terser": "^4.6.12",
"tiny-invariant": "^1.1.0",
diff --git a/src/lsp/util/closest.ts b/src/lsp/util/closest.ts
index 3153cb8e8a48bde030c2d34d4149b2a364a9e942..ebdfacc270c2c5467d501b4ff4642aef04f6277e 100644
--- a/src/lsp/util/closest.ts
+++ b/src/lsp/util/closest.ts
@@ -1,7 +1,5 @@
-import levenshtein from 'js-levenshtein'
+import sift from 'sift-string'
export function closest(input: string, options: string[]): string | undefined {
- return options.sort(
- (a, b) => levenshtein(input, a) - levenshtein(input, b)
- )[0]
+ return options.concat([]).sort((a, b) => sift(input, a) - sift(input, b))[0]
}