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: disable minimap for diffEditor #2956

Merged
merged 2 commits into from
Aug 1, 2023
Merged

Conversation

Aaaaash
Copy link
Member

@Aaaaash Aaaaash commented Jul 27, 2023

Types

  • 🐛 Bug Fixes

Background or solution

editorCollectionService 中将 DiffEditor 中左右两侧的 CodeEditor 包装为 DiffEditorPart,并在一些情况下更新它们的 options,这会将 CodeEditor 的 options 错误的更新到 DiffEditor 中,导致即使 monaco 内部已经在创建 DiffEditor 时关闭了 minimap,也会因为这段逻辑在一些情况下自动开启 minimap。

解决方式是根据 EditorType 区分不同的设置项,对于这种可能混淆的情况,新增了 diffEditor 的自定义配置项,在应用时会自动转换为 editor 配置

🤖 Generated by Copilot at 3f87b17

  • Add support for diff editor feature that allows comparing two files side by side (link, link, link)
  • Merge diffOptions with editorOptions when editor type is greater than EditorType.CODE in editor-collection.service.ts (link)
  • Add converter and schema for diffEditor.minimap preference in converter.ts and schema.ts (link, link)
  • Allow user to enable or disable minimap for diff editor through preference (link, link)

Changelog

🤖 Generated by Copilot at 3f87b17

This pull request adds support for the diff editor feature that allows comparing two files side by side. It modifies the editor-collection.service.ts, converter.ts, and schema.ts files to handle the diffOptions, diffEditor.minimap preference, and the minimap option of the Monaco editor.

@opensumi opensumi bot added the 🐞 bug Something isn't working label Jul 27, 2023
@opensumi
Copy link
Contributor

opensumi bot commented Jul 27, 2023

ChatGPT Code Review:

根据提交的代码和描述,我对代码进行了审查和修改建议,并描述了代码的功能。

修改建议:

  • editor-collection.service.ts 文件中的第 345 行,将 editorOptions 改为 editorOptions = basicEditorOptions
  • editor-collection.service.ts 文件中的第 348 行,将 editorOptions = { ...editorOptions, ...options.diffOptions } 改为 editorOptions = { ...editorOptions, ...options.editorOptions, ...options.diffOptions }

代码功能:

  • 在 Monaco 编辑器中添加了支持两个文件进行对比的 diff 编辑器功能。
  • 修改了 editor-collection.service.tsconverter.tsschema.ts 文件以处理 diffOptionsdiffEditor.minimap 设置和 Monaco 编辑器的小地图选项。

@opensumi opensumi bot added the 🎨 feature feature required label Jul 27, 2023
@codecov
Copy link

codecov bot commented Jul 31, 2023

Codecov Report

Patch coverage: 75.00% and no project coverage change.

Comparison is base (0e433a4) 57.62% compared to head (df07c51) 57.63%.

Additional details and impacted files
@@           Coverage Diff           @@
##            v2.26    #2956   +/-   ##
=======================================
  Coverage   57.62%   57.63%           
=======================================
  Files        1337     1337           
  Lines       84150    84154    +4     
  Branches    17489    17490    +1     
=======================================
+ Hits        48491    48501   +10     
+ Misses      32408    32403    -5     
+ Partials     3251     3250    -1     
Flag Coverage Δ
jsdom 52.64% <75.00%> (+<0.01%) ⬆️
node 16.80% <0.00%> (-0.01%) ⬇️

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

Files Changed Coverage Δ
packages/editor/src/browser/preference/schema.ts 100.00% <ø> (ø)
...es/editor/src/browser/editor-collection.service.ts 65.65% <66.66%> (+<0.01%) ⬆️
...ackages/editor/src/browser/preference/converter.ts 90.54% <100.00%> (+0.12%) ⬆️

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Aaaaash Aaaaash force-pushed the fix/diff-editor-disable-minimap branch from 84eeb3f to df07c51 Compare August 1, 2023 01:21
@Aaaaash
Copy link
Member Author

Aaaaash commented Aug 1, 2023

/next

@opensumi
Copy link
Contributor

opensumi bot commented Aug 1, 2023

🎉 PR Next version 2.26.3-next-1690853207.0 publish successful! You can install this version via npm install package@2.26.3-next-1690853207.0

2.26.3-next-1690853207.0

@Aaaaash Aaaaash merged commit d10597d into v2.26 Aug 1, 2023
13 checks passed
@Aaaaash Aaaaash deleted the fix/diff-editor-disable-minimap branch August 1, 2023 02:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working 🎨 feature feature required
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants