seaofvoices / darklua

A command line tool that transforms Lua code
https://darklua.com/
MIT License
71 stars 9 forks source link

Better `append_text_comment` rule content/context awareness. #199

Open kineticwallet opened 3 months ago

kineticwallet commented 3 months ago

Thread starts here: https://discord.com/channels/385151591524597761/1135953303142936747/1244748502203105301

jeparlefrancais commented 2 months ago

The issue here is that the append_text_comment rule will trim whitespaces from the inserted comment and pad it with a space so that it looks like this:

-- comment

This is not ideal for special comments like --!optimize or --!native which turns into -- !optimize and -- !native (so they don't work).

The fix is simply to avoid the trim and remove the inserted space.