diff --git a/packages/workspace/package.json b/packages/workspace/package.json index 35c336d7e3e15..f645e89ed527a 100644 --- a/packages/workspace/package.json +++ b/packages/workspace/package.json @@ -8,6 +8,7 @@ "@theia/variable-resolver": "^0.3.13", "@types/fs-extra": "^4.0.2", "fs-extra": "^4.0.2", + "moment": "^2.21.0", "valid-filename": "^2.0.1" }, "publishConfig": { @@ -49,4 +50,4 @@ "nyc": { "extends": "../../configs/nyc.json" } -} +} \ No newline at end of file diff --git a/packages/workspace/src/browser/quick-open-workspace.ts b/packages/workspace/src/browser/quick-open-workspace.ts index 531e9e589f769..e5ea18947203a 100644 --- a/packages/workspace/src/browser/quick-open-workspace.ts +++ b/packages/workspace/src/browser/quick-open-workspace.ts @@ -20,6 +20,7 @@ import { WorkspaceService } from './workspace-service'; import URI from '@theia/core/lib/common/uri'; import { MessageService } from '@theia/core/lib/common'; import { FileSystem, FileSystemUtils } from '@theia/filesystem/lib/common'; +import * as moment from 'moment'; @injectable() export class QuickOpenWorkspace implements QuickOpenModel { @@ -38,10 +39,15 @@ export class QuickOpenWorkspace implements QuickOpenModel { for (const workspace of workspaces) { const uri = new URI(workspace); + const stat = await this.fileSystem.getFileStat(workspace); + if (!stat) { + continue; + } + const lastModification = moment(stat.lastModification).fromNow(); this.items.push(new QuickOpenGroupItem({ label: uri.path.base, description: (home) ? FileSystemUtils.tildifyPath(uri.path.toString(), home) : uri.path.toString(), - groupLabel: (workspace === workspaces[0]) ? 'Current Workspace' : '', + groupLabel: (workspace === workspaces[0]) ? 'Current Workspace' : `Modified ${lastModification}`, run: (mode: QuickOpenMode): boolean => { if (mode !== QuickOpenMode.OPEN) { return false;