wisetime-io / vscode-branch-in-window-title

Visual Studio Code extension that shows the current Git branch in the window title
Apache License 2.0
13 stars 6 forks source link

Show Git Branch with Remote Tools #12

Closed sfc-gh-sgiesecke closed 4 months ago

sfc-gh-sgiesecke commented 2 years ago

For local folders, the extension works fine as expected. However, for remote folders (via Remote-SSH in my case), it doesn't show the branch information. I guess this needs to be handled explicitly. Would it be possible to extend the extension to support that as well?

koenlek commented 2 years ago

Same here

jiakuan commented 2 years ago

When a project is opened from Remote-SSH, no workspace information available through vscode api.

  console.log("remoteName: " + JSON.stringify(vscode.env.remoteName));
  console.log("workspaceFolders: " + JSON.stringify(vscode.workspace.workspaceFolders));

It prints this output:

remoteName: "ssh-remote"
workspaceFolders: undefined

I went through the vscode api, but didn’t find anything related to the Remote workspaces.

Then, I thought to check the source code of the Remote-SSH extension, so we should be able to know how it works. But the Remote-SSH extension is closed source.

Will need to think and investigate more about a possible way to obtain the remote workspace info.

References:

dslijepcevic commented 1 year ago

@jiakuan Hmm, did you try asking here? If it is not possible, then there should be a feature request at least.

jiakuan commented 1 year ago

No I haven't asked there yet. Given the closed source nature, I doubt if there will be a quick resolution in the near future.

However, it still seems a good idea to try asking in their issue list.

AnrDaemon commented 6 months ago

Can you try a local build of #23 to see if it is resolved there as well?

vyshane commented 5 months ago

We have just released v0.2.0. Can you please check if the issue is resolved?

koenlek commented 5 months ago

It mostly works, but I ran into a bug. I was trying out the settings a bit ("Branch Template" and "Branch Name is Prefix") and noticed that after I changed the setting, it would start repeating injected the portion.

I tried a few different settings and used Developer: Reload Window to apply, and now I have:

[develop] - [develop foo] myfile.txt - my_workspace_name (Workspace) [SSH: my_hostname] - [develop]

This bug only seems to have when changing a setting and then reloading the window. If I reload again, it doesn't get better or worse. So I guess just closing VS Code and restarting it should fix it as long as I don't touch those extension settings anymore.

koenlek commented 5 months ago

Restarting VS Code doesn't fix it. I still have my branch name tripled in my title.

AnrDaemon commented 4 months ago

Please edit your workspace title and remove any references to the branch name, then reload window. Since VS Code does not offer an API to manipulate window title in a fool-proof way, the extension relies on a hack to make it work.

koenlek commented 4 months ago

Seems like that works. Thanks!