Using `packs` in VSCode Extension for Faster Feedback: Installation and Setup Instructions

This message was imported from the Ruby/Rails Modularity Slack server. Find more info in the import thread.

Hey all! The most recent release of packs (packwerk built in Rust) can now be used in the VSCode Extension! This gives much faster feedback while writing code.

If you try it out, I’d love to hear your feedback! Instructions on how to install and set up in VSCode listed in the readme: https://github.com/alexevanczuk/packs

Message originally sent by slack user U717FXJ8HWK

This is so cool, it makes the experience so much more pleasant :+1:

Some notes:
• There’s some kind of off-by-one error, for example, if Model.find(123) is a violation, Model. gets highlighted including the .
• You’re probably already aware of this, but making packs check read from stdin and linting the active buffer would make the experience even better

Yeah, I’ve seen that off by one error before, I think it’s in the extension itself.

Can you elaborate on that second point?

Message originally sent by slack user U717FXJ8HWK

To be able to lint as you type, there needs to be a way to provide the contents of the file as it’s being edited to packs check, otherwise packs can only check files that are saved to disk. AFAIK this is exactly what rubocop editor integrations do: they provide the current file through STDIN and they also provide the file name though CLI arguments.

Message originally sent by slack user U717FXJ8HWK

Very roughly it would be echo current_file_contents | packs check - --file-name packs/foo/app/models/bar.rb

Oh interesting! This sounds like an extension feature as well. I’m not doing much work on the vscode extension (besides the alternate executable), but if you wanted to iterate on it, by all means :smile:

Message originally sent by slack user U717FXJ8HWK

On that note, I also have a private repo with the IntelliJ extension (mostly meant for RubyMine). It’s very barebones and it has the same problem of being very slow. :smile: It’d be great to release it, but I’m not sure I can find the time for this in the near future, considering I’m very new to both Kotlin and IntelliJ Platform API.

Ooo, I think a lot of folks would love a packwerk rubymine extension!!

<@U717FXJ8HWK> YES please, both packwerk and sorbet see a lot of VSCode extensions and LSP support that I wish I could use in RubyMine :sob:

Message originally sent by slack user U717FXJ8HWK

I’ll open source it soon enough. :+1: But keep in mind it still needs some work

Message originally sent by slack user U717FXJ8HWK

https://rubymod.slack.com/archives/C02TLU33RNW/p1688376082883609