Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

headwind and Solidjs class support? #203

Open
MariuzM opened this issue Aug 11, 2023 · 1 comment
Open

headwind and Solidjs class support? #203

MariuzM opened this issue Aug 11, 2023 · 1 comment

Comments

@MariuzM
Copy link

MariuzM commented Aug 11, 2023

I cant get headwind to work in Solidjs tsx component that is using class instead of React using className

i tried but not working :(

  "headwind.classRegex": {
    "html": "\\bclass\\s*=\\s*[\\\"\\']([_a-zA-Z0-9\\s\\-\\:\\/]+)[\\\"\\']",
    "javascriptsolid": "(?:\\class\\s*=\\s*[\\\"\\']([_a-zA-Z0-9\\s\\-\\:\\/]+)[\\\"\\'])|(?:\\btw\\s*`([_a-zA-Z0-9\\s\\-\\:\\/]*)`)"
  },
@LucDeCaf
Copy link

LucDeCaf commented Jun 3, 2024

I know this is technically a necropost, but I feel like others will come across this in the future and want a solution.

"javascriptsolid" isn't a file type recognised by VSCode. All JSX and TSX files match to "javascriptreact" and "typescriptreact" respectively.

With that in mind, the following regex can be used that maintains support for both className and class:

// settings.json

{
    /* Other settings... */

    "headwind.classRegex": {
        "javascriptreact": "(?:\\b(?:className|class)\\s*=\\s*[\\\"\\']([_a-zA-Z0-9\\s\\-\\:\\/]+)[\\\"\\'])|(?:\\btw\\s*`([_a-zA-Z0-9\\s\\-\\:\\/]*)`)",
        "typescriptreact": "(?:\\b(?:className|class)\\s*=\\s*[\\\"\\']([_a-zA-Z0-9\\s\\-\\:\\/]+)[\\\"\\'])|(?:\\btw\\s*`([_a-zA-Z0-9\\s\\-\\:\\/]*)`)"
    }
}

The regexes replace className with the non-capturing group (?:className|class).

P.S. You may need to restart VSCode after updating settings.json.

Hope this helps 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants