Skip to content
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

vscode extension? #610

Closed
Yajo opened this issue Oct 30, 2020 · 6 comments
Closed

vscode extension? #610

Yajo opened this issue Oct 30, 2020 · 6 comments

Comments

@Yajo
Copy link

@Yajo Yajo commented Oct 30, 2020

Is your feature request related to a problem? Please describe.
I love toolbox but I don't use it daily because I'd have to type toolbox enter every time.
I develop mainly from vscode and I'd love it if there were a way for it to work always inside the toolbox. Or at least to do it by default.
VSCode supports remote development, and one of the specifically supported environments are containers.

Describe the solution you'd like
I'd like it a lot if there was a "Remote - toolbox" extension that, once installed, lets you just choose the toolbox name for your environment (if you want; otherwise just use default one). Then that would make VSCode do all of its stuff inside the toolbox and not outside of it.

Describe alternatives you've considered
Using the above linked containers extension to configure it to develop inside toolbox, but I don't think it's possible. If it were, some docs on how to do that would be just enough.

@lbssousa
Copy link

@lbssousa lbssousa commented Oct 30, 2020

Related issue on the other side: microsoft/vscode-remote-release#3345

@lbssousa
Copy link

@lbssousa lbssousa commented Oct 30, 2020

There's a PR open here that allows connecting VSCode easily to a Toolbox container via Remote-SSH extension. Another possible approach would be to make toolbox able to export a suitable devcontainer.json file for use with Remote-Containers extension.

@debarshiray
Copy link
Member

@debarshiray debarshiray commented Oct 30, 2020

There's a PR open here that allows connecting VSCode easily to
a Toolbox container via Remote-SSH extension.

Yes, that's #587

@debarshiray
Copy link
Member

@debarshiray debarshiray commented Oct 30, 2020

Let's close this issue and follow-up in the other respective issues.

@lbssousa
Copy link

@lbssousa lbssousa commented Nov 12, 2020

I was able to attach to my Toolbox container through VSCode's Remote-Containers extension. All I have to do is:

  • For containers created with Toolbox up to version 0.0.96, run the following command before starting VSCode:
toolbox -c ${TOOLBOX_CONTAINER_NAME} run true
  • Provide a file $HOME/.config/Code/User/globalStorage/ms-vscode-remote.remote-containers/nameConfigs/${TOOLBOX_CONTAINER_NAME}.json (or $HOME/.var/app/com.visualstudio.com/config/Code/User/globalStorage/ms-vscode-remote.remote-containers/nameConfigs/${TOOLBOX_CONTAINER_NAME}.json, if you're using Flatpak'ed VSCode) like this:
{
  "remoteUser": "${localEnv:USER}",
  "settings": {
    "terminal.integrated.shell.linux": "/usr/sbin/capsh",
    "terminal.integrated.shellArgs.linux": [
      "--caps=",
      "--",
      "-c",
      "exec \"$@\"",
      "/bin/sh",
      // If using Flatpak'ed VSCode, you may want to set explicit value
      // like "/bin/bash" or "/bin/zsh" here.
      // Otherwise, you may get /bin/sh as the
      // default integrated terminal shell.
      "${localEnv:SHELL}",
      "-l"
    ]
  },
  "remoteEnv": {
    "COLORTERM": "${localEnv:COLORTERM}",
    "DBUS_SESSION_BUS_ADDRESS": "${localEnv:DBUS_SESSION_BUS_ADDRESS}",
    "DESKTOP_SESSION": "${localEnv:DESKTOP_SESSION}",
    "DISPLAY": "${localEnv:DISPLAY}",
    "LANG": "${localEnv:LANG}",
    "SHELL": "${localEnv:SHELL}",
    "SSH_AUTH_SOCK": "${localEnv:SSH_AUTH_SOCK}",
    "TERM": "${localEnv:TERM}",
    "VTE_VERSION": "${localEnv:VTE_VERSION}",
    "XDG_CURRENT_DESKTOP": "${localEnv:XDG_CURRENT_DESKTOP}",
    "XDG_DATA_DIRS": "${localEnv:XDG_DATA_DIRS}",
    "XDG_MENU_PREFIX": "${localEnv:XDG_MENU_PREFIX}",
    "XDG_RUNTIME_DIR": "${localEnv:XDG_RUNTIME_DIR}",
    "XDG_SESSION_DESKTOP": "${localEnv:XDG_SESSION_DESKTOP}",
    "XDG_SESSION_TYPE": "${localEnv:XDG_SESSION_TYPE}"
  }
}
  • Give write permission to container's /root folder for my user, since current Remote-Containers will try to install .vscode-server folder there.

  • [EXTRA]: If you're using Flatpak'ed VSCode, you may need this to make it able to attach to your Toolbox container via host system's podman binary.

  • [UPDATE 2020-11-16] In order to avoid breaking your host system's ~/.gitconfig settings, add the following settings to file /root/.vscode-server/data/Machine/settings.json within your container:

{
  "remote.containers.copyGitConfig": false,
  "remote.containers.gitCredentialHelperConfigLocation": "none"
}
@lbssousa
Copy link

@lbssousa lbssousa commented Nov 16, 2020

@debarshiray from my regular tests here, the settings above are enough to allow me to work comfortably within a Toolbox container via VSCode's Remote-Containers extension. You may consider adding a feature to toolbox binary that automates these settings.

anthr76 added a commit to anthr76/tooling that referenced this issue Mar 8, 2021
containers/toolbox#610 (comment)

Signed-off-by: anthr76 <hello@anthonyrabbito.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants