PowerShell / PowerShell/PowerShellEditorServices

Add ShowMessageRequest API to psEditor

未关闭
#1,111 3 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

Area-psEditor Issue-Enhancement
主要语言
C#
星标
767
派生
266
平均合并
3 天 16 小时
30 天内合并 PR
1

描述

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);
}

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 psEditor EditorWindow API 开始,通过 ILanguageServer 及其 Window 服务跟踪现有的 ShowMessageRequestExtensions 调用。将请求的 SendMessage 签名与当前的通知支持进行比较,并确定应如何公开所选的 MessageActionItem。当一个普遍可访问的 EditorWindow API 能够呈现这些选项并返回用户的选择时,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
csharp, powershell
领域
developer-experience
Issue 类型
功能
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
43/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。