Message Boards Message Boards

GROUPS:

Live code templates

Posted 11 months ago
1687 Views
|
4 Replies
|
24 Total Likes
|

Background

I enjoy coding in the FrontEnd (except it crashes and lookup across files does not exist), but I often miss 'hands on keyboard', customizable code templates.

E.g. I often forget to wrap an option name with quotes "_" or I'm starting a new function and would like to avoid retyping Attributes/Options Catch/Check etc. I don't like palettes for something that I need to do quickly and frequently. The are not 'hands on keyboard' either. So I created a little package/stylesheet, should work on Win/MacOs with MMA 10.4+

https://github.com/kubaPod/DevTools

In case you are interested and/or have any ideas about this / similar features, let me know here or create an Issue in GitHub.

Topic cross posted on Mathematica.stackexchange: https://mathematica.stackexchange.com/q/164653/5478

enter image description here

Index

Most up to date examples, setup and other details can be found in project's Readme.MD

4 Replies

enter image description here - Congratulations! This post is now a Staff Pick as distinguished by a badge on your profile! Thank you, keep it coming!

v0.7.0 (21-02-2018) support for V10.4

As of v0.7.0 code templates will work on V10.4, probably even in earlier versions but I need to check that.

For pre V11 a notebook approach is used instead of an AttachedCell based menu. To enable attached cell method in earlier versions you can run

CurrentValue[$FrontEnd, {TaggingRules, "DevTools", "MenuMethod"}] = "Cell" (*or "Notebook" *) 

but FE crashed for me once or twice and I was not able to reproduce circumstances so do it on your own risk.

v0.8.0 (06-07-2018) VerificationTest template

Wraps an expression with VerificationTest, automatically filling result and encountered messages slots.

v0.10+ NotebookActions

NotebookActions is a feature which is very similar to LiveTemplates but allows to use/customize a menu of arbitrary actions.

Items are even simpler:

<|"Label" -> _String,        "ShortKey" -> _String (*char*), "Action" :> _|>
(*e.g.*)
<|"Label" -> "Print date",   "ShortKey" -> "p",              "Action" :> Print @ Now|>

See more in the Readme.MD and here is a custom example: Add spaces to Mathematica comment delimiters?

enter image description here

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract