Skip to content

Commit

Permalink
fix: always dispose debug unexpected widget in the end
Browse files Browse the repository at this point in the history
  • Loading branch information
erha19 committed Feb 10, 2025
1 parent 9391b86 commit 3d86ea3
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export const AIAction = (props: AIActionProps) => {
});

const Logo = useMemo(() => {
const InlineChatLogo = aiNativeConfigService.inlineChat.logo;
const InlineChatLogo = aiNativeConfigService?.inlineChat.logo;

if (typeof InlineChatLogo === 'string') {
return <img src={InlineChatLogo} className={styles.ai_action_icon} />;
Expand All @@ -105,7 +105,7 @@ export const AIAction = (props: AIActionProps) => {
}

return null;
}, [aiNativeConfigService.inlineChat.logo]);
}, [aiNativeConfigService?.inlineChat.logo]);

/**
* loading 的遮罩
Expand Down
2 changes: 1 addition & 1 deletion packages/core-browser/src/react-hooks/injectable-hooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function isDisposable(target: any): target is Disposable {
export function useInjectable<T = any>(Constructor: Token, args?: any): T {
const { injector } = useContext(ConfigContext);

const instance = useMemo(() => injector.get(Constructor, args), [injector, Constructor]);
const instance = useMemo(() => injector?.get(Constructor, args), [injector, Constructor]);

useEffect(
() => () => {
Expand Down
13 changes: 0 additions & 13 deletions packages/debug/src/browser/debug-session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1092,21 +1092,14 @@ export class DebugSession implements IDebugSession {
return this.connection.onDidCustomEvent;
}

// REPL

hasSeparateRepl(): boolean {
return !this.parentSession || this.options.repl !== 'mergeWithParent';
}

// REPL end

// report service
reportTime(name: string, defaults?: any): (msg: string | undefined, extra?: any) => number {
return this.sessionManager.reportTime(name, defaults);
}

// Cancellation

private getNewCancellationToken(threadId: number, token?: CancellationToken): CancellationToken {
const tokenSource = new CancellationTokenSource(token);
const tokens = this.cancellationMap.get(threadId) || [];
Expand All @@ -1133,8 +1126,6 @@ export class DebugSession implements IDebugSession {
}
}

// Cancellation end

public getDebugProtocolBreakpoint(breakpointId: string): DebugProtocol.Breakpoint | undefined {
const data = this.breakpointManager.getBreakpoints().find((bp) => bp.id === breakpointId);
if (data) {
Expand Down Expand Up @@ -1164,8 +1155,6 @@ export class DebugSession implements IDebugSession {
return this.modelManager.model;
}

// memory

public async readMemory(
memoryReference: string,
offset: number,
Expand All @@ -1188,6 +1177,4 @@ export class DebugSession implements IDebugSession {
}
return Promise.resolve(undefined);
}

// memory end
}
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,12 @@ export class DebugEditorContribution implements IEditorFeatureContribution {
}),
);

this.disposer.addDispose(
this.debugSessionManager.onDidDestroyDebugSession(() => {
this.closeExceptionWidget();
}),
);

this.disposer.addDispose(this.editorDisposer);

this.toggleExceptionWidget();
Expand Down

0 comments on commit 3d86ea3

Please sign in to comment.