Shadow titles: Problem during dev + Asking advice + Idea

Seeking advice for plugin workflow:

1)
When creating a plugin, a regular shadow tiddler might be titled like so

$:/plugins/TWaddle/SuperPlugin/FooTemplate

This is a totally unremarkable and typical title. But the length of such typical titles make the very inconvenient to reference. For example when they, in mid code, have to be explicitly typed out in a transclusions. And referencing fields in them is of course even worse.

2)
System tiddlers (prefix $:/) are intentionally difficult to find - you must use Advanced search or leave it open so it is seen in tab Open.

I guess a workaround during dev of the plugin, is to temporarily title the shadows without their prefixes, an only add the prefixes as a final thing before packing the plugin. But in order to do so, all references to all shadows also have to be updated. This is a very error prone.

So, I ask, how do you guys handle this?

This is a substantial frustration for me during plugin dev.


Here is an outlined solution I would like:

To-be-shadows are really normal tiddlers until they actually become shadows! They’re not even system tiddlers:

This could be achieved with a special prefix e.g ../ representing the full common plugin prefix, i.e $:/plugin/TWaddle/SuperPlugin. So the above tiddler would simply be named ../FooTemplate and a translcusion would be {{../FooTemplate}}

So, during dev these tiddlers are just regular tiddlers. But when they have become shadows, and TW processes the plugin, any occurrence of ../ in the code is interpreted as the full plugin prefix.

Outside of the plugin, the shadow is really addressed with its full title, e.g an overwrite would have the full title.

Thoughts?

I’d setup a macros tiddler.

Instead of referencing the long titles of the tiddlers in the plugin, use the macros as short-hand references.

\define FooTemplate() $:/plugins/TWaddle/SuperPlugin/FooTemplate

So wherever you need to reference that long tiddler name, for example:

<$list filter=[<FooTemplate>get[blahblah]]>

If you want to avoid the risk of conflicts with other plugins, maybe:

\define Twaddle_FooTemplate() $:/plugins/TWaddle/SuperPlugin/FooTemplate

Tested, but too lazy to setup the macro in a macros tiddler:

@twMat I don’t experience the same frustrations as you because I have a range of tools that assist me. Although I rarely package things as a plugin, instead producing JSON packages, I have addressed the same frustrations you expierence.

This is an interesting question of yours, in part because my answers are fragmented into multiple component solutions as I solved them one at a time over the years.

Here are few tips I can detail or give examples later

  • Use the relink plugin and configure additional fields in it if needed - renaming anything is easy
  • Install link to tabs, it lets you find things quickly
  • Install this System Tiddlers.json (571 Bytes) to extend the standard search with additional tabs, make others for needed cases
  • in Editor use ctrl-L a lot and start typing the tiddler title, notice the above search tab(s) now appear there?
    • include tabs for shadow, even projects or prefixes
  • When building a set of tiddlers “$:/PSaT/projectname/*” I create $:/PSaT/projectname with a field called package filter, starting with [prefix[$:/PSaT/projectname]] and add tiddlers with other title patterns as I create or edit tiddlers
    • I have a view template that appears on tiddlers with a package-filter and lists the related tiddlers, including a click to edit and/or copy title to clipboard button.
  • Referencing fields in the current tiddler, TW 5.3.0 finally includes a thisTiddler variable, but I do have a workaround for earlier versions.
  • I have other tools that help me navigate up in a system namespace tiddler, list its children and more.
  • Use Mohamads basket or Favorites in a sidebar tab to collect the titles you are working on for quick reference click to open.
  • Use these extra sidebar tabs for click to edit recent inc system tiddlers edit-recent-sidebars.json (2.9 KB)

I suggest writing plugins only using tiddlers appropriately named for the way you convert them to a plugin. The only thing you need to take account of is once you package it as a plugin you will need filters to include [all[shadows+tiddlers]]

I don’t think your proposed solution is needed once you introduce tools like mine, which I install with a click of a bookmarklet, as and when needed.

As I said I have lots of little packages and even more ideas that help me yet they evolved into my toolset and I have not packaged as a single answer.

For plugin development I use my AdvancedSearchPlus plugin, which allows me to save search-configurations that use system-tiddler prefixes. So the search-tabs will be easily available.

There is a video, that shows how I use the plugin.

have fun!
mario

If you use TiddlyWiki as a development environment it’s hard to do a global “search and replace”. If you use an external dev-environment it’s possible. … but … it’s still very error-prone

Hi @twMat,

I recently started to use @Mohammad’s excellent Gatha edition and it solves some of the hurdles you describe.
For the long names problem I use drag and drop of tiddler links, but @TW_Tones solution for Ctrl+L linking to system tiddlers looks very promising, I’ll have a look.

Have fun!

Fred

1 Like

I may advise to use Gatha Plugin: Beta Release - Create and Distribute Tiddlywiki Plugins

  • It creates a tree like structure, finding your shadow is quite easy
  • It creates boilerplate tiddlers like readme, license, … on the fly
  • It creates macro, styles, widget, … with one click and add all long long prefixes automatically

I think you need a workflow.

Everyone, thanks for your replies.

@Charlie_Veniot - your idea to use macros for references instead of titles is very useful. Thanks!

@TW_Tones - Thanks for your reply, even if much goes way beyond my OP.
The suggestion for @Mohammad 's “Favourites” plugin is very useful. Thank you.

@pmario - AdvancedSearchPlus does look useful. Thanks!

@tw-FRed and @Mohammad - So, referring to my OP, what would the workflow in Gatha be to:

  1. in the middle of the code, type this string: {{$:/plugins/TWaddle/SuperPlugin/FooTemplate!!myfield}}?

  2. locate that tiddler if it is closed so you can open it?

Thanks everyone.

I absolutely go with Autocomplete. See

It gives me tailored autocomplete. I use ?s maens autocomplete for only system tiddler. I can adjust filter to type only few chars of the last part of the name and it complete the whole long long long :wink: title

It always there in the tree structure! See below screenshot

1 Like

Thanks for your reply @Mohammad

So that vtm001 tiddler; does it appear there automatically because it has the same name prefix, or does the tree show the subtiddlers of an existing plugin (bahar)?

Yes, it is appearing in that branch as it has the same name prefix.

@Mohammad, may I suggest a new feature: a “copy-to-clipboard” icon next to each tiddler name in Gatha SideBar tab, to easily be able to copy-paste a tiddler title into code?

Thanks for your work for TW community

Fred

If you open the tree to click on such button, you can just drag and drop the tiddler title.

Yes, it’s what I do already, but I’m quite clumsy with a mouse/touchpad, so a button would be very handy for me. Nevermind, if it’s important enough, I’ll work on it a propose a PR :wink:

Have fun!

Fred

You are not alone.

That’s a pretty common accessibility issue with drag and drop mechanisms no matter where the are applied (software, operating systems, etc.) Certainly for folk with disabilities, but also with folk who aren’t disabled at all.

I trip over myself all of the time.

For example: in TiddlyWiki, the import mechanism constantly kicks in when I drag to select text. (As I select text, my mouse pointer usually ends up on a spot, just about anywhere in the interface, that triggers TiddlyWiki into thinking I am doing a drag and drop, and the import dialog pops up. Constant frustration that drives me up the wall.)

2 Likes

Yes! Yes yes. This. Glad it’s not just me.

You could just disable drag and drop until you need it, perhaps add a page control button to toggle it on and off?

https://tiddlywiki.com/#Hidden%20Setting%3A%20Disable%20Drag%20and%20Drop

I will add this to my todolist, but not as a button, may be as shift+click or some other key combination.

1 Like