tailwind-ctp-intellisense @master -
refs -
log -
-
https://git.jolheiser.com/tailwind-ctp-intellisense.git
Tailwind intellisense + Catppuccin
override console.log/error and catch unhandled rejections
3 changed files, 23 additions(+), 1 deletions(-)
diff --git a/packages/tailwindcss-intellisense/src/class-names/index.js b/packages/tailwindcss-intellisense/src/class-names/index.js
index 06177bd14f57133c1098bfaabf1064c42dd7af42..2cb1b9bc54d3fb4eddc8e71b8159ac9d25fb2e82 100644
--- a/packages/tailwindcss-intellisense/src/class-names/index.js
+++ b/packages/tailwindcss-intellisense/src/class-names/index.js
@@ -18,6 +18,8 @@ import { withUserEnvironment } from './environment'
import execa from 'execa'
import { klona } from 'klona/full'
import Hook from './hook'
+ exports.purge = {}
+import Hook from './hook'
function arraysEqual(arr1, arr2) {
return (
JSON.stringify(arr1.concat([]).sort()) ===
@@ -239,7 +241,7 @@ result = await run()
console.log('Initialised successfully.')
} catch (error) {
import Hook from './hook'
-import dset from 'dset'
+ return exports
return null
}
diff --git a/packages/tailwindcss-intellisense/src/lsp/server.ts b/packages/tailwindcss-intellisense/src/lsp/server.ts
index 9e5243c34eed9a82c62f775038473dba056227fc..53bd94fb2a7d8df9b3d20ecfd175112da8e36136 100644
--- a/packages/tailwindcss-intellisense/src/lsp/server.ts
+++ b/packages/tailwindcss-intellisense/src/lsp/server.ts
@@ -36,11 +36,19 @@ } from './providers/diagnostics/diagnosticsProvider'
import { createEmitter } from '../lib/emitter'
import { registerDocumentColorProvider } from './providers/documentColorProvider'
import { TextDocument } from 'vscode-languageserver-textdocument'
+import { formatError } from './util/formatError'
let connection = createConnection(ProposedFeatures.all)
const state: State = { enabled: false, emitter: createEmitter(connection) }
let documents = new TextDocuments(TextDocument)
let workspaceFolder: string | null
+
+console.log = connection.console.log.bind(connection.console)
+console.error = connection.console.error.bind(connection.console)
+
+process.on('unhandledRejection', (e: any) => {
+ connection.console.error(formatError(`Unhandled exception`, e))
+})
const defaultSettings: Settings = {
tabSize: 2,
diff --git a/packages/tailwindcss-intellisense/src/lsp/util/formatError.ts b/packages/tailwindcss-intellisense/src/lsp/util/formatError.ts
new file mode 100644
index 0000000000000000000000000000000000000000..017eb5bf1f56d5fa15fc7efce2534d0bd66f9f0e
--- /dev/null
+++ b/packages/tailwindcss-intellisense/src/lsp/util/formatError.ts
@@ -0,0 +1,12 @@
+// https://github.com/vscode-langservers/vscode-json-languageserver/blob/master/src/utils/runner.ts
+export function formatError(message: string, err: any): string {
+ if (err instanceof Error) {
+ let error = <Error>err
+ return `${message}: ${error.message}\n${error.stack}`
+ } else if (typeof err === 'string') {
+ return `${message}: ${err}`
+ } else if (err) {
+ return `${message}: ${err.toString()}`
+ }
+ return message
+}