PowerShell / PowerShell/vscode-powershell
Enhancement: Text Editor Drop API support for .ps1/.psm1 files
Dieses Issue hat noch niemand übernommen.
- 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
Just dropping this here for posterity/discussion. The new vscode release has a proposed API that allows you to drag and drop files into the editor window that will end up stable most likely in the next release.
https://code.visualstudio.com/updates/v1_67#_drop-into-editor
Proposed Design
I think our implementation should translate this into a dot-source, so you can drag a .ps1 file and get a relative path mapping from your current editor. If the editor is unsaved, it will be an absolute path reference instead.
The relative should be built using $PSScriptRoot, so $PSScriptRoot/../mydraggedfile.ps1. Maybe have a preference to toggle this behavior over just normal relative pathing.
Files with a .psd1 or .psm1 prefix would have Import-Module prepended.
Files with a .dll prefix would have Add-Type -path prepended. A binary module should have its .psd1 dropped instead if the intention is to have it via import-module, it's considered bad form to import-module a .dll directly except for testing purposes.
Any other file type would simply drop in as a string reference.
Perhaps have an extensible setting for more file types with a simple templating substitution? For instance a setting like this:
{
"extension": ".xlsx",
"template": "Import-Excel -Path ${filename}"
}
Multiple files dropped would result in individual lines generated for each.
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Keine Quelldatei oder kein Test ist angegeben. Beginne damit, den verlinkten Vorschlag zur VS Code Drop Into Editor API zu prüfen und die Editor-Integration der Erweiterung zu finden; als erledigt würde gelten, wenn die angeforderten Dateityp-Zuordnungen, relativen und absoluten Pfade, mehrere Drops und die vorgeschlagene erweiterbare Einstellung abgedeckt sind.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- powershell, typescript, vscode
- Bereich
- tooling
- Issue-Typ
- Feature
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 25/100