PowerShell / PowerShell/vscode-powershell

Feature Request: Make the PowerShell Extension profile available as a profile.

Aperta
#4,412 6 commenti 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Area-Extension Terminal Issue-Enhancement
Lingua principale
TypeScript
Stelle
1.9k
Fork
548
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

Prerequisites
  • I have written a descriptive issue title.
  • I have searched all issues to ensure it has not already been reported.
Summary

Hello,

I am not good enough with TypeScript/JavaScript to say that I would be able to help actually implement it, but I would like to help if possible.

Currently the extension creates a terminal window and passes the startup scripts to the terminal in code. I would like to propose the idea of fully integrating the terminal created by the extension as.

This would add the following benefits:

  • Users would the ability to have the PowerShell Extension show as one or more profiles in the profile selector.
  • Users can select the PowerShell Extension profile as their default profile in the profile selector.
  • Users can pass arguments to the PowerShell profile at runtime.
  • Make it easier to work with sessions.
  • Existing command workbench.action.terminal.relaunch could be used in place of PowerShell.RestartSession

Users would be able to configure the profile by adding the profile Json to their settings.

{
	"terminal.integrated.profiles.windows": {
		"PowerShell Extension": {
			"title": "PowerShell Extension",
			"env": {
				"${env:Example}": "Test"
			},
			"overrideName": false,
			"args": [],
			"id": "ms-vscode.powershell.PowerShell-Extension",
			"extensionIdentifier": "ms-vscode.powershell"
		}
	}
}
Proposed Design

The way this could be implemented is by adding in the code to have the extension be a terminal provider. Example below taken from the VSCode API reference.

contributes.terminal

Contribute a terminal profile to VS Code, allowing extensions to handle the creation of the profiles. When defined, the profile should appear when creating the terminal profile.

{
  "activationEvents": [
    "onTerminalProfile:my-ext.terminal-profile"
  ],
  "contributes": {
    "terminal": {
      "profiles": [
        {
          "title": "Profile from extension",
          "id": "my-ext.terminal-profile"
        }
      ]
    },
  }
}

When defined, the profile will show up in the terminal profile selector. When activated, handle the creation of the profile by returning terminal options:

vscode.window.registerTerminalProfileProvider('my-ext.terminal-profile', {
  provideProfileOptions(token: vscode.CancellationToken): vscode.ProviderResult<vscode.TerminalOptions | vscode.ExtensionTerminalOptions> {
    return {
      name: 'Profile from extension',
      shellPath: 'bash'
    };
  }
});

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia leggendo l'attuale creazione dei terminali e la gestione degli script di avvio dell'estensione, quindi confrontale con le API contributes.terminal e registerTerminalProfileProvider di VS Code descritte qui. Il lavoro è completato quando l'estensione appare nel selettore dei profili del terminale, supporta la configurazione e gli argomenti di runtime e può usare il flusso standard per riavviare il terminale.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
powershell, typescript, vscode
Ambito
cli, developer-experience, tooling
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.