luke-gru / riml

Riml is a subset of VimL with some nice added features. It compiles to plain VimL.
MIT License
224 stars 6 forks source link

Newlines after functions #5

Closed dsawardekar closed 10 years ago

dsawardekar commented 11 years ago

@luke-gru Is it possible to add newlines after function blocks in the generated vim files. I am finding I needed drop into the generated files occasionally. It would be lot easier to read with the newlines.

Thanks.

dsawardekar commented 11 years ago

I made a pass at doing this here.

The change itself was easy, Adding a newline to node.compiled_output, but a lot of tests depend on the newline being present when comparing against compiled code. The test suite fails, but the compiler works fine and the output formatting is improved, as seen here.

I could add the newlines to the tests. But given the number of tests(~50) that do this equality test I felt it better to get your thoughts on this first.

https://github.com/dsawardekar/riml/tree/improve-output-formatting

luke-gru commented 11 years ago

Hey, sorry for delayed reply. Busy week :frowning:

Yeah, definitely a small change, and I'm :+1: on it. Maybe there should be an option, like --readable for this though, as I was going to create a similar option for --keep-comments. This would allow for keeping the fold markers, modelines, etc...

Not sure if --readable should be the default option, but if you find yourself digging into the outputted VimL often then I may as well make it the default.

I'd like your thoughts on if you think this should be default behavior.

Thanks!

dsawardekar commented 11 years ago

I haven't needed to drop into Viml too much, thanks to Riml! But it's useful when doing some meta programming to figure out the code generated.

The --readable sounds right to me, and I agree it should be default. --keep-comments is pretty good too.

While we are on the subject of comments, would it be a difficult change to add support for a different comment marker like #? Viml use of quote as the comment marker makes the syntax files regex a lot more complex, and messes up the syntax highlighting often...

luke-gru commented 10 years ago

Blank lines after function definitions is the new default in 0.3.2. This can be turned off using the --condensed flag. My first go at --keep-comments failed, because preserving inline comments after code is actually pretty hard the way everything is implemented now. Keeping comments that are on their own lines should be easy enough. Anyway, I'm marking this as done, and I'll add another ticket so I don't forget to eventually come back to the comment stuff. As it stands, I think better error messages are probably a priority over keeping comments in the compiled files.

Thanks :smile:

dsawardekar commented 10 years ago

+1 For better error messages!