merrickluo / lsp-tailwindcss

the lsp-mode client for tailwindcss
GNU General Public License v3.0
180 stars 21 forks source link

Cannot read property ’filter’ of undefined #30

Closed otavioschwanck closed 2 years ago

otavioschwanck commented 2 years ago

Company: backend (:separate company-capf company-dabbrev-code company-yasnippet) error "Request textDocument/completion failed with message: Cannot read property ’filter’ of undefined" with args (candidates cen) LSP :: Error from the Language Server: Request textDocument/hover failed with message: Cannot read property 'filter' of undefined (Internal Error)

Using doom emacs

Followed the README

hirotaka commented 2 years ago

I encountered a similar problem 🤔 I'm using Spacemacs, and after upgrading the package, I started getting this error in lsp-log.

Loaded tailwindcss v2.2.4: /Users/hirotaka/Workspaces/stackhackerio/stackhacker.io/node_modules/tailwindcss
Unhandled exception: Cannot read properties of undefined (reading 'filter')
TypeError: Cannot read properties of undefined (reading 'filter')
    at matchClassAttributes (/Users/hirotaka/.anyenv/envs/nodenv/versions/16.13.1/lib/node_modules/@tailwindcss/language-server/bin/tailwindcss-language-server:57:342671)
    at /Users/hirotaka/.anyenv/envs/nodenv/versions/16.13.1/lib/node_modules/@tailwindcss/language-server/bin/tailwindcss-language-server:57:342963
    at Generator.next (<anonymous>)
    at fulfilled (/Users/hirotaka/.anyenv/envs/nodenv/versions/16.13.1/lib/node_modules/@tailwindcss/language-server/bin/tailwindcss-language-server:57:339947)
hirotaka commented 2 years ago

Undo this change,

https://github.com/merrickluo/lsp-tailwindcss/commit/8dc511e06425272880ff6bbbded01eed1297ef04#diff-92fed0b3fad7599e18d36d077339890c58ae71600df1dfcb0582420aa5f6e51b

and change the version back to 0.0.4 of @tailwindcss/language-server, it works fine.

https://www.npmjs.com/package/@tailwindcss/language-server

otavioschwanck commented 2 years ago

Undo this change,

8dc511e#diff-92fed0b3fad7599e18d36d077339890c58ae71600df1dfcb0582420aa5f6e51b

and change the version back to 0.0.4 of @tailwindcss/language-server, it works fine.

https://www.npmjs.com/package/@tailwindcss/language-server

Downgrading to 0.0.4 and reverting the commit fixes to me too.

image

Thanks @hirotaka

merrickluo commented 2 years ago

hmm, @tailwindcss/language-server 0.0.5 works fine for me. is there anything special about your tailwind config? can you try (setq lsp-tailwindcss-experimental-class-regex nil)?

hirotaka commented 2 years ago

I think this is due to @tailwindcss/language-server update from 0.0.4 to 0.0.5. lsp-tailwindcss's fix is not relevant. I have created a PR(#31), please check it out!

This is my first LISP programming, so please let me know if I'm missing anything😉

waymondo commented 2 years ago

I'm also running into this error with @tailwindcss/language-server version 0.0.7 (latest version) and the latest version of lsp-tailwindcss. For me, the issue is resolved if I simply comment out this line https://github.com/merrickluo/lsp-tailwindcss/blob/master/lsp-tailwindcss.el#L221. I'm not sure what the correct fix is, so I'll just modify lsp-client-settings in my .emacs.d for now but figured I'd chime in that there still seems to be an issue.