-
Notifications
You must be signed in to change notification settings - Fork 403
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: support VSCode API: inputBox.valueSelection #4145
Conversation
Walkthrough此拉取请求对 Changes
Possibly related PRs
Suggested labels
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (1)
packages/extension/src/hosted/api/vscode/ext.host.quickopen.ts (1)
Line range hint
673-691
: 建议在 getOptions 中添加 valueSelection当前
getOptions
方法没有包含valueSelection
属性。为了确保选择范围能够正确同步到 UI,建议将其添加到返回的选项中。建议按如下方式修改:
getOptions(): QuickInputOptions { return { value: this.value, + valueSelection: this.valueSelection, prompt: this.prompt, placeHolder: this.placeholder, password: this.password, ignoreFocusOut: this.ignoreFocusOut, title: this._title, totalSteps: this.totalSteps, step: this.step, validationMessage: typeof this.validationMessage === 'string' ? this.validationMessage : this.validationMessage?.message, buttons: this.buttons as unknown as QuickTitleButton[], busy: this.busy, enabled: this.enabled, hideOnDidAccept: this.hideOnDidAccept, }; }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (3)
packages/extension/src/hosted/api/vscode/ext.host.quickopen.ts
(2 hunks)packages/quick-open/src/browser/quick-open.widget.tsx
(0 hunks)packages/types/vscode/typings/vscode.quickpick.d.ts
(1 hunks)
💤 Files with no reviewable changes (1)
- packages/quick-open/src/browser/quick-open.widget.tsx
🔇 Additional comments (3)
packages/types/vscode/typings/vscode.quickpick.d.ts (1)
380-389
: 代码变更符合预期!
新增的 valueSelection
属性定义完整且清晰:
- 类型定义为只读元组,确保了类型安全
- 详细的文档说明了属性的用途和行为
- 与
InputBoxOptions
接口中的同名属性保持一致 - 补充了重要的使用说明,特别是关于该属性不会随用户输入自动更新的提醒
packages/extension/src/hosted/api/vscode/ext.host.quickopen.ts (2)
449-449
: 属性定义正确!
_valueSelection
属性的类型定义合理,使用 tuple 类型 [number, number]
来存储选择范围的起始和结束位置,并通过 | undefined
支持无选择状态。
569-576
: 访问器实现完善!
getter 和 setter 的实现遵循了类中其他属性的模式:
- getter 直接返回私有属性
- setter 更新私有属性并通过
update
方法触发界面更新
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4145 +/- ##
==========================================
- Coverage 54.23% 54.22% -0.02%
==========================================
Files 1598 1598
Lines 97627 97657 +30
Branches 19968 19976 +8
==========================================
+ Hits 52949 52952 +3
- Misses 37110 37131 +21
- Partials 7568 7574 +6
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Types
Background or solution
support VSCode API: inputBox.valueSelection
Changelog
Summary by CodeRabbit
新功能
valueSelection
属性,允许用户选择输入值的范围。bug 修复
QuickOpenWidget
中valueSelection
的访问方式,提升了性能。文档
InputBox
接口的文档,说明了新属性的使用和行为。