-
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 AuthenticationForceNewSessionOptions #4115
feat: support AuthenticationForceNewSessionOptions #4115
Conversation
Walkthrough此次更改涉及多个文件,主要集中在身份验证模块的接口和方法签名的更新。首先, Changes
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: 1
🧹 Outside diff range and nitpick comments (2)
packages/types/vscode/typings/vscode.authentication.d.ts (1)
73-83
: 建议添加使用示例以增强文档可读性当前文档说明已经很详细,但建议添加一个简单的代码示例来展示
forceNewSession
的不同使用场景,特别是布尔值与AuthenticationForceNewSessionOptions
对象的区别。示例代码可以是:
// 简单用法 getSession(providerId, scopes, { forceNewSession: true }); // 使用详细选项 getSession(providerId, scopes, { forceNewSession: { detail: '您的会话已过期,请重新认证以确保账户安全' } });packages/extension/src/browser/vscode/api/main.thread.authentication.ts (1)
Line range hint
437-437
: 需要实现 dialog detail 功能代码中存在一个待实现的 TODO 注释,这可能会影响
AuthenticationForceNewSessionOptions
的完整功能支持。建议尽快实现这个特性以确保完整的用户体验。是否需要我帮助生成 dialog detail 的实现代码?
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (3)
- packages/core-common/src/types/authentication.ts (0 hunks)
- packages/extension/src/browser/vscode/api/main.thread.authentication.ts (2 hunks)
- packages/types/vscode/typings/vscode.authentication.d.ts (3 hunks)
💤 Files with no reviewable changes (1)
- packages/core-common/src/types/authentication.ts
🧰 Additional context used
🔇 Additional comments (4)
packages/types/vscode/typings/vscode.authentication.d.ts (2)
43-52
: 新接口定义清晰且文档完善!新增的
AuthenticationForceNewSessionOptions
接口设计合理,detail
属性的文档说明充分解释了其用途,有助于提升用户体验。
218-230
: 类型安全性得到显著提升!
- 使用
readonly string[]
替代string[]
增强了参数不可变性- 通过重载方法和字面量类型(literal types)确保了类型安全
- 明确区分了
createIfNone
和forceNewSession
的使用场景Also applies to: 232-245
packages/extension/src/browser/vscode/api/main.thread.authentication.ts (2)
15-15
: 类型导入声明正确!使用
type
关键字导入 vscode 类型定义是正确的做法,这样可以确保在编译时删除类型信息,不会增加运行时的开销。
252-252
: 参数类型更新符合预期!将 options 参数类型更新为
vscode.AuthenticationGetSessionOptions
正确地实现了与 VSCode API 的对齐,同时保持了类型安全性。
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #4115 +/- ##
=======================================
Coverage 54.25% 54.25%
=======================================
Files 1598 1598
Lines 97561 97561
Branches 19948 19948
=======================================
Hits 52935 52935
Misses 37076 37076
Partials 7550 7550
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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.
LGTM
Types
Background or solution
Support VSCode API: AuthenticationForceNewSessionOptions
Changelog
Summary by CodeRabbit
新功能
AuthenticationForceNewSessionOptions
接口,允许在重新认证时提供更详细的用户提示。变更
AuthenticationGetSessionOptions
接口,调整了会话选项的处理方式。doGetSession
方法的参数类型,以增强类型安全性。