Skip to content

Commit c57ef86

Browse files
committed
feat: improve debug variables order and fix console log
1 parent e90988a commit c57ef86

4 files changed

Lines changed: 15 additions & 11 deletions

File tree

packages/components/src/recycle-tree/tree/TreeNode.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ export class TreeNode implements ITreeNode {
309309
// 一个普通节点必含有父节点,根节点不允许任何操作
310310
const prevParent = this._parent as CompositeTreeNode;
311311
if (to === null || !CompositeTreeNode.is(to)) {
312-
this.parent = undefined;
312+
this._parent = undefined;
313313
this.dispose();
314314
return;
315315
}

packages/debug/src/browser/tree/debug-tree-node.define.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { CompositeTreeNode, ITree, ITreeNodeOrCompositeTreeNode, TreeNode } from '@opensumi/ide-components';
22
import { MessageType, localize } from '@opensumi/ide-core-browser';
3-
import { IRange, isDefined } from '@opensumi/ide-core-common';
3+
import { IRange } from '@opensumi/ide-core-common';
44
import { Path } from '@opensumi/ide-utils/lib/path';
55
import { Range } from '@opensumi/monaco-editor-core/esm/vs/editor/common/core/range';
66
import { DebugProtocol } from '@opensumi/vscode-debugprotocol/lib/debugProtocol';
@@ -114,19 +114,23 @@ export class ExpressionTreeService {
114114
}
115115

116116
sortComparator(a: ITreeNodeOrCompositeTreeNode, b: ITreeNodeOrCompositeTreeNode) {
117-
// 当存在 variablesReference 属性时,默认按大小进行排序
118-
if (isDefined((a as any).variablesReference) && isDefined((b as any).variablesReference)) {
119-
return (a as any).variablesReference - (b as any).variablesReference;
120-
}
121117
if (a.constructor === b.constructor) {
122-
return a.name > b.name ? 1 : a.name < b.name ? -1 : 0;
118+
const aName = a.displayName || a.name;
119+
const bName = b.displayName || b.name;
120+
const isASymbol = !/[a-zA-Z0-9]/.test(aName.charAt(0));
121+
const isBSymbol = !/[a-zA-Z0-9]/.test(bName.charAt(0));
122+
if (isASymbol && !isBSymbol) {
123+
return 1;
124+
} else if (!isASymbol && isBSymbol) {
125+
return -1;
126+
}
127+
return aName.localeCompare(bName, 'en', { numeric: true }) as any;
123128
}
124-
return CompositeTreeNode.is(a) ? 1 : CompositeTreeNode.is(b) ? -1 : 0;
129+
return CompositeTreeNode.is(a) ? -1 : CompositeTreeNode.is(b) ? 1 : 0;
125130
}
126131
}
127132

128133
export class DebugConsoleTreeService extends ExpressionTreeService {
129-
// 按照默认次序排序
130134
sortComparator(a: ITreeNodeOrCompositeTreeNode, b: ITreeNodeOrCompositeTreeNode) {
131135
if (!a) {
132136
return 1;

packages/debug/src/browser/view/console/debug-console-session.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export class DebugConsoleSession implements IDebugConsoleSession {
108108
let output = body.output;
109109
if (output.indexOf(clearAnsiSequence) >= 0) {
110110
this.clearConsole();
111-
await this.insertItemWithAnsi(localize('debug.console.consoleCleare'), MessageType.Info);
111+
await this.insertItemWithAnsi(localize('debug.console.consoleCleared'), MessageType.Info);
112112
output = output.substring(output.lastIndexOf(clearAnsiSequence) + clearAnsiSequence.length);
113113
}
114114
const previousItem = this.getLastItem();

packages/debug/src/browser/view/variables/debug-variables.view.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ export const DebugVariableRenderedNode: React.FC<IDebugVariableNodeRenderedProps
191191
};
192192

193193
const paddingLeft = `${
194-
(defaultLeftPadding || 8) + (item.depth || 0) * (leftPadding || 0) + (ExpressionContainer.is(item) ? 0 : 16)
194+
(defaultLeftPadding || 8) + (item.depth || 0) * (leftPadding || 0) + (ExpressionContainer.is(item) ? 0 : 18)
195195
}px`;
196196

197197
const editorNodeStyle = {

0 commit comments

Comments
 (0)