Skip to content

Commit

Permalink
fix: diff editor missing dirty state indicator (#3521)
Browse files Browse the repository at this point in the history
Co-authored-by: John <qingyi.xjh@antgroup.com>
  • Loading branch information
bytemain and Ricbet authored Apr 11, 2024
1 parent 520435c commit 73928ab
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
10 changes: 8 additions & 2 deletions packages/editor/src/browser/diff/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@ import { Domain, OnEvent, URI, WithEventBus } from '@opensumi/ide-core-browser';
import { LabelService } from '@opensumi/ide-core-browser/lib/services';
import { IFileServiceClient } from '@opensumi/ide-file-service';

import { IDiffResource, IResourceProvider, ResourceDecorationChangeEvent, ResourceService } from '../../common';
import {
IDiffResource,
IResourceProvider,
ResourceDecorationChangeEvent,
ResourceDecorationNeedChangeEvent,
ResourceService,
} from '../../common';
import { BrowserEditorContribution, EditorComponentRegistry, EditorOpenType } from '../types';

// diff URI:
Expand Down Expand Up @@ -32,7 +38,7 @@ export class DiffResourceProvider extends WithEventBus implements IResourceProvi
onResourceDecorationChangeEvent(e: ResourceDecorationChangeEvent) {
if (e.payload.uri && this.modifiedToResource.has(e.payload.uri.toString())) {
this.eventBus.fire(
new ResourceDecorationChangeEvent({
new ResourceDecorationNeedChangeEvent({
uri: this.modifiedToResource.get(e.payload.uri.toString())!,
decoration: e.payload.decoration,
}),
Expand Down
5 changes: 3 additions & 2 deletions packages/editor/src/browser/resource.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,9 @@ export class ResourceServiceImpl extends WithEventBus implements ResourceService
}

@OnEvent(ResourceDecorationNeedChangeEvent)
onResourceDecorationChangeEvent(e: ResourceDecorationNeedChangeEvent) {
this.getResourceDecoration(e.payload.uri); // ensure object
onResourceDecorationNeedChangeEvent(e: ResourceDecorationNeedChangeEvent) {
// ensure object
void this.getResourceDecoration(e.payload.uri);
let changed = false;
const previous = this.resourceDecoration.get(e.payload.uri.toString()) || {};
new Set([...Object.keys(previous), ...Object.keys(e.payload.decoration)]).forEach((key) => {
Expand Down

1 comment on commit 73928ab

@opensumi
Copy link
Contributor

@opensumi opensumi bot commented on 73928ab Apr 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Release Candidate Summary:

Released 🚀 2.27.3-rc-1712837054.0

2.27.3-rc-1712837054.0

user input ref: main

73928ab fix: diff editor missing dirty state indicator (#3521)

Please sign in to comment.