Skip to content
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

fix: check if currentGroup is empty when split terminal #2766

Merged
merged 1 commit into from
May 30, 2023

Conversation

winjo
Copy link
Contributor

@winjo winjo commented May 30, 2023

Types

  • 🐛 Bug Fixes

Background or solution

🤖 Generated by Copilot at f8da187

  • Add guard clause to prevent errors when terminal group is undefined (link)

image
没有 terminal 时如果在菜单点击 split terminal 会报错,此时再打开 terminal 无法创建新的 terminal,因此 split terminal 需要对 view group 进行非空判断

Changelog

🤖 Generated by Copilot at f8da187

Fix a bug that caused errors when executing terminal commands without a group. Add a guard clause to executeTerminalFrontendContribution in terminal.command.ts.

@winjo winjo requested a review from Ricbet May 30, 2023 10:12
@opensumi opensumi bot added the 🐞 bug Something isn't working label May 30, 2023
@opensumi
Copy link
Contributor

opensumi bot commented May 30, 2023

ChatGPT Code Review:

该代码的修改是在 packages/terminal-next/src/browser/contribution/terminal.command.ts 文件中,修复了在没有可用的终端时点击分离(split)终端会报错的问题。解决方法是增加了一个对当前视图组是否为空的判断。如果为空就直接返回,不执行其他操作。这样即使没有终端可用时点击分离终端,也不会报错了。

可优化的地方是,对于分离终端时没有可用终端的情况,可以在界面上给予用户可视化的提示,而不是默默地忽略操作。

@codecov
Copy link

codecov bot commented May 30, 2023

Codecov Report

Patch coverage has no change and project coverage change: -0.01 ⚠️

Comparison is base (638f5d8) 57.72% compared to head (f8da187) 57.71%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2766      +/-   ##
==========================================
- Coverage   57.72%   57.71%   -0.01%     
==========================================
  Files        1327     1327              
  Lines       83585    83587       +2     
  Branches    17380    17381       +1     
==========================================
  Hits        48246    48246              
- Misses      32118    32119       +1     
- Partials     3221     3222       +1     
Flag Coverage Δ
jsdom 52.71% <0.00%> (-0.01%) ⬇️
node 16.79% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...-next/src/browser/contribution/terminal.command.ts 0.00% <0.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@winjo winjo merged commit 86e6d85 into main May 30, 2023
@winjo winjo deleted the fix/split-terminal-group branch May 30, 2023 10:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants