PowerShell / PowerShell/vscode-powershell

Need a better (cross-platform friendly) way to configure additional PowerShell paths

Offen
#5,233 2 Kommentare 2 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Issue-Enhancement
Vorherrschende Sprache
TypeScript
Sterne
1.9k
Forks
548
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

Prerequisites
  • I have written a descriptive issue title.
  • I have searched all issues to ensure it has not already been reported.
Summary
Context
  • I use PowerShell across operating systems

  • I customized additional PowerShell executables for vscode-powershell using powerShellAdditionalExePaths:

    "powershell.powerShellAdditionalExePaths": {
      "PowerShell 7.5 (macOS)": "/opt/homebrew/bin/pwsh",
      "PowerShell 7 (Windows)": "C:/<path>/<to>/pwsh.exe"
    },
    "powershell.powerShellDefaultVersion": "PowerShell 7 (Windows)",
    
  • I'm syncing and reusing my vscode settings across operating systems

The problem

Every time I work with PowerShell files I have to bear the annoying warning of addtional executable I've configured for the other platform not being found.

Image

Proposed Design

Introduce a new cross-platform/syncing firendly way to customize additional executables

Proposed interface:

type OS = "Windows" | "macOS" | "Linux"

interface AddtionalPowerShellLocation {
  name: String
  path: String
  os: OS
  default: Boolean | undefined
}

type Locations = AddtionalPowerShellLocation[]

To not break[^1] existing powerShellAdditionalExePaths, it'd be a new additionalPowerShellLocations key for holding these locations:

"powershell.additionalPowerShellLocations": [
  {
    "name": "PowerShell 7",
    "path": "/opt/powershell/pwsh",
    "os": "macOS",
    "default": true
  },
  {
    "name": "PowerShell 7",
    "path": "C:/PowerShell/stable/pwsh.exe",
    "os": "Windows",
    "default": true
  },
  {
    "name": "PowerShell Nightly",
    "path": "C:/PowerShell/nightly/pwsh.exe",
    "os": "Windows"
  },
  {
    "name": "PowerShell Nightly",
    "path": "/opt/powershell-nightly/pwsh",
    "os": "macOS"
  },
  {
    "name": "PowerShell 7",
    "path": "/opt/powershell7/pwsh",
    "os": "Linux"
  }
]

Then vscode-powershell can filter out items that are not for the target platform, and launch the first additonal PowerShell executable it successfully resolved. Nothing changes for system fallbacks in this proposal.

powerShellAdditionalExePaths and powerShellDefaultVersion then could be marked as deprecated.

The proposed design might not be optimal, so please comment.

[^1]: It was a breaking change when powerShellAdditionalExePaths was introduced https://github.com/PowerShell/vscode-powershell/issues/4167

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Es wird keine Quelldatei oder kein Test genannt. Beginne damit, den Code zu finden, der powershell.powerShellAdditionalExePaths und powershell.powerShellDefaultVersion liest, und überprüfe anschließend, wie die Erkennung ausführbarer Dateien und die Plattformfilterung funktionieren; abgeschlossen ist die Aufgabe, wenn eine plattformübergreifende additionalPowerShellLocations-Konfiguration funktioniert, ohne die vorhandenen Einstellungen zu beeinträchtigen.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
powershell, typescript
Bereich
developer-experience, tooling
Issue-Typ
Feature
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Ruhig
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.