Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Align "Add Folder" visibility with VSCode #10840

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/core/src/browser/style/tree.css
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@
border: none;
}

.theia-TreeContainer .ReactVirtualized__Grid__innerScrollContainer {
margin-bottom: calc(var(--theia-ui-padding) * 3);
}
Comment on lines +45 to +47
Copy link
Member

Choose a reason for hiding this comment

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

I confirmed that the extra space works well, do we want to add it to all trees or just the explorer?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we should have it for all trees, since all trees have (by default, anyway) listeners for clicks targeting their nodes but no particular tree node, and that is only guaranteed to work if we ensure that all trees have some empty space. But I don't feel very strongly, since the Navigator is the only place I'm certain it matters.

Copy link
Member

Choose a reason for hiding this comment

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

I've only seen it being used in vscode for the explorer so I asked the question, but it would probably benefit all trees so we can keep it generic like you have it.


.theia-TreeContainer {
height: 100%;
}
Expand Down
8 changes: 4 additions & 4 deletions packages/navigator/src/browser/navigator-contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ import {
} from '@theia/core/lib/browser/shell/tab-bar-toolbar';
import { FileSystemCommands } from '@theia/filesystem/lib/browser/filesystem-frontend-contribution';
import { NavigatorDiff, NavigatorDiffCommands } from './navigator-diff';
import { UriSelection } from '@theia/core/lib/common/selection';
import { DirNode, FileNode } from '@theia/filesystem/lib/browser';
import { FileNavigatorModel } from './navigator-model';
import { ClipboardService } from '@theia/core/lib/browser/clipboard-service';
Expand Down Expand Up @@ -317,9 +316,10 @@ export class FileNavigatorContribution extends AbstractViewContribution<FileNavi
return false;
}
const navigator = this.tryGetWidget();
const model = navigator && navigator.model;
const uris = UriSelection.getUris(model && model.selectedNodes);
return this.workspaceService.areWorkspaceRoots(uris);
const selection = navigator?.model.selectedNodes[0];
// The node that is selected when the user clicks in empty space.
const root = navigator?.getContainerTreeNode();
return selection === root;
}
});

Expand Down
2 changes: 1 addition & 1 deletion packages/navigator/src/browser/navigator-widget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export class FileNavigatorWidget extends FileTreeWidget {
this.addEventListener(mainPanelNode, 'dragenter', handler);
}

protected override getContainerTreeNode(): TreeNode | undefined {
override getContainerTreeNode(): TreeNode | undefined {
const root = this.model.root;
if (this.workspaceService.isMultiRootWorkspaceOpened) {
return root;
Expand Down