diff --git a/packages/tailwindcss-language-server/src/server.ts b/packages/tailwindcss-language-server/src/server.ts index b1b0c436d9b74d09c26cc76d03fd0e925c40f44e..a038aeab6f556f6c34d088e0f2109c57a8b26300 100644 --- a/packages/tailwindcss-language-server/src/server.ts +++ b/packages/tailwindcss-language-server/src/server.ts @@ -133,6 +133,21 @@ process.on('unhandledRejection', (e: any) => { connection.console.error(formatError(`Unhandled exception`, e)) }) +function deletePropertyPath(obj: any, path: string | string[]): void { + if (typeof path === 'string') { + path = path.split('.') + } + + for (let i = 0; i < path.length - 1; i++) { + obj = obj[path[i]] + if (typeof obj === 'undefined') { + return + } + } + + delete obj[path.pop()] +} + function getConfigId(configPath: string, configDependencies: string[]): string { return JSON.stringify( [configPath, ...configDependencies].map((file) => [file, fs.statSync(file).mtimeMs])