Closed hth2 closed 3 years ago
Are you sure that regex is correct? Looping in @praveenperera for this one.
I derived the pattern from the existing patterns for other languages.
Now I have tested in nodejs and it seems correct:
> r = new RegExp("\\B@doApply\\(\"([_a-zA-Z0-9\\s\\-\\:\\/]+)\"\\)")
/\B@doApply\("([_a-zA-Z0-9\s\-\:\/]+)"\)/
> r.test('@doApply("fixed left-0 top-0 w-full h-full z-10")')
true
> '@doApply("fixed left-0 top-0 w-full h-full z-10")'.match(r)
[
'@doApply("fixed left-0 top-0 w-full h-full z-10")',
'fixed left-0 top-0 w-full h-full z-10',
index: 0,
input: '@doApply("fixed left-0 top-0 w-full h-full z-10")',
groups: undefined
]
>
"scala": "\\B@doApply\\(\"([_a-zA-Z0-9\\s\\-\\:\\/]+)\"\\)"
Works fine for me in a .scala
file, including sorting and removing duplicates.
Input
sb(modal)(
@doApply("left-0 fixed left-0 top-0 w-full h-full z-10")
)
Output
sb(modal)(
@doApply("fixed top-0 left-0 z-10 w-full h-full")
)
In your original post, you don't have an @
before doApply.
I'm not a Scala programmer, so I have no idea which syntax is correct, but to make the regex work, it requires the @
before doApply
. Otherwise, remove the @
from the regex.
I know this issue is old, but I hope this helps.
thank you for your comment.
Indeed I messed it up with the @
char. Now I removed it from the regex (and reload) but still it doesn't work for scala & plaintext. Most likely I missed something, but could not figure it out after lot of attempts. Will give another try later.
Now I removed it from the regex (and reload) but still it doesn't work for scala & plaintext.
After commenting, I noticed I was having weird issues getting the regex to load correctly after changing it.
Not sure what is happening, but I agree there was something going on that makes adjusting the regex config unreliable.
My typical scala code looks as follows:
I tried to add the following to
headwind.classRegex
these linesbut it doesn't seem to work. Headwind works properly for css files. I have the official scala plugin installed, and restarted vs code after changing the settings.
Any hint what I can try?