PowerShell / PowerShell/PowerShellEditorServices
Add an on snippet event to psEditor API
まだ誰も着手していません。
- 主要言語
- C#
- スター
- 767
- フォーク
- 266
- 平均マージ
- 3日 16時間
- マージ済み PR(30日)
- 1
説明
It'd be nice to have an event we could hook into when a snippet is used. It would be great if the
the ast of the snippet, the variables, and maybe snippet metadata like name was passed to the handler.
Alternatively (or additionally) allow editor commands to act like snippets (e.g. set "variables" to
tab to, etc.) This would enable dynamic snippets that can expand or shape the snippet based on command
output.
A very simple mock up:
/* VSCode snippet example */
"Comment Help with PowerShell Output": {
"prefix": "CommentHelp",
"body": [
"<#",
".SYNOPSIS",
" ${Short description}",
".DESCRIPTION",
" ${Long description}",
".NOTES",
" Date: ${PowerShell1:Get-Date -Format MM-dd-yyyy}",
".LINK",
" ${PowerShell2:Get-Command -Module \\$MyInvocation.MyCommand.Module.Name}",
"#>"
]
}
# PowerShell event handler.
$eventHandler = {
param($snippetVariables)
foreach ($variable in $snippetVariables) {
if ($variable.Name.StartsWith('PowerShell')) {
$script = [scriptblock]::Create($variable.Value)
$output = & $script
$psEditor.GetEditorContext().CurrentFile.InsertText($output, $variable.Range)
}
}
}
<#
.SYNOPSIS
Short description
.DESCRIPTION
Long description
.NOTES
Date: 04-12-2017
.LINK
Get-Function1
Get-Function2
Get-Function3
#>
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
Issue では、ファイル、テスト、実装のエントリポイントが指定されていません。まず psEditor API と既存の snippet 処理パスを特定し、次に目標がイベント、コマンドに基づく snippets、またはその両方のどれなのかを明確にしてください。完了条件には、snippet AST、変数、メタデータに対する定義済みの handler 契約と、選択したスコープをカバーする動作およびテストを含める必要があります。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- csharp, powershell
- 領域
- api, tooling
- issue の種類
- 機能追加
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 25/100