eraserhd / parinfer-rust

A Rust port of parinfer.
ISC License
546 stars 42 forks source link

Add support for user-defined comment characters #70

Closed pyrmont closed 4 years ago

pyrmont commented 4 years ago

The parinfer-rust library is written with the assumption that ; denotes comments. While this is true in most Lisps, it is not true in Janet. Worse, the ; character can have an important semantic meaning (again, this is the case in Janet).

At present, this makes the use of parinfer-rust in Janet dangerous at best. The code in this PR solves the issue by allowing the user to specify the character to use for denoting comments at the time of each call (by default, the value is ;). In the revised plugin/parinfer.vim file, the plugin will use the value of b:parinfer_comment_char for the comment character (this is set to ; if not defined for the buffer).

This is my first time writing any code in Rust and there is very likely mistakes in how I've gone about implementing this. Please feel free to correct as necessary.

This fixes #37.

eraserhd commented 4 years ago

This looks nice, thank you! Please add an entry to CHANGELOG.md, and optionally add yourself to the "Contributors" section of the README.md, and I'll merge.

pyrmont commented 4 years ago

@eraserhd No worries. I think I've made the right changes to the documents but please let me know if I've messed anything up!