PowerShell / PowerShell/PowerShellEditorServices
Hook up PSES events to PSEventManager
まだ誰も着手していません。
- 主要言語
- C#
- スター
- 767
- フォーク
- 266
- 平均マージ
- 3日 16時間
- マージ済み PR(30日)
- 1
説明
Right now the only way to register event/request handlers is to override them via IMessageHandlers from the component registry. This has a few issues
-
As far as I can tell this only allows you to override handlers, not add to them. Doing this as part of an extension module would break existing functionality.
-
These delegates are invoked from a thread that doesn't have a default runspace. This means if the delegate is a converted script block it will fail (and crash PSES)
I propose we add the following:
-
Function or cmdlet
Register-EditorEvent. This should work likeRegister-EngineEvent. It would take aSourceIdentifieras the event name and script block to register as aPSEventSubscriber. Ideally this would also include argument completion for event names. -
A class that holds constants with event names (see
PSEngineEvent) -
Additional logic to existing handlers and other events to check for relevant event subscribers and if found generate the event.
-
If the event/handler typically returns a value, a property would need to be added to the
EventArgsto handle output (PowerShell eventing doesn't handle delegate output)
This would solve a few issues
-
Extension modules could register additional handlers the same way in PowerShell and compiled languages
-
Eventing should take care of all the runspace management and queuing of commands that would normally make this a huge pain. This would also allow the events to be ran in between sequence points of an in progress command.
-
Allow multiple handlers for a single request/event
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、コンポーネント レジストリ内の既存の IMessageHandlers を追跡し、提案されている Register-EditorEvent の動作を Register-EngineEvent、PSEventSubscriber、PSEngineEvent と比較します。イベント名の定数、subscriber の登録、handler のディスパッチ、runspace へのキューイング、および EventArgs の出力動作を定義します。完了条件は、既存の handler を置き換えることなく、PowerShell とコンパイル言語の複数の handler が共存できることです。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- csharp, powershell
- 領域
- tooling
- issue の種類
- 機能追加
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 25/100