antonk52 / cssmodules-language-server

autocompletion and go-to-defintion for cssmodules
MIT License
54 stars 8 forks source link

Support for PascalCase class names #15

Closed itmecho closed 11 months ago

itmecho commented 11 months ago

Is there any way this could support PascalCase class names? The codebase at my company has a lot of CSS modules that contain class names that match the components they style, i.e. <Task className={styles.Task}>...</Task>.

Currently, the lsp returns the class in camelCase which resolves to undefined and causes the element to have no className attribute.

For example: image

Choosing the classOne option results in <p>Should be red</p> being rendered

antonk52 commented 11 months ago

Apologies for getting back to you late. You can turn off camelCase option (false) and the class names will be returned as is. Please see the docs for camelCase option and how to set it depending on what you are using for lsp setup.

itmecho commented 11 months ago

Ah my bad! I saw in the table that false is marked as the default so I thought that was the behaviour I was getting. Setting it to false manually does the trick!

Does that mean that false isn't the default?

antonk52 commented 11 months ago

Oh, there was a typo in the docs. true is the actual default setting. I've updated the docs to reflect it. Thanks for surfacing!