MCPcopy Index your code
hub / github.com/PowerShell/vscode-powershell / showSessionMenu

Method showSessionMenu

src/session.ts:1362–1429  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1360 }
1361
1362 private async showSessionMenu(): Promise<void> {
1363 const powershellExeFinder = new PowerShellExeFinder(
1364 this.platformDetails,
1365 // We don't pull from session settings because we want them fresh!
1366 getSettings().powerShellAdditionalExePaths,
1367 this.logger,
1368 );
1369 const availablePowerShellExes =
1370 await powershellExeFinder.getAllAvailablePowerShellInstallations();
1371
1372 const powerShellItems = availablePowerShellExes
1373 .filter(
1374 (item) =>
1375 item.displayName !== this.PowerShellExeDetails?.displayName,
1376 )
1377 .map((item) => {
1378 return new SessionMenuItem(
1379 `Switch to: ${item.displayName}`,
1380 async () => {
1381 await this.changePowerShellDefaultVersion(item);
1382 },
1383 );
1384 });
1385
1386 const menuItems: SessionMenuItem[] = [
1387 new SessionMenuItem(
1388 `Current session: ${this.PowerShellExeDetails?.displayName ?? "Unknown"} (click to show logs)`,
1389 async () => {
1390 await vscode.commands.executeCommand("PowerShell.ShowLogs");
1391 },
1392 ),
1393
1394 // Add all of the different PowerShell options
1395 ...powerShellItems,
1396
1397 new SessionMenuItem("Restart current session", async () => {
1398 // We pass in the display name so we guarantee that the session
1399 // will be the same PowerShell.
1400 if (this.PowerShellExeDetails) {
1401 await this.restartSession(
1402 this.PowerShellExeDetails.displayName,
1403 );
1404 } else {
1405 await this.restartSession();
1406 }
1407 }),
1408
1409 new SessionMenuItem("Open session logs folder", async () => {
1410 await vscode.commands.executeCommand(
1411 "PowerShell.OpenLogFolder",
1412 );
1413 }),
1414
1415 new SessionMenuItem(
1416 "Modify list of additional PowerShell locations",
1417 async () => {
1418 await vscode.commands.executeCommand(
1419 "workbench.action.openSettings",

Callers 1

registerCommandsMethod · 0.95

Calls 4

restartSessionMethod · 0.95
getSettingsFunction · 0.90

Tested by

no test coverage detected