The UXP developer tool isn't saving the source... at least not to disk

,

I’m writing a plug-in for InDesign, but I keep losing my JS code changes when ID crashes.

But in the editor, the code is marked as dirty when I make changes; and then that’s cleared when I “save” it. But if I look at the JS file on disk (using the dev tool’s “Open folder” command), it doesn’t contain my changes.

There’s no “show in Explorer” option in the context menu in the left pane of the UXP tool, and “Copy link address” doesn’t work; it just copies the filename, not the path. And the “Filesystem” tab is useless: It contains nothing, and the “add folder to workspace” button does nothing.

So… WTH?

So are people just not using this, or what? What are you guys doing instead?

Hi,

This is a follow-up to the conversation we started over on the InDesign community forum.

I’m fairly confident that where things are going wrong for you is that you are trying to edit the files of your plugin in the UXP Developer Tools Debugger. I strongly recommend that you don’t do that. You told us that you are using VS Code. Edit your files in VS Code.

I primarily use the Debugger in UXP Developer Tools for the console log which shows me both calls to the log that I have entered manually in my code and errors that are generated when I make mistakes editing my files. When I “Load and Watch” my plugin, all these log messages show up in the console log as I save my files. You told us that ‘Watch’ wasn’t working for you. Rather than trying to figure out why, I thought it might be helpful if you had the files of a very simple plugin to experiment with. Attached is a plugin I have put together. I have named it “Bare Bones”. I have tried to include the minimum code you need.

com.wherebysoftware.barebones.zip (1.8 KB)

To use it . . . Download the attachment. Unzip it. Move the folder “com.wherebysoftware.barebones” to your Documents folder (or certainly somewhere where you know there won’t be any permissions issues for VS Code or UXP Developer Tools). Launch InDesign. Launch UXP Developer Tools. Click “Add Plugin”, navigate to the folder and select the Manifest file to get it in the list. Select it in the list and click “Load & Watch”. Then click “Debug”. In the Debugger window click the tab to show the Console Log. (Don’t do anything else in the Debugger!)

What you should see in the console log is a few calls that I have put in the code of the entry points.setup function. You should see:

Bare Bones Plugin Created
Bare Bones Panel Created
Bare Bones Panel Shown

If that’s what you see, everything is working fine. If you don’t see those lines, it’s not!

The Bare Bones panel in InDesign has a single button titled “Do Something”. Click on it, and you should see ‘Doing something . . .’ in the console log.

In VS Code, open the main.js file. Make a change to the file, any change, even just adding a comment line, and “Save”. UXP Developer Tools will reload the plugin and you should see those initial three lines appear again in the console.

Type some code in the main.js file, making a deliberate mistake, for instance typing ]]] on line 57. Save again, and you should see this error appear in the console:

That’s it. Let me know if it works for you or not.

Philip

Thanks for taking the time to do that,Phillip!

The code-editing issue was put to rest, though. I abandoned the fake UXP editor.

The console-logging problem has always only existed in a stand-alone script. In a stand-alone script, console output goes nowhere. This problem does not involve the UXP Dev Tools at all.

I do have a plug-in working, with a panel and a button to trigger the processing that I want to do. However, maybe you can explain a couple of things to me.

Where in the InDesign UI do “commands” defined by a plug-in appear? The entry points in my manifest:

  "entrypoints": [
    {
      "type": "command",
      "id": "showAlert",
      "label": "Show alert"
    },
    {
      "type": "panel",
      "id": "formatPanel",
      "minimumSize": {
        "width": 230,
        "height": 200
      },
      "maximumSize": {
        "width": 2000,
        "height": 2000
      },
      "preferredDockedSize": {
        "width": 300,
        "height": 300
      },
      "preferredFloatingSize": {
        "width": 300,
        "height": 300
      },
      "label": {
        "default": "MM format panel"
      },

In the Plug-ins menu, I see
MMFormat > MM format panel

But nowhere do I see “Show alert.” Where should we expect to see that?

I have seen “commands” mentioned, but never looked into them. There is a tutorial about them here:

https://developer.adobe.com/indesign/uxp/plugins/tutorials/adding-command-entrypoints/

That says that, once set up, they appear in the Plugins menu.

I have never looked into them because I have not known what the point of them is – I don’t know what a real-world use case would be. Maybe someone else can enlighten us.

Philip

@philipbuckley Use it when allowing the user to trigger the plugin’s function in the menu instead of the panel. If it can be performed in a menu, it is useful for assigning keyboard shortcuts to it in third-party apps.

For example, my private plugins include “Align left”, “Distribute horizontal space”, etc.

The problem is that they don’t appear in the plug-ins menu.

@sttk3 Ah, OK, that makes sense. Thanks

1 Like

@OscarG Have you followed the tutorial? You need code in the three places – in the manifest, in the entrypoints.setup() function, and the function itself to handle the command.

@OscarG Oh sorry, I forgot about that. Photoshop can do it that way, but InDesign may not have been able to do it.

I checked my plugin again and found that I generated the menu myself using InDesign’s Submenu and ScriptMenuAction.

Commands were displayed in the plugins panel in InDesign. That is, not the UI of the individual plugins, but the panel that can be opened by the top item in the plugins menu.

Thanks for the follow-up. That doesn’t happen in mine. The panel is empty except for things I expressly add to it. The tutorial/sample has some hard-cded text in it. That’s all that appears.