fyi, feedback welcomed on what would help you with...
# plugins
h
fyi, feedback welcomed on what would help you with writing plugins
b
I may have put this elsewhere, but instead of trying to write the docs from the inside-out (looking at the various types and describing how to use them) it would be a good idea to do it outside-in (thinking of what need various plugins might fill and showcase how they would do that)
h
That's what the
Common tasks
section is supposed to be doing https://www.pantsbuild.org/docs/common-plugin-tasks. "Want to add a formatter? Here's how". I'm specifically revisiting that "chapter" because it's what
example-plugin
repo is for
1
w
I'll be writing a brief blog article (aiming for release on Monday) about my experiences writing my first plugin, and some of the magic voodoo that I didn't know about beforehand (specifically some of the surprises I had to come to Slack for help with). I can link it to you for a reference of how a pleb like me starts off writing his first plugin?
💯 2
❤️ 3
b
Looking forward to reading it!
f
Some abridged way of searching or visualizing rules available to you... this is hard because there's just so many transitions, but it's hard to keep up with the number of
ThingRequest
->
Thing
triples there are, and where to find the
Thing
you need to complete the task at hand is
1
b
@flat-zoo-31952 I didn't know this existed. https://pantsbuild.slack.com/archives/C0D7TNJHL/p1642639552224100 (Still not the same as searching, but certainly helps IMO)
👀 1
What I usually do though, is use VS Code to find "`-> TypeIWant`", as the return type annotation should always appear in that form, and by one function.
f
that makes sense
w
@hundreds-father-404 As mentioned, I'll be releasing a post today about writing a plugin. I basically just work through a trivial, do-nothing plugin step by step - and what surprised me after the fact, is how many steps I ended up having! https://github.com/sureshjoshi/pants-example-plugin/branches/all - this doesn't include the testing steps yet though. What really helped me start to grok this was to approach the plugin scaffolding first - because that's cookie cutter, and handle the rule last - because that's the most important, biggest chunk, but also the most confusing by miles. I think having a 4 file template (subsystem, rules, target_types, register), with a small blurb + link to the docs at the top of each file is probably saving time for first-timers.
🙌 1
As mentioned - here is that post I wrote. Unfortunately my syntax highlighter and inline code formatter are going crazy town banana pants on me, which makes this more difficult to read than I would hope (until I fix it anyways). https://sureshjoshi.com/development/first-pants-plugin
🎉 3
b
This is terrific. Thank you for contributing this to the community. I've taken the liberty of adding it to the Resource Hub!
🙌 2
h
would it be cool if we tweet this? also definitely some great suggestions for how to improve things, like that
SubsystemRule
issue you've pointed out
w
@hundreds-father-404 Go to town! I don't have Twitter (or any other social media that I can think of), so i'm not much help there :)
🙌 1