Skip to content

The Go Home menu lost in 3.9 #3237

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
futurist opened this issue Apr 27, 2021 · 12 comments
Closed

The Go Home menu lost in 3.9 #3237

futurist opened this issue Apr 27, 2021 · 12 comments

Comments

@futurist
Copy link

futurist commented Apr 27, 2021

OS/Web Information

  • Remote Architecture:
  • code-server --version: 3.9.3

Steps to Reproduce

  1. Start code-server 3.9.3
  2. Open in browser, and lost the Go Home top-left menu.

Expected

The Go Home menu exists in all previous versions.

Actual

It displays a Log out menu instead.

Notes

We need below command in a plugin, and now it's not work:

vscode.commands.executeCommand('workbench.actions.goHome')

This issue can be reproduced in VS Code: No.

@jsjoeio
Copy link
Contributor

jsjoeio commented Apr 27, 2021

This was intentionally removed in 3.9.2. VS Code made some changes and removed it so we had to remove it.

See release notes for 3.9.2: https://github.com/cdr/code-server/releases/tag/v3.9.2
And PR where it was removed: #2862

If you need to write a plugin/extension that adds similar functionality, you may want to look into the Contribution Points documentation.

Lastly, if you want to see how we added a "Log out" button to the menu in code-server, you'll find the code here and the PR: #2922

Hope that helps!

@jsjoeio jsjoeio closed this as completed Apr 27, 2021
@futurist
Copy link
Author

futurist commented Apr 28, 2021

@jsjoeio Thank you very much for the quick reply and info. Just one more thing need to help, seeing there's no way to access window.location in extension, so is there any way to register a navigationActions like previous 3.8 code below?

registerAction2(class extends Action2 {
    constructor() {
	    super({
		    id: `workbench.actions.goHome`,
		    title: nls.localize('goHome', "Go Home"),
		    menu: { id: MenuId.MenubarWebNavigationMenu }
	    });
    }
    async run(): Promise<void> {
	    window.location.href = homeIndicator.href;
    }
});

I want to do it in my extension, is it possible? Or maybe have to modify the code-server source code to re-enable this command? (no need re-appear in the menu, just can be invoked in my extension is fine.)

@jsjoeio
Copy link
Contributor

jsjoeio commented Apr 28, 2021

Hmm...this is a great question. I am not 100% sure about whether it's possible to register a navigationAction like before 🤔

modify the code-server source code to re-enable this command

We are working on a plugin API which may provide a possibility to add something like this without modifying code-server's source. Let me see if @code-asher has any insight or suggestions.

@code-asher
Copy link
Member

I ran into this when trying to implement the logout button using an extension. It's possible to open a URL with openExternal (https://code.visualstudio.com/api/references/vscode-api#env) however I had two problems:

  1. Relative URLs didn't work (I wanted to redirect to ./login).
  2. It opens in a popup instead of redirecting the current page.

So currently my ideas are:

  1. Modify openExternal.
  2. Extend VS Code's API with a new method.

Both ideas aren't that great though since we don't have the ability to change the VS Code API types. So the only real solution is to submit a patch upstream that modifies openExternal, I think.

@code-asher
Copy link
Member

Third idea: make it so code-server extensions can modify VS Code then add the extra API there. Feels a bit strange but maybe it could work.

@futurist
Copy link
Author

Maybe there's a way to postMessage() to browser window? If such it's more secure and isolating, the side effects can totally depends on the container window.

@code-asher
Copy link
Member

Do you mean an existing way or as a suggestion for how to implement the API if we were to add it? If it's the first case, I don't believe there's an existing way outside of web views. 😢

@futurist
Copy link
Author

Do you mean an existing way or as a suggestion for how to implement the API if we were to add it? If it's the first case, I don't believe there's an existing way outside of web views. 😢

Just a suggestion for how the API like.

Also, since code-server always run in browser, it's reasonable for this feature?

@code-asher
Copy link
Member

Yeah I think it's reasonable as well.

@melissa-barca
Copy link

Since this issue has been closed, is there one open for tracking adding the ability to open a URL in the same tab?

@code-asher
Copy link
Member

I don't believe there is yet.

@futurist
Copy link
Author

I've created one: #3363

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants