vale icon indicating copy to clipboard operation
vale copied to clipboard

feat: add replace action to default Vale.Terms rule

Open wbh1 opened this issue 8 months ago • 4 comments

This is useful for ensuring that Vocab terms get populated as quick fix/code action suggestions by the Vale Language Server.

wbh1 avatar Apr 07 '25 13:04 wbh1

The reason why this wasn't added before is because vocabularies can (and often do) contain regex instead of words or phrases. In these cases, the suggestions won't make sense.

jdkato avatar Apr 11 '25 04:04 jdkato

Good point, indeed.

This is the default rule, right?

Would it be possible to add the replace action on some condition only? Like the words is only Unicode letters (naive idea for detection) for example. But then, I assume it wouldn't be there, but where the code detects the words is invalid. So maybe the feature idea could be kept by moving it somewhere else, no?

Another question, you said the vocabulary contains (often) regexp so it cannot be done with the way the author of the PR did. But I see the message field of the rule saying "use %s instead of %s" so I assume the word provided for the first %s is a valid word, that people would expect to see used with a "quick action".

ccoVeille avatar Apr 11 '25 06:04 ccoVeille

Would it be possible to add the replace action on some condition only? Like the words is only Unicode letters (naive idea for detection) for example. But then, I assume it wouldn't be there, but where the code detects the words is invalid. So maybe the feature idea could be kept by moving it somewhere else, no?

Yes -- honestly, I'd like to move vocabularies to YAML files as well. This would make them much more robust in many ways (comment handling, feature additions, conditional entries, etc).

jdkato avatar Jun 04 '25 06:06 jdkato

I would love that, yes

ccoVeille avatar Jun 04 '25 07:06 ccoVeille