opensumi / core

🚀 A framework helps you quickly build AI Native IDE products. https://preview.opensumi.com
https://opensumi.com
MIT License
2.81k stars 354 forks source link

fix: sync dirty state when will save document #3817

Closed bytemain closed 2 weeks ago

bytemain commented 2 weeks ago

Types

Background or solution

现状是 ext 层 document 的 dirty 状态会和 browser 层不同步。

如果此时 browser 层的文本是非 dirty 的,也就意味着它不会向插件层发送 Save 事件,这里我们在 onWillSave 的时候发一个事件去同步当前的状态。

这样至少保证了用户按 ctrl+s 的时候,状态能同步到 ext host

Changelog

fix extesnion document state may not sync from main thread

codecov[bot] commented 2 weeks ago

Codecov Report

Attention: Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.

Project coverage is 55.32%. Comparing base (7c7abcc) to head (4047838).

Files Patch % Lines
...sion/src/hosted/api/vscode/doc/doc-manager.host.ts 0.00% 2 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## v3.1 #3817 +/- ## ========================================== - Coverage 55.33% 55.32% -0.01% ========================================== Files 1540 1540 Lines 93908 93909 +1 Branches 19290 19290 ========================================== - Hits 51961 51956 -5 - Misses 34798 34804 +6 Partials 7149 7149 ``` | [Flag](https://app.codecov.io/gh/opensumi/core/pull/3817/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensumi) | Coverage Δ | | |---|---|---| | [jsdom](https://app.codecov.io/gh/opensumi/core/pull/3817/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensumi) | `50.78% <0.00%> (-0.01%)` | :arrow_down: | | [node](https://app.codecov.io/gh/opensumi/core/pull/3817/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensumi) | `15.55% <0.00%> (-0.01%)` | :arrow_down: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensumi#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.