Skip to content

Commit

Permalink
debug: fix mismatched indentation for folders in loaded scripts (#236750
Browse files Browse the repository at this point in the history
)

* debug: fix mismatched indentation for folders in loaded scripts

Fixes #228241

* fix test
  • Loading branch information
connor4312 authored Dec 21, 2024
1 parent d4de5ce commit d6a59b7
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 38 deletions.
2 changes: 1 addition & 1 deletion src/vs/workbench/contrib/debug/browser/baseDebugView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export interface IVariableTemplateData {

export function renderViewTree(container: HTMLElement): HTMLElement {
const treeContainer = $('.');
treeContainer.classList.add('debug-view-content');
treeContainer.classList.add('debug-view-content', 'file-icon-themable-tree');
container.appendChild(treeContainer);
return treeContainer;
}
Expand Down
78 changes: 42 additions & 36 deletions src/vs/workbench/contrib/debug/browser/loadedScriptsView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,47 +3,46 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import * as nls from '../../../../nls.js';
import { IViewletViewOptions } from '../../../browser/parts/views/viewsViewlet.js';
import { normalize, isAbsolute, posix } from '../../../../base/common/path.js';
import { ViewPane, ViewAction } from '../../../browser/parts/views/viewPane.js';
import { IInstantiationService, ServicesAccessor } from '../../../../platform/instantiation/common/instantiation.js';
import { IContextMenuService } from '../../../../platform/contextview/browser/contextView.js';
import { IKeybindingService } from '../../../../platform/keybinding/common/keybinding.js';
import { IConfigurationService } from '../../../../platform/configuration/common/configuration.js';
import { renderViewTree } from './baseDebugView.js';
import { IDebugSession, IDebugService, CONTEXT_LOADED_SCRIPTS_ITEM_TYPE, LOADED_SCRIPTS_VIEW_ID } from '../common/debug.js';
import { Source } from '../common/debugSource.js';
import { IWorkspaceContextService, IWorkspaceFolder } from '../../../../platform/workspace/common/workspace.js';
import { IContextKey, IContextKeyService, ContextKeyExpr } from '../../../../platform/contextkey/common/contextkey.js';
import { normalizeDriveLetter, tildify } from '../../../../base/common/labels.js';
import { isWindows } from '../../../../base/common/platform.js';
import { URI } from '../../../../base/common/uri.js';
import { ltrim } from '../../../../base/common/strings.js';
import { RunOnceScheduler } from '../../../../base/common/async.js';
import { ResourceLabels, IResourceLabelProps, IResourceLabelOptions, IResourceLabel } from '../../../browser/labels.js';
import { FileKind } from '../../../../platform/files/common/files.js';
import { IListVirtualDelegate } from '../../../../base/browser/ui/list/list.js';
import { ITreeNode, ITreeFilter, TreeVisibility, TreeFilterResult, ITreeElement } from '../../../../base/browser/ui/tree/tree.js';
import { IListAccessibilityProvider } from '../../../../base/browser/ui/list/listWidget.js';
import { IEditorService } from '../../../services/editor/common/editorService.js';
import { WorkbenchCompressibleObjectTree } from '../../../../platform/list/browser/listService.js';
import { dispose } from '../../../../base/common/lifecycle.js';
import { createMatches, FuzzyScore } from '../../../../base/common/filters.js';
import { DebugContentProvider } from '../common/debugContentProvider.js';
import { ILabelService } from '../../../../platform/label/common/label.js';
import { TreeFindMode } from '../../../../base/browser/ui/tree/abstractTree.js';
import type { ICompressedTreeNode } from '../../../../base/browser/ui/tree/compressedObjectTreeModel.js';
import type { ICompressibleTreeRenderer } from '../../../../base/browser/ui/tree/objectTree.js';
import { registerAction2, MenuId } from '../../../../platform/actions/common/actions.js';
import { ITreeElement, ITreeFilter, ITreeNode, TreeFilterResult, TreeVisibility } from '../../../../base/browser/ui/tree/tree.js';
import { RunOnceScheduler } from '../../../../base/common/async.js';
import { Codicon } from '../../../../base/common/codicons.js';

import { IViewDescriptorService } from '../../../common/views.js';
import { createMatches, FuzzyScore } from '../../../../base/common/filters.js';
import { normalizeDriveLetter, tildify } from '../../../../base/common/labels.js';
import { dispose } from '../../../../base/common/lifecycle.js';
import { isAbsolute, normalize, posix } from '../../../../base/common/path.js';
import { isWindows } from '../../../../base/common/platform.js';
import { ltrim } from '../../../../base/common/strings.js';
import { URI } from '../../../../base/common/uri.js';
import * as nls from '../../../../nls.js';
import { MenuId, registerAction2 } from '../../../../platform/actions/common/actions.js';
import { IConfigurationService } from '../../../../platform/configuration/common/configuration.js';
import { ContextKeyExpr, IContextKey, IContextKeyService } from '../../../../platform/contextkey/common/contextkey.js';
import { IContextMenuService } from '../../../../platform/contextview/browser/contextView.js';
import { FileKind } from '../../../../platform/files/common/files.js';
import { IHoverService } from '../../../../platform/hover/browser/hover.js';
import { IInstantiationService, ServicesAccessor } from '../../../../platform/instantiation/common/instantiation.js';
import { IKeybindingService } from '../../../../platform/keybinding/common/keybinding.js';
import { ILabelService } from '../../../../platform/label/common/label.js';
import { WorkbenchCompressibleObjectTree } from '../../../../platform/list/browser/listService.js';
import { IOpenerService } from '../../../../platform/opener/common/opener.js';
import { IThemeService } from '../../../../platform/theme/common/themeService.js';
import { ITelemetryService } from '../../../../platform/telemetry/common/telemetry.js';
import { IFileIconTheme, IThemeService } from '../../../../platform/theme/common/themeService.js';
import { IWorkspaceContextService, IWorkspaceFolder } from '../../../../platform/workspace/common/workspace.js';
import { IResourceLabel, IResourceLabelOptions, IResourceLabelProps, ResourceLabels } from '../../../browser/labels.js';
import { ViewAction, ViewPane } from '../../../browser/parts/views/viewPane.js';
import { IViewletViewOptions } from '../../../browser/parts/views/viewsViewlet.js';
import { IViewDescriptorService } from '../../../common/views.js';
import { IEditorService } from '../../../services/editor/common/editorService.js';
import { IPathService } from '../../../services/path/common/pathService.js';
import { TreeFindMode } from '../../../../base/browser/ui/tree/abstractTree.js';
import { IHoverService } from '../../../../platform/hover/browser/hover.js';
import { CONTEXT_LOADED_SCRIPTS_ITEM_TYPE, IDebugService, IDebugSession, LOADED_SCRIPTS_VIEW_ID } from '../common/debug.js';
import { DebugContentProvider } from '../common/debugContentProvider.js';
import { Source } from '../common/debugSource.js';
import { renderViewTree } from './baseDebugView.js';

const NEW_STYLE_COMPRESS = true;

Expand Down Expand Up @@ -439,7 +438,7 @@ export class LoadedScriptsView extends ViewPane {
@IOpenerService openerService: IOpenerService,
@IThemeService themeService: IThemeService,
@ITelemetryService telemetryService: ITelemetryService,
@IHoverService hoverService: IHoverService
@IHoverService hoverService: IHoverService,
) {
super(options, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService, openerService, themeService, telemetryService, hoverService);
this.loadedScriptsItemType = CONTEXT_LOADED_SCRIPTS_ITEM_TYPE.bindTo(contextKeyService);
Expand All @@ -449,8 +448,7 @@ export class LoadedScriptsView extends ViewPane {
super.renderBody(container);

this.element.classList.add('debug-pane');
container.classList.add('debug-loaded-scripts');
container.classList.add('show-file-icons');
container.classList.add('debug-loaded-scripts', 'show-file-icons');

this.treeContainer = renderViewTree(container);

Expand All @@ -461,6 +459,14 @@ export class LoadedScriptsView extends ViewPane {
this.treeLabels = this.instantiationService.createInstance(ResourceLabels, { onDidChangeVisibility: this.onDidChangeBodyVisibility });
this._register(this.treeLabels);

const onFileIconThemeChange = (fileIconTheme: IFileIconTheme) => {
this.treeContainer.classList.toggle('align-icons-and-twisties', fileIconTheme.hasFileIcons && !fileIconTheme.hasFolderIcons);
this.treeContainer.classList.toggle('hide-arrows', fileIconTheme.hidesExplorerArrows === true);
};

this._register(this.themeService.onDidFileIconThemeChange(onFileIconThemeChange));
onFileIconThemeChange(this.themeService.getFileIconTheme());

this.tree = this.instantiationService.createInstance(WorkbenchCompressibleObjectTree<LoadedScriptsItem, FuzzyScore>,
'LoadedScriptsView',
this.treeContainer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ suite('Debug - Base Debug View', () => {
const container = $('.container');
const treeContainer = renderViewTree(container);

assert.strictEqual(treeContainer.className, 'debug-view-content');
assert.strictEqual(treeContainer.className, 'debug-view-content file-icon-themable-tree');
assert.strictEqual(container.childElementCount, 1);
assert.strictEqual(container.firstChild, treeContainer);
assert.strictEqual(dom.isHTMLDivElement(treeContainer), true);
Expand Down

0 comments on commit d6a59b7

Please sign in to comment.