sketch-dev-tools icon indicating copy to clipboard operation
sketch-dev-tools copied to clipboard

documentation tab

Open mathieudutour opened this issue 8 years ago • 5 comments

would it be useful to have a documentation tab?

we could show the headers from https://github.com/abynim/Sketch-Headers, show the docs for the actions, what else?

mathieudutour avatar Oct 30 '17 16:10 mathieudutour

Yeah, this is mainly what I thought of as well. Having the headers in a searchable form right in the panel rather than having to manually search them would save me so much time 😄 ... Other resources could be links to apples docs of objc classes and maybe the Sketch JS API as far as helpful?!

About the Sketch headers, I thought ideally they could be parsed to make the information more accessible for beginners, instead of just showing a plain objc header. It also would be nice to connect this docs panel with the other panels, so e.g. when selecting a logged objc class, you could show the available methods for that class and where they come from inheritance wise ... same goes for the elements tree.

This also ties in with the other proposal you had with the input/playground panel, that lets you run scripts. Being able to quickly access available methods makes experimenting much easier.

julianburr avatar Nov 05 '17 09:11 julianburr

yeah I really want to try to parse the headers. Would be useful for so many things, even after documentation (example: https://github.com/skpm/skpm/issues/73#issuecomment-338924487)

mathieudutour avatar Nov 05 '17 09:11 mathieudutour

I wrote a very basic node script that downloads the headers from abynims sketch headers repo (assuming this is a reliable source of truth for the latest headers) and runs them through some regexes to extract the data and put it into json ... nothing special but maybe a helpful first step

https://gist.github.com/julianburr/03b7ef8b0e90f3ae44026f64cb610564

julianburr avatar Nov 06 '17 14:11 julianburr

nice!

It's actually pretty easy to generate the headers for both Sketch and macOS: https://github.com/skpm/eslint-config-sketch/blob/master/build.js

We could automate both in a single script to generate everything! I'll take a look tomorrow

mathieudutour avatar Nov 06 '17 21:11 mathieudutour

I made a repo with a script to generate the headers + parsing them (changed a bit your script to handle protocols as well and merge the different implementations of the classes): https://github.com/skpm/sketch-headers

It's available as an API but what I was thinking is that the script could be run locally by the devTools the first time (and check when we run a new sketch version, in which case we can regenerate the docs)

mathieudutour avatar Nov 10 '17 15:11 mathieudutour