Skip to content

Commit

Permalink
workspace: export RecentWorkspacePathsData + fix typo (#11603)
Browse files Browse the repository at this point in the history
Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
  • Loading branch information
kittaakos authored Aug 24, 2022
1 parent 19644aa commit cdec042
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
- [core] removed `WidgetManager.widgetPromises`; use `WidgetManager.widgets` instead. [#11555](https://github.com/eclipse-theia/theia/pull/11555)
- [core] Replaced `react-virtualized` with `react-virtuoso` for tree rendering. Removed the `TreeWidget#forceUpdate`, `TreeWidget#handleScroll` and `TreeWidget.View#renderTreeRow` methods in the process. [#11553](https://github.com/eclipse-theia/theia/pull/11553)
- [core] Replaced `Emitter` fields by `Event` fields in both `DescriptionWidget` and `BadgeWidget`.
- [workspace] Removed `DefaultWorkspaceServer#untitledWorkspaceStaleThreshhold`. Use `DefaultWorkspaceServer#untitledWorkspaceStaleThreshold` instead.

## v1.28.0 - 7/28/2022

Expand Down
10 changes: 5 additions & 5 deletions packages/workspace/src/node/default-workspace-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export class DefaultWorkspaceServer implements WorkspaceServer, BackendApplicati
* Untitled workspaces that are not among the most recent N workspaces will be deleted on start. Increase this number to keep older files,
* lower it to delete stale untitled workspaces more aggressively.
*/
protected untitledWorkspaceStaleThreshhold = 10;
protected untitledWorkspaceStaleThreshold = 10;

@inject(WorkspaceCliContribution)
protected readonly cliParams: WorkspaceCliContribution;
Expand Down Expand Up @@ -209,23 +209,23 @@ export class DefaultWorkspaceServer implements WorkspaceServer, BackendApplicati

/**
* Removes untitled workspaces that are not among the most recently used workspaces.
* Use the `untitledWorkspaceStaleThreshhold` to configure when to delete workspaces.
* Use the `untitledWorkspaceStaleThreshold` to configure when to delete workspaces.
*/
protected async removeOldUntitledWorkspaces(): Promise<void> {
const recents = (await this.getRecentWorkspaces()).map(FileUri.fsPath);
const olderUntitledWorkspaces = recents.slice(this.untitledWorkspaceStaleThreshhold).filter(workspace => this.utils.isUntitledWorkspace(FileUri.create(workspace)));
const olderUntitledWorkspaces = recents.slice(this.untitledWorkspaceStaleThreshold).filter(workspace => this.utils.isUntitledWorkspace(FileUri.create(workspace)));
await Promise.all(olderUntitledWorkspaces.map(workspace => fs.promises.unlink(FileUri.fsPath(workspace)).catch(() => { })));
if (olderUntitledWorkspaces.length > 0) {
await this.writeToUserHome({ recentRoots: await this.getRecentWorkspaces() });
}
}
}

interface RecentWorkspacePathsData {
export interface RecentWorkspacePathsData {
recentRoots: string[];
}

namespace RecentWorkspacePathsData {
export namespace RecentWorkspacePathsData {
/**
* Parses `data` as `RecentWorkspacePathsData` but removes any non-string array entry.
*
Expand Down

0 comments on commit cdec042

Please sign in to comment.