nobody-famous / alive

Common Lisp Extension for VSCode
The Unlicense
201 stars 18 forks source link

Is `Alive: Compile File` supposed to be wired up yet? #59

Closed smashedtoatoms closed 2 years ago

smashedtoatoms commented 3 years ago

I just tried to run it and got Command 'Alive: Compile File' resulted in an error (command 'alive.compileFile' not found). If it's not supposed to work yet, it's totally fine. I actually didn't know what the compile function did so I don't think I really need it yet. I just wanted to make sure that you know about it. Thanks.

nobody-famous commented 3 years ago

Thanks for finding that! I think it maybe didn't survive a refactor. All the code's still there, but it's not getting called. The command tells swank to compile the file into a fasl file. Apparently nobody uses it, because that code hasn't changed in quite a while.

smashedtoatoms commented 3 years ago

I didn't realize why it was useful until I was walking through an emacs walkthrough to figure out how something unrelated was supposed to work. I figured I'd try it. It seems pretty great because it is supposed to give warnings with line numbers in the editor. When this issue closes I will try it out again. Thanks.

nobody-famous commented 3 years ago

Should be basically working in the version I just put up. The compile output gets printed in the repl.

Fuzzy memories. It's sorta, kinda coming back to me. I'm not sure if the result coming back is specific to each compiler or not because the most useful looking part is a string. Looking through the slime source, though, that doesn't seem to be the case. At least, I didn't see where they're parsing that string, so I don't think it's necessary.

I was thinking that if there was a way to not have it generate the fasl files, or put them under .vscode or something, then that command could be used in the background after edits to give the usual VSCode behavior of highlighting errors as you type. That research apparently never got finished.

nobody-famous commented 3 years ago

I figured out how to get it to relocate the fasl files. I'll look into parsing the response from the compile command and see how that goes.

smashedtoatoms commented 3 years ago

I was thinking that if there was a way to not have it generate the fasl files, or put them under .vscode or something, then that command could be used in the background after edits to give the usual VSCode behavior of highlighting errors as you type.

That is a neat idea.

nobody-famous commented 3 years ago

Added a fix for this. It does similar highlighting to emacs. Added a config option, alive.autoCompileOnType, that does it automatically as you type. The file has to be saved, to compile it, so it ends up auto saving as well.

nobody-famous commented 3 years ago

I have seen it occasionally get stuck where it'll send the compile command to the repl and never get a return message. Not sure what's going on there. Seems like the only fix is to restart the repl.

smashedtoatoms commented 3 years ago

This is fantastic. With the recent batch of updates, this is really working well. Thanks a lot for all your work on this.

nobody-famous commented 3 years ago

I'm going to make some tweaks to the compile behavior. I've found that if I have it copy the buffer to a temp file, then I can have the compile run in the background against that and not force auto save. It also eliminates the need to move the fasl files and will make sense to have it be the default behavior. I'll hopefully have it done soon. Basic idea is working, now trying to keep multiple compiles from running at the same time.

smashedtoatoms commented 3 years ago

Again, that is a rad idea.

smashedtoatoms commented 3 years ago

On a totally unrelated note, I added a bunch of recipes to cl-cookbook. I hope it doesn't generate toil for you, but people have a genuine alternative to emacs with the existence of this plugin and it seems a shame to not put it out there. I'm keen to help on anything you might need a hand with. Feel free to reach out.

nobody-famous commented 3 years ago

Thanks for doing that. It's always an interesting process when putting a tool out to see how long it takes before somebody other than you is talking about it. :-)

The current rabbit hole I've found myself down is the swank-asdf package. It has a compile command that'll compile a package and returns a list of errors like what compile-file returns but for the entire project. I'm thinking I can run that when a file is saved and it'll show in the file explorer what other files you just broke.

If there's anything missing you want to add, feel free. I've been thinking that what I would call the 1.0 release would be when the decision to use this or emacs is purely a personal decision and not a technical one. There's still things that emacs can do that this plugin can't. I don't really know what all they are because I never use emacs, but I've found that they're usually not hard to add once I know what they do.

smashedtoatoms commented 3 years ago

Seems like a great rabbit hole to go down. I don't have anything yet, but I'm only using VSCode and Alive now, so as I encounter things I'll hit you up.

nobody-famous commented 3 years ago

I pushed a fix to have it show errors as you type. I punted on the asdf idea for now. It won't recompile even when giving it the force flag that's supposed to tell it to recompile. :-/ There's some other asdf stuff I'd like to add, for example there's commands to load systems, but I'll do those later.

nobody-famous commented 2 years ago

Going to go ahead and close this one. The compile stuff is working. I added commands for ASDF to load or compile a system, but left them as manual instead of having a way to run them automatically. I also changed the REPL window behavior to use plain enter to execute something instead of a chord. It actually is much nicer that way. :-)