Skip to content

Commit

Permalink
Bugfix/UI flicker on invalidated events (#220)
Browse files Browse the repository at this point in the history
  • Loading branch information
TwitchBronBron authored Feb 10, 2025
2 parents 89cb33c + 0a56e93 commit ec0f562
Show file tree
Hide file tree
Showing 13 changed files with 36 additions and 34 deletions.
4 changes: 2 additions & 2 deletions src/adapters/customVariables/ifGetMessagePort.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { pushCustomVariableToContainer } from './utils';
export function pushIfGetMessagePortVariables(adapter: DebugProtocolAdapter, expression: string, container: EvaluateContainer) {
pushCustomVariableToContainer(adapter, container, {
name: '$messagePort',
type: '',
presentationHint: { kind: 'virtual', lazy: true },
type: VariableType.Object,
presentationHint: { kind: 'virtual' },
evaluateName: `${expression}.GetMessagePort()`,
value: '',
children: []
Expand Down
8 changes: 4 additions & 4 deletions src/adapters/customVariables/ifImageMetadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ import { pushCustomVariableToContainer } from './utils';
export function pushIfImageMetadataVariables(adapter: DebugProtocolAdapter, expression: string, container: EvaluateContainer) {
pushCustomVariableToContainer(adapter, container, {
name: '$metadata',
type: '',
presentationHint: { kind: 'virtual', lazy: true },
type: VariableType.Object,
presentationHint: { kind: 'virtual' },
evaluateName: `${expression}.GetMetadata()`,
value: '',
children: []
});

pushCustomVariableToContainer(adapter, container, {
name: '$thumbnail',
type: '',
presentationHint: { kind: 'virtual', lazy: true },
type: VariableType.Object,
presentationHint: { kind: 'virtual' },
evaluateName: `${expression}.GetThumbnail()`,
value: '',
children: []
Expand Down
4 changes: 2 additions & 2 deletions src/adapters/customVariables/ifRegion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { pushCustomVariableToContainer } from './utils';
export function pushIfRegionVariables(adapter: DebugProtocolAdapter, expression: string, container: EvaluateContainer) {
pushCustomVariableToContainer(adapter, container, {
name: '$bitmap',
type: '',
presentationHint: { kind: 'virtual', lazy: true },
type: VariableType.Object,
presentationHint: { kind: 'virtual' },
evaluateName: `${expression}.GetBitmap()`,
value: '',
children: []
Expand Down
2 changes: 1 addition & 1 deletion src/adapters/customVariables/ifSGNodeChildren.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export function pushIfSGNodeChildrenVariables(adapter: DebugProtocolAdapter, exp
pushCustomVariableToContainer(adapter, container, {
name: '$scene',
type: VariableType.SubtypedObject,
presentationHint: { kind: 'virtual', lazy: true },
presentationHint: { kind: 'virtual' },
evaluateName: `${expression}.getScene()`,
value: '',
children: []
Expand Down
2 changes: 1 addition & 1 deletion src/adapters/customVariables/ifSGNodeField.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export function pushIfSGNodeFieldVariables(adapter: DebugProtocolAdapter, expres
pushCustomVariableToContainer(adapter, container, {
name: '$threadInfo',
type: VariableType.AssociativeArray,
presentationHint: { kind: 'virtual', lazy: true },
presentationHint: { kind: 'virtual' },
evaluateName: `${expression}.threadInfo()`,
value: VariableType.AssociativeArray,
children: []
Expand Down
4 changes: 2 additions & 2 deletions src/adapters/customVariables/ifSGNodeHttpAgentAccess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { pushCustomVariableToContainer } from './utils';
export function pushIfSGNodeHttpAgentAccessVariables(adapter: DebugProtocolAdapter, expression: string, container: EvaluateContainer) {
pushCustomVariableToContainer(adapter, container, {
name: '$httpAgent',
type: '',
presentationHint: { kind: 'virtual', lazy: true },
type: VariableType.Object,
presentationHint: { kind: 'virtual' },
evaluateName: `${expression}.getHttpAgent()`,
value: '',
children: []
Expand Down
6 changes: 3 additions & 3 deletions src/adapters/customVariables/ifSGScreen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { pushCustomVariableToContainer } from './utils';
export function pushIfSGScreenVariables(adapter: DebugProtocolAdapter, expression: string, container: EvaluateContainer) {
pushCustomVariableToContainer(adapter, container, {
name: '$messagePort',
type: '',
presentationHint: { kind: 'virtual', lazy: true },
type: VariableType.Object,
presentationHint: { kind: 'virtual' },
evaluateName: `${expression}.GetMessagePort()`,
value: '',
children: []
Expand All @@ -24,7 +24,7 @@ export function pushIfSGScreenVariables(adapter: DebugProtocolAdapter, expressio

pushCustomVariableToContainer(adapter, container, {
name: '$scene',
type: VariableType.Object,
type: VariableType.SubtypedObject,
presentationHint: { kind: 'virtual' },
evaluateName: `${expression}.GetScene()`,
value: '',
Expand Down
12 changes: 6 additions & 6 deletions src/adapters/customVariables/ifSocket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,26 @@ import { pushCustomVariableToContainer } from './utils';
export function pushIfSocketVariables(adapter: DebugProtocolAdapter, expression: string, container: EvaluateContainer) {
pushCustomVariableToContainer(adapter, container, {
name: '$address',
type: '',
presentationHint: { kind: 'virtual', lazy: true },
type: VariableType.Object,
presentationHint: { kind: 'virtual' },
evaluateName: `${expression}.GetAddress()`,
value: '',
children: []
});

pushCustomVariableToContainer(adapter, container, {
name: '$sendToAddress',
type: '',
presentationHint: { kind: 'virtual', lazy: true },
type: VariableType.Object,
presentationHint: { kind: 'virtual' },
evaluateName: `${expression}.GetSendToAddress()`,
value: '',
children: []
});

pushCustomVariableToContainer(adapter, container, {
name: '$receivedFromAddress',
type: '',
presentationHint: { kind: 'virtual', lazy: true },
type: VariableType.Object,
presentationHint: { kind: 'virtual' },
evaluateName: `${expression}.GetReceivedFromAddress()`,
value: '',
children: []
Expand Down
4 changes: 2 additions & 2 deletions src/adapters/customVariables/ifSprite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ export function pushIfSpriteVariables(adapter: DebugProtocolAdapter, expression:

pushCustomVariableToContainer(adapter, container, {
name: '$region',
type: '',
presentationHint: { kind: 'virtual', lazy: true },
type: VariableType.Object,
presentationHint: { kind: 'virtual' },
evaluateName: `${expression}.GetRegion()`,
value: '',
children: []
Expand Down
4 changes: 2 additions & 2 deletions src/adapters/customVariables/ifVideoPlayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ export function pushIfVideoPlayerVariables(adapter: DebugProtocolAdapter, expres

pushCustomVariableToContainer(adapter, container, {
name: '$captionRenderer',
type: 'roCaptionRenderer',
presentationHint: { kind: 'virtual', lazy: true },
type: VariableType.Object,
presentationHint: { kind: 'virtual' },
evaluateName: `${expression}.GetCaptionRenderer()`,
value: '',
children: []
Expand Down
8 changes: 4 additions & 4 deletions src/adapters/customVariables/ifXMLElement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,17 @@ export function pushIfXMLElementVariables(adapter: DebugProtocolAdapter, express

pushCustomVariableToContainer(adapter, container, {
name: '$childElements',
type: '',
presentationHint: { kind: 'virtual', lazy: true },
type: VariableType.List,
presentationHint: { kind: 'virtual' },
evaluateName: `${expression}.GetChildElements()`,
value: '',
children: []
});

pushCustomVariableToContainer(adapter, container, {
name: '$childNodes',
type: '',
presentationHint: { kind: 'virtual', lazy: true },
type: VariableType.List,
presentationHint: { kind: 'virtual' },
evaluateName: `${expression}.GetChildNodes()`,
value: '',
children: []
Expand Down
8 changes: 4 additions & 4 deletions src/adapters/customVariables/ifXMLList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { pushCustomVariableToContainer } from './utils';
export function pushIfXMLListVariables(adapter: DebugProtocolAdapter, expression: string, container: EvaluateContainer) {
pushCustomVariableToContainer(adapter, container, {
name: '$attributes',
type: '',
presentationHint: { kind: 'virtual', lazy: true },
type: VariableType.List,
presentationHint: { kind: 'virtual' },
evaluateName: `${expression}.GetAttributes()`,
value: '',
children: []
Expand All @@ -24,8 +24,8 @@ export function pushIfXMLListVariables(adapter: DebugProtocolAdapter, expression

pushCustomVariableToContainer(adapter, container, {
name: '$childElements',
type: '',
presentationHint: { kind: 'virtual', lazy: true },
type: VariableType.List,
presentationHint: { kind: 'virtual' },
evaluateName: `${expression}.GetChildElements()`,
value: '',
children: []
Expand Down
4 changes: 3 additions & 1 deletion src/debugSession/BrightScriptDebugSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1438,8 +1438,10 @@ export class BrightScriptDebugSession extends BaseDebugSession {
}
}

// Only send the updated variables if we are not going to trigger an invalidated event.
// This is to prevent the UI from updating twice and makes the experience much smoother to the end user.
response.body = {
variables: this.filterVariablesUpdates(updatedVariables, args, this.variables[args.variablesReference])
variables: sendInvalidatedEvent ? [] : this.filterVariablesUpdates(updatedVariables, args, this.variables[args.variablesReference])
};
} catch (error) {
logger.error('Error during variablesRequest', error, { args });
Expand Down

0 comments on commit ec0f562

Please sign in to comment.