Skip to content

Commit

Permalink
fix: types
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaaaash committed Apr 26, 2022
1 parent 5307f30 commit 0f4e951
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -392,18 +392,18 @@ describe('FileTreeModelService should be work', () => {
},
} as any;

expect(fileTreeModelService.contextKey.explorerResourceIsFolder.get()).toBeFalsy();
expect(fileTreeModelService.contextKey?.explorerResourceIsFolder.get()).toBeFalsy();

fileTreeModelService.handleContextMenu(mockEvent, mockNode);
// show context key in folder
expect(fileTreeModelService.contextKey.explorerResourceIsFolder.get()).toBeTruthy();
expect(fileTreeModelService.contextKey?.explorerResourceIsFolder.get()).toBeTruthy();

// blur
fileTreeModelService.handleTreeBlur();
expect(fileTreeModelService.contextKey.explorerResourceIsFolder.get()).toBeFalsy();
expect(fileTreeModelService.contextKey?.explorerResourceIsFolder.get()).toBeFalsy();

// click in empty area
fileTreeModelService.handleContextMenu(mockEvent, undefined);
expect(fileTreeModelService.contextKey.explorerResourceIsFolder.get()).toBeTruthy();
expect(fileTreeModelService.contextKey?.explorerResourceIsFolder.get()).toBeTruthy();
});
});
4 changes: 2 additions & 2 deletions packages/file-tree-next/src/browser/file-tree-contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,11 @@ export class FileTreeContribution
const handler = this.mainLayoutService.getTabbarHandler(ExplorerContainerId);
if (handler) {
handler.onActivate(() => {
this.fileTreeModelService.contextKey.explorerViewletVisibleContext.set(true);
this.fileTreeModelService.contextKey?.explorerViewletVisibleContext.set(true);
this.fileTreeModelService.performLocationOnHandleShow();
});
handler.onInActivate(() => {
this.fileTreeModelService.contextKey.explorerViewletVisibleContext.set(false);
this.fileTreeModelService.contextKey?.explorerViewletVisibleContext.set(false);
});
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/file-tree-next/src/browser/file-tree.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export class FileTreeService extends Tree implements IFileTreeService {
@Autowired(ILogger)
private readonly logger: ILogger;

private fileContextKey: FileContextKey;
private fileContextKey?: FileContextKey;

private _cacheNodesMap: Map<string, File | Directory> = new Map();

Expand Down Expand Up @@ -920,7 +920,7 @@ export class FileTreeService extends Tree implements IFileTreeService {
public toggleFilterMode() {
this._filterMode = !this.filterMode;
this.onFilterModeChangeEmitter.fire(this.filterMode);
this.fileContextKey.filesExplorerFilteredContext.set(this.filterMode);
this.fileContextKey?.filesExplorerFilteredContext.set(this.filterMode);
// 清理掉输入值
if (this.filterMode === false) {
// 退出时若需要做 filter 值清理以及聚焦操作
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,9 @@ export class AccordionService extends WithEventBus {
protected setSize(index: number, targetSize: number, isIncrement?: boolean, noAnimation?: boolean): number {
const fullHeight = this.splitPanelService.rootNode!.clientHeight;
const panel = this.splitPanelService.panels[index];
if (!panel) {
return 0;
}
if (!noAnimation) {
panel.classList.add('resize-ease');
}
Expand Down
2 changes: 1 addition & 1 deletion packages/startup/entry/web/render-app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { ToolbarActionBasedLayout } from '@opensumi/ide-core-browser/lib/compone
const CLIENT_ID = 'W_' + generate();
export async function renderApp(opts: IClientAppOpts) {
const injector = new Injector();
opts.workspaceDir = '/Users/baoxubing/work/GitHub/OpenSumi/core' || opts.workspaceDir || process.env.WORKSPACE_DIR;
opts.workspaceDir = opts.workspaceDir || process.env.WORKSPACE_DIR;

opts.injector = injector;
opts.extensionDir = opts.extensionDir || process.env.EXTENSION_DIR;
Expand Down

0 comments on commit 0f4e951

Please sign in to comment.