PowerShell / PowerShell/PowerShellEditorServices

Add ShowMessageRequest API to psEditor

Đang mở
#1,111 3 bình luận 1 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Area-psEditor Issue-Enhancement
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

Mô tả

Right now we have the send message notifications hooked up, but there's also a request that looks like this:

image

It would be cool to have that hooked up in a generally accessible way. Right now you can do this:

using namespace OmniSharp.Extensions.LanguageServer.Protocol.Models
using namespace OmniSharp.Extensions.LanguageServer.Protocol.Server
using namespace OmniSharp.Extensions.LanguageServer.Server


# Type name is fully qualified because there's an ILanguageServer
# in both the Protocol and the Server namespaces.
$server = $psEditor.Components.GetService(
    [OmniSharp.Extensions.LanguageServer.Protocol.Server.ILanguageServer])

$task = [ShowMessageRequestExtensions]::Request(
    $server.Window,
    [ShowMessageRequestParams]@{
        Type = [MessageType]::Error
        Message = 'Question that is relevant to the options?'
        Actions = (
            [MessageActionItem]@{ Title = 'Option 1' },
            [MessageActionItem]@{ Title = 'Option 2' })
    })

while (-not $task.AsyncWaitHandle.WaitOne(200)) { }

# This will hold the chosen MessageActionItem
$result = $task.GetAwaiter().GetResult()

Something like this would be great though:

public partial class EditorWindow
{
    public string SendMessage(
        MessageType messageType,
        string caption,
        params string[] options);
}

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu với API EditorWindow của psEditor và truy vết lệnh gọi ShowMessageRequestExtensions hiện có thông qua ILanguageServer và dịch vụ Window của nó. So sánh chữ ký SendMessage được yêu cầu với hỗ trợ thông báo hiện tại và xác định cách MessageActionItem được chọn cần được hiển thị. Công việc được hoàn tất khi một API EditorWindow có thể truy cập một cách tổng quát có thể trình bày các tùy chọn và trả về lựa chọn của người dùng.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
csharp, powershell
Lĩnh vực
developer-experience
Loại issue
Tính năng
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
43/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.