PowerShell / PowerShell/PowerShellEditorServices
CodeLens related commands cause exception to be thrown
还没有人认领这个 Issue。
- 主要语言
- C#
- 星标
- 767
- 派生
- 266
- 平均合并
- 3 天 16 小时
- 30 天内合并 PR
- 1
描述
Prerequisites
- I have written a descriptive issue title.
- I have searched all open and closed issues to ensure it has not already been reported.
- I have read the troubleshooting guide.
- I am sure this issue is with PowerShell Editor Services itself and does not reproduce in a standalone PowerShell instance, and is not an issue with my editor.
- I have verified that I am using the latest version of PowerShell Editor Services.
- If this is a security issue, I have read the security issue reporting guidance.
Summary
In the repository below, I have forked @TylerLeonhardt's old Monaco + PSES example, upgraded to the (almost) latest version of all packages, and wrote up how to reproduce the issue in the README.md.
https://github.com/mhintzke/monaco-powershell
Basically, regardless of OS (Windows or Unix) when the editor detects that the contents contains a basic function, e.g.
function Verb-Noun {
}
Then Monaco Client sends some commands such as textDocument/codeLens and codeLens/resolve. Both of which cause an exception to be thrown here
This is all using very basic configuration of the Monaco Editor and a model URI of inmemory://model.ps1. Basically when these commands are handled by PSES, they attempt to open the file at the uri above, but somehow along the way to the function above, gets translated into an "empty" string.
Because we are working with inmemory models here, I feel like we should just not even attempt to perform a File System read at all. I'm not 100% what the intended function of these commands are, but they might be not applicable in the scenario where we use inmemory models. Please correct me if I am wrong.
PowerShell Version
❯ $PSVersionTable
Name Value
---- -----
PSVersion 7.4.4
PSEdition Core
GitCommitId 7.4.4
OS Microsoft Windows 10.0.22631
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Editor Version
Monaco v7.0.7
PowerShell Editor Services Version
v3.20.1
(Invoke-RestMethod https://api.github.com/repos/PowerShell/PowerShellEditorServices/releases/latest).tag_name // v3.20.1
Steps to Reproduce
See forked repository README.md
Visuals
No response
Logs
No response
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
使用 monaco-powershell fork 及其 README.md 重现该问题,使用 inmemory://model.ps1 URI 和一个基本的 PowerShell 函数。从 src/PowerShellEditorServices/Services/Workspace/WorkspaceService.cs 第 144 行附近开始,跟踪 textDocument/codeLens 和 codeLens/resolve 请求。当这些请求对内存中的模型不再抛出异常时,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- csharp, powershell
- 领域
- api, backend
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100