Skip to content

Studio: Don't display available editors label when no editors are present - #1399

Merged
katinthehatsite merged 7 commits into
trunkfrom
fix/hide-avaialable-editors-when-no-installed
May 15, 2025
Merged

Studio: Don't display available editors label when no editors are present#1399
katinthehatsite merged 7 commits into
trunkfrom
fix/hide-avaialable-editors-when-no-installed

Conversation

@katinthehatsite

Copy link
Copy Markdown
Contributor

Related issues

Fixes STU-502

Proposed Changes

This PR ensures that we do not display Available editors editors label when there are no editors installed. Additionally, I made some improvements around the Select label which was not displaying before.

When there are no installed editors:

Screenshot 2025-05-15 at 11 38 06 AM

When the user selected a preferred editor:

Screenshot 2025-05-15 at 11 43 08 AM

When there are installed editor but the user have not selected a preferred editor:

Screenshot 2025-05-15 at 11 42 59 AM

Testing Instructions

When there are no installed editors:

  • Pull the changes from this branch
  • Apply the following diff:
index 31db948e..3b675a96 100644
--- a/src/ipc-handlers.ts
+++ b/src/ipc-handlers.ts
@@ -113,11 +113,11 @@ export async function getSiteDetails( _event: IpcMainInvokeEvent ): Promise< Sit
 
 export function getInstalledAppsAndTerminals(): InstalledApps {
        return {
-               vscode: isInstalled( 'vscode' ),
-               phpstorm: isInstalled( 'phpstorm' ),
-               webstorm: isInstalled( 'webstorm' ),
-               windsurf: isInstalled( 'windsurf' ),
-               cursor: isInstalled( 'cursor' ),
+               vscode: false,
+               phpstorm: false,
+               webstorm: false,
+               windsurf: false,
+               cursor: false,
                terminal: true, // Terminal.app is always available on macOS
                iterm: isInstalled( 'iterm' ),
                warp: isInstalled( 'warp' ),
  • Start the app with npm start
  • Click on User Settings in the top right corner
  • Navigate to Preferences tab
  • Confirm that you can see Select as a default there
  • Confirm that you do not see Available editors label

When the user selected a preferred editor:

  • Start the app with npm start
  • Click on User Settings in the top right corner
  • Navigate to Preferences tab
  • Confirm that you can see your selected editor
  • Confirm that Available editors label is present
  • Confirm that there is no Select

When there are installed editor but the user have not selected a preferred editor:

  • Before testing, make sure to remove the preferredEditor from the appdata under /Users/{yourUser}/Library/Application Support/Studio/appdata-v1.json
  • Pull the changes from this branch
  • Start the app with npm start
  • Click on User Settings in the top right corner
  • Navigate to Preferences tab
  • Confirm that for the Code editor option, you can see Select option
  • Confirm that Available editors label is present

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?
@katinthehatsite katinthehatsite self-assigned this May 15, 2025
} else if ( installedEditors.phpstorm ) {
return { data: 'phpstorm' };
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need this code. I believe we added it to work around feature flag but since we removed the feature flag, we are not providing defaults for code editors so I removed it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is not a good call. Those were added for backwards compatibility. Previously, we were explicitly checking if VSCode and PhpStorm are installed and show the button accordingly. It can easily confuse users after updating the studio version since it would remove the VSCode or PhpStorm button from the overview.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can confirm this is the case: if the preferred editor is not saved in the appdata-v1.json, the editor button gets removed from the Overview tab:

Markup on 2025-05-15 at 12:50:30

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think actually that button not being there is intended since we are now not setting a default editor. It is also mentioned in our docs: https://developer.wordpress.com/docs/developer-tools/studio/frequently-asked-questions/#16-why-isn-t-the-open-in-button-available-for-my-preferred-app-

Studio, the code editors and terminal applications must live in your Applications folder to ensure the Open in… options are available. If you haven’t selected a preferred code editor in your User Settings, no code editor button will appear in the Open in… area.

However, I agree with the point that we should handle this for backwards compatibility. I am going to take a look how to reconcile this, thanks for the feedback @gavande1 👍

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I brought back the code in 9abb507 , I think we should be all good.

@katinthehatsite
katinthehatsite requested a review from a team May 15, 2025 10:16

@gavande1 gavande1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have left a minor comment. Apart from that, it works as expected. LGTM 👍

@ivan-ottinger ivan-ottinger left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch! The proposed changes look good to me and work as expected. 👍🏼

(there's just that one thing Rahul pointed out)


No editors installed:

Markup on 2025-05-15 at 12:39:40

One editor installed, but hasn't been selected:

Markup on 2025-05-15 at 12:42:02

One editor installed and selected:

Markup on 2025-05-15 at 12:43:22

I did not observe any regressions.

} else if ( installedEditors.phpstorm ) {
return { data: 'phpstorm' };
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can confirm this is the case: if the preferred editor is not saved in the appdata-v1.json, the editor button gets removed from the Overview tab:

Markup on 2025-05-15 at 12:50:30

@gavande1 gavande1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for addressing the feedback!

@gcsecsey gcsecsey left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for addressing this! Code changes LGTM and work great.

With the latest version, the Open in button is reverted to the default if the option is not added to appdata yet.
CleanShot 2025-05-15 at 13 12 43@2x

@katinthehatsite
katinthehatsite merged commit 9a79db1 into trunk May 15, 2025
@katinthehatsite
katinthehatsite deleted the fix/hide-avaialable-editors-when-no-installed branch May 15, 2025 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

4 participants