longform
                                
                                
                                
                                    longform copied to clipboard
                            
                            
                            
                        Add option to `rename` scene to the context menu
Similar to #16, only a rename option. The longform explorer is indeed more useful than the file explorer. But an option to rename scenes more easily is definitely missing.
I'd considered this, but realized the editor itself allows renames. That said, I can add this feature--it does require a partial rewrite of the explorer, though.
yeah; i realized I could also use the header bar. It's not really a must-have-feature, but it would be nice to have, since using the editor instead of the context menu for renaming breaks with the usual habits.
This will be in 2.0.
Hi @kevboh! Found a problem and a solution.
I noticed that renaming files from the Scene list didn't automatically update links. ("Updated X links in Y files").
Simple fix: in SceneList:
diff --git a/src/view/explorer/SceneList.svelte b/src/view/explorer/SceneList.svelte
index 4000ef8..3e7fdeb 100644
--- a/src/view/explorer/SceneList.svelte
+++ b/src/view/explorer/SceneList.svelte
@@ -195,7 +195,8 @@
         // Rename file
         const oldPath = scenePath(editingName, $selectedDraft, app.vault);
         const newPath = scenePath(newName, $selectedDraft, app.vault);
-        app.vault.adapter.rename(oldPath, newPath);
+        const file = app.vault.getAbstractFileByPath(oldPath);
+        app.fileManager.renameFile(file, newPath);
         editingName = null;
         return false;
       } else if (event.key === "Escape") {
This diff uses FileManager.renameFile - "Rename or move a file safely, and update all links to it depending on the user's preferences" (ref)
Notes
- FileSystemAdapter.rename(path, newPath) (ref) is apparently just a thin-wrapper around OS file functions, and doesn't do the Obsidian link tracking magic.
 - Incidentally, there's also Vault.rename(file, newPath) (ref), which also refrains from updating links. (I did try it just to see what it would do 😅 )
 
huh! had no idea, thanks. Really wish the APIs were documented....
The "Rename" option in the context menu of Scenes list is not effectual for me. Clicking it merely closes the context menu. And then I am unable to open the context menu in Scenes list, until I restart Obsidian.
Should I report this as a separate issue?
I think using this one is fine—thanks for flagging.