PowerShell / PowerShell/vscode-powershell
Please support programmatic open-file at custom line number/position (for programmatic go-to-definition scenario)
Nessuno ha ancora preso questa issue.
- 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
I am migrating from the old powershell_ISE to powershell 7. One thing I used to do a LOT in the ps ISE world is a non-IDE-initiated Go-To-Definition. This was implemented as a command (i.e. Def MyFunction, if inside ISE, then it just opens there and sets the cursor to the position; if outside the ISE then it would open the ISE and set the cursor position there)
In the VSCode plugin, there is F12/Go-to-Definition in the UI, but I seem to be blocked from implementing it in command form (or I can’t find it). I did find “Open-EditorFile” which is close, but it does not allow me to point to a specific line, the way I could with the powershell_ise. In particular, $psise.CurrentFile.Editor.SetCaretPosition could be used to fine-tune where the cursor is pointing, but the $psEditor object seems to be highly restricted.
Would it be possible to get a feature to $psEditor.Workspace to have a function to open / jump to a given file+line? E.g. OpenFile(string filePath, uint32 lineNumber, uint32 columnNumber)? Allowing the user to 'pop' any file and line number they want is always going to be the most capable option, allowing people to jump to code that may be too obscurely done for the mainstream ISE to ever track.
(optionally, also add a psEditor.WorkSpace.GoToDefinition which more directly mirrors the existing UI option)
Proposed Design
Please add a new overload for $psEditor.Workspace.OpenFile, such as OpenFile(string filePath, uint32 **lineNumber**, uint32 columnNumber)
(Also expose this overload in the CmdletInterface.ps1 file.)
Optionally, also add psEditor.WorkSpace.GoToDefinition(string identifier) and expose that in the CmdletInterface.ps1 as well.
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia esaminando l’API esistente $psEditor.Workspace.OpenFile e l’esposizione tramite CmdletInterface.ps1 menzionata nell’issue. Determina come dovrebbe integrarsi nell’interfaccia corrente un overload che accetti filePath, lineNumber e columnNumber; il lavoro è completo quando i chiamanti possono aprire un file nella posizione richiesta, trattando separatamente l’API opzionale GoToDefinition.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- typescript, vscode
- Ambito
- developer-experience, tooling
- Tipo di issue
- Funzionalità
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 32/100