tjdevries / vim9jit

a vim9script -> lua transpiler (written in Rust)
MIT License
510 stars 21 forks source link

feat: execute command parsing and gen #15

Closed feniljain closed 1 year ago

feniljain commented 1 year ago

Hey @tjdevries :wave:,

A small try to fix #13

Doubt

How to generate the outputs from the snapshots? ( hence also not been able to test this code )

Truth

I am not even remotely sure if this is the correct way to do it, so pardon me if it's all wrong 🙈

tjdevries commented 1 year ago

To generate new snapshots, just run cargo test in the crate that you're working on. If they update, then you need to do cargo insta review (probably need to first do cargo install insta) and then go through the prompts.

tjdevries commented 1 year ago

The only other thing to test would be checking if you can handle each of the situations described by :help :execute

tjdevries commented 1 year ago

Also, add a new test for execute by adding a new file and then adding a test w/ the other ones that loads that file

feniljain commented 1 year ago

Heyo,

One small doubt, are we supporting syntax like this?

execute '!ls' | echo "theend"

If yes then we need to fix it cause currently I get TokenKind as Illegal for Or here, we would need to add support for the same, and I guess that would be better done in a separate PR and for this one, I can support cases:

execute "normal ixxx\<Esc>"
execute "!ls " .. shellescape('./rustfmt.toml', 1)
tjdevries commented 1 year ago

Yeah, we can definitely do more improvements later, I wouldn't worry about the | case yet -- I will have to think about how to support that.

tjdevries commented 1 year ago

(and it looks like I created a conflict in some of the stuff I pushed up so far, so feel free to push and fix the conflict and then I'll review again)

tjdevries commented 1 year ago

sweet! LGTM :)

I'll merge. If you want to do something else, let me know. I'm changing a bunch of stuff locally right now but will push up in the next day or so

feniljain commented 1 year ago

Yeah sure, I will go through the list of issues, and try to pick something up :) ( after your push ofc )

tjdevries commented 1 year ago

The next best one to do would be for remap style items. Working on parsing them would be awesome. You could start w/ just parsing nnoremap (and I could work out how we want to match shortened versions and all that good stuff later)