Skip to content

Conversation

@anki-code
Copy link
Contributor

@anki-code anki-code commented Jan 9, 2026

Added xonsh shell terminal configuration.

cc #284044

Fixes #286741

Copilot AI review requested due to automatic review settings January 9, 2026 10:43
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds terminal configuration support for the Xonsh shell across Windows, macOS, and Linux platforms, enabling VS Code users to select Xonsh as a terminal profile option.

Key changes:

  • Added Xonsh shell profile configurations for all three major platforms (Windows, macOS, and Linux)
  • Configured platform-specific executable paths and launch arguments

Copy link
Member

@Tyriar Tyriar left a comment

Choose a reason for hiding this comment

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

This isn't the right place to add support, only shells that need some special handling should be included in the setting defaults. Check out the profile discovery code here which would make it show up in the + dropdown:

detectedProfiles.set('Cygwin', {
path: [
{ path: `${process.env['HOMEDRIVE']}\\cygwin64\\bin\\bash.exe`, isUnsafe: true },
{ path: `${process.env['HOMEDRIVE']}\\cygwin\\bin\\bash.exe`, isUnsafe: true }
],
args: ['--login'],
isAutoDetected: true
});
detectedProfiles.set('bash (MSYS2)', {
path: [
{ path: `${process.env['HOMEDRIVE']}\\msys64\\usr\\bin\\bash.exe`, isUnsafe: true },
],
args: ['--login', '-i'],
// CHERE_INVOKING retains current working directory
env: { CHERE_INVOKING: '1' },
icon: Codicon.terminalBash,
isAutoDetected: true
});
const cmderPath = `${process.env['CMDER_ROOT'] || `${process.env['HOMEDRIVE']}\\cmder`}\\vendor\\bin\\vscode_init.cmd`;
detectedProfiles.set('Cmder', {
path: `${system32Path}\\cmd.exe`,
args: ['/K', cmderPath],
// The path is safe if it was derived from CMDER_ROOT
requiresPath: process.env['CMDER_ROOT'] ? cmderPath : { path: cmderPath, isUnsafe: true },
isAutoDetected: true
});

You should use isUnsafe if it's installed in an unsafe directory that other users would have access to (unless the path is derived from process.env).

Created #286741 so this gets covered in release notes/testing if it gets merged.

@Tyriar
Copy link
Member

Tyriar commented Jan 9, 2026

Also note if this goes into /etc/shells it should just work on macOS and Linux.

@Tyriar Tyriar assigned Tyriar and unassigned meganrogge Jan 9, 2026
@Tyriar Tyriar added this to the January 2026 milestone Jan 9, 2026
@anki-code
Copy link
Contributor Author

anki-code commented Jan 9, 2026

@Tyriar the general workflow for xonsh is:

  1. There is python environment on the system: conda-like (recommended) or system-based (not recommended). E.g. user installs conda on Windows/Linux/Mac or user runs apt install python on Ubuntu.
  2. User installs xonsh in this env and adds xonsh to PATH or in rare cases to /etc/shells or another system places.
  3. User runs xonsh

So in fact it's enough to implement simple logic: if we have xonsh or xonsh.exe in PATH we want to have "xonsh" item in "+" menu in vscode. For example the config "terminal.integrated.profiles.linux": {"xonsh": {"path": "xonsh"}} works as expected.

So based on this what do you think? May be we can start from just this:

		detectedProfiles.set('xonsh', {
			path: ['xonsh', 'xonsh.exe'],
			isAutoDetected: true
		});

@anki-code anki-code requested a review from Tyriar January 9, 2026 14:45
Removed Xonsh terminal configuration from the platform configuration.
Removed xonsh terminal configuration from the platform settings.
@Tyriar
Copy link
Member

Tyriar commented Jan 9, 2026

@anki-code if it can be anywhere and you want to find on the PATH I think you'll need to handle it similar to git bash where you look up the executable like this:

// Look for git.exe on the PATH and use that if found. git.exe is located at
// `<installdir>/cmd/git.exe`. This is not an unsafe location because the git executable is
// located on the PATH which is only controlled by the user/admin.
const gitExePath = await findExecutable('git.exe');

I don't think only including xonsh like that without an absolute path will work, but maybe I'm wrong though. You shouldn't need to set unsafePath in this case since $PATH is trusted.

@anki-code
Copy link
Contributor Author

getGitBashPaths logic looks overloaded for xonsh case. Sorry I lost the path I can implement this...

@Tyriar
Copy link
Member

Tyriar commented Jan 9, 2026

You need to return valid absolute files here as we're resolving whether it's a valid profile for the system. You wouldn't be doing everything the git bash one does, but basically just the findExecutable bit and resolving the file:

const gitExePath = await findExecutable('git.exe');
if (gitExePath) {
const gitExeDir = dirname(gitExePath);
gitDirs.add(resolve(gitExeDir, '../..'));
}

@anki-code
Copy link
Contributor Author

@Tyriar what about this?

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

Successfully merging this pull request may close these issues.

Add xonsh shell profile discovery

3 participants