Skip to content

kubaPod/DevTools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

99 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

(please consider it beta before it hits 1.0.0)

What's there?

Installation / Updating

  • via Wolfram Function Repository: GitHubInstall

    ResourceFunction["GitHubInstall"]["kubapod", "devtools"]

  • Manual way

    Go to 'releases' tab and download appropriate .paclet file.

    Run PacletInstall @ path/to/the.paclet file

  • via MPM

    (*If you don't have MPM` yet*)
    Import["https://raw.githubusercontent.com/kubapod/mpm/master/install.m"] 
    
    Needs @ "MPM`"   
    MPM`MPMInstall["kubapod", "devtools"]
    
    (* now see 'Setup dark stylesheet with all features' section below*)      
    

Uninstall

  PacletUninstall /@ PacletFind["DevTools"];
  DeleteDirectory[FileNameJoin[{$UserBaseDirectory, "ApplicationData", "DevTools"}], 
    DeleteContents -> True
  ];

Quick Guide

Setup dark stylesheet with all features

In order to use the stylesheet as a default one for .m/.wl files, run:

  CurrentValue[$FrontEnd, "DefaultPackageStyleDefinitions"
  ] = FrontEnd`FileName[{"DevTools", "DevPackageDark.nb"}]

And if you don't like it:

  CurrentValue[$FrontEnd, "DefaultPackageStyleDefinitions"
  ] = "Package.nb"

Code templates

Templates menu is available in DevPackageDark.nb stylesheet mentioned above. This stylesheet is not tested for regular notebooks yet but if you want to enable templates menu for any notebook you can run:

Needs @ "DevTools`";
CodeTemplatesEnable[];

Templates menu can be opened with Ctrl + 1 shortkey.

Custom code templates can be added via package toolbar / Templates&Actions / EditCodeTemplates item.

  <| "Template" -> _String | _RowBox (*the only one which is reqiired*)
   , "Label" -> _
   , "ShortKey" -> _?(StringMatchQ[Character])
   , "ExpandSelection" -> _boole:True
   , "Preview" -> _ : None
  |>
  • Template

    • _RowBox : whatever PasteButton can handle it should too
    • _String : StringTemplate syntax with `sel` as a placeholder for a selection data. This needs to be polished as it assumes the selection will be a single token, not a BoxForm.
  • Label, menu item label, is optional but for longer templates it is encouraged.

  • ShortKey, optional, with opened menu it will automatically launch associated template

  • ExpandSelection: whether to expand selection if nothing is selected

  • Preview should be automatically generated form "Template" (unless Template was used as a Label). You can use whatever you want as a preview though.

Alt text

Notebook actions

They are very similar to templates feature.

Actions menu is available in DevPackageDark.nb stylesheet mentioned above. This stylesheet is not tested for regular notebooks yet but if you want to enable actions menu for any notebook you can run:

Needs @ "DevTools`";
NotebookActionsEnable[];  (*NotebookActionsDisable[] to revert changes*)

Difference is that the menu with actions is invoked by Ctrl + , and an action item should look like this:

 <|                        (*!!!   DON'T FORGET ABOUT :> FOR THE ACTION !!! *)       
 "Label"    -> _String,
 "ShortKey" -> _String,
 "Action"   :> foo[]   
 |>