Thanks rgb, confirmed. The two menus are built by separate code paths and they have drifted apart over time. View Code was added to the Hierarchy menu recently but never made it onto the designer canvas, so the same Button offers different commands depending on where you right-click it.
The check also turned up more of the same: the canvas menu is missing Cut and the ⌘X/⌘C/⌘V shortcut hints even though Cut works fine there through the Edit menu and keyboard, and the Web page designer has the same kind of divergence between its canvas and Hierarchy.
I've logged it here: https://feedback.objo.dev/bug/1708
The fix will build these menus from a single shared definition so every surface offers the same commands, with View Code available from the canvas for controls and for the window background.