Add an on snippet event to psEditor API
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 25/100
Hướng nghiên cứu
Issue không nêu tên tệp, test hoặc các điểm vào của phần triển khai. Hãy bắt đầu bằng việc xác định psEditor API và luồng xử lý snippet hiện có, sau đó làm rõ mục tiêu là một event, snippets dựa trên command hay cả hai. Phần hoàn tất cần bao gồm một handler contract được định nghĩa cho snippet AST, biến và metadata, cùng với hành vi và test bao quát phạm vi đã chọn.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
#>
- Ngôn ngữ chính
- C#
- Star
- 767
- Fork
- 266
- Merge trung bình
- 3 ngày 16 giờ
- Pull request đã merge (30 ngày)
- 1
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của PowerShell/PowerShellEditorServices
-
[Bug] None of the string overloads of `EditorExtensionServiceProvider.GetService()` work on .NET. Đang mở
PowerShell/PowerShellEditorServices#2331 · 1 reaction · 2 người được giao ·
-
Area-Language Server Issue-Enhancement
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
PowerShell/PowerShellEditorServices#2315 · 1 bình luận ·
-
Area-Debugging Issue-Enhancement
PowerShell/PowerShellEditorServices#2294 · 1 reaction · 2 người được giao ·
-
Issue-Bug Needs: Triage
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
PowerShell/PowerShellEditorServices#2293 · 1 bình luận ·
-
PowerShell/PowerShellEditorServices#2282 · 1 bình luận · 1 reaction · 2 người được giao ·
Tất cả issue của PowerShell/PowerShellEditorServices
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
nightscout/nocturne#1425 ·
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
-
Documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
cake-build/cake#5024 ·
-
Gå gjennom ESLint-suppressions Đang mởFrontend status/draft TechnicalDebt
Độ khó 2/5 1-2 ngày Mức phù hợp với người mới 75/100
Altinn/altinn-auth#4143 ·