PowerShell / PowerShell/vscode-powershell

Enhancement: Text Editor Drop API support for .ps1/.psm1 files

Aperta
#3,958 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Area-UI Feature: VS Code Issue-Enhancement Up for Grabs
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

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.

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

Non è indicato alcun file sorgente né alcun test. Inizia esaminando la proposta collegata della VS Code Drop Into Editor API e individuando l'integrazione dell'editor dell'estensione; il lavoro sarebbe considerato completato quando saranno coperte le mappature dei tipi di file richieste, i percorsi relativi e assoluti, più drop e l'impostazione estensibile proposta.

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

Valutazione

Stack tecnologico
powershell, typescript, vscode
Ambito
tooling
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.