Skip to content

Commit

Permalink
feat(groups): workspaces groups
Browse files Browse the repository at this point in the history
  • Loading branch information
tomandco-rafalwolak committed Sep 19, 2019
1 parent f68b4b2 commit cbe2f0f
Show file tree
Hide file tree
Showing 20 changed files with 52 additions and 207 deletions.
33 changes: 29 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,34 @@
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
[![Build Status](https://travis-ci.org/design4pro/vscode-workspace-manager.svg?branch=master)](https://travis-ci.org/design4pro/vscode-workspace-manager)

![](https://raw.githubusercontent.com/design4pro/vscode-workspace-manager/master/resources/workspace-manager.png)

## Features

- Find workspaces - `.code-workspace` files in any location
- **Group** workspaces

<img src="https://raw.githubusercontent.com/design4pro/vscode-workspace-manager/master/images/vscode-workspace-manager-groups.gif" width=" 400">

- Add workspace to **Favorite**

<img src="https://raw.githubusercontent.com/design4pro/vscode-workspace-manager/master/images/vscode-workspace-manager-favorites.gif" width=" 400">

- Open workspace in the same or new window
- Open workpsace settings file

<img src="https://raw.githubusercontent.com/design4pro/vscode-workspace-manager/master/images/vscode-workspace-manager-open-settings.gif" width=" 400">

- Identify the current project in **Status Bar**
- A dedicated **Side Bar**

## Install

1. Open **Extensions** side bar panel in Visual Studio Code and choose the menu options for **View → Extensions**
1. Search for `Workspace Manager`
1. Click **Install**
1. Click **Reload**, if required
1. Open **Extensions** side bar panel in Visual Studio Code and choose the menu options for **View → Extensions**.
1. Search for `Workspace Manager`.
1. Click **Install**.
1. Click **Reload**, if required.

## Licence

[MIT](https://github.com/design4pro/vscode-workspace-manager/blob/master/LICENSE) © DESIGN4 ᴾ ᴿ ᴼ
25 changes: 0 additions & 25 deletions azure-pipelines.yml

This file was deleted.

Binary file added images/vscode-workspace-manager-favorites.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/vscode-workspace-manager-groups.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,11 @@
"title": "Switch Workspace",
"category": "Workspace Manager"
},
{
"command": "workspaceManager.switchWorkspaceQuickPick",
"title": "Switch Workspace",
"category": "Workspace Manager"
},
{
"command": "workspaceManager.switchWorkspaceInNewWindow",
"title": "Switch Workspace in New Window",
Expand All @@ -250,6 +255,15 @@
"dark": "resources/dark/new-window.svg"
}
},
{
"command": "workspaceManager.switchWorkspaceInNewWindowQuickPick",
"title": "Switch Workspace in New Window",
"category": "Workspace Manager",
"icon": {
"light": "resources/light/new-window.svg",
"dark": "resources/dark/new-window.svg"
}
},
{
"command": "workspaceManager.deleteWorkspace",
"title": "Delete Workspace",
Expand Down
Binary file modified resources/workspace-manager.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions src/cache/cache.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as vscode from 'vscode';
import { state } from '../state';
import { Container } from '../container';

/**
* @name now
Expand All @@ -17,7 +17,7 @@ export class Cache {

constructor(namespace?: string) {
// ExtensionContext
this.context = <vscode.ExtensionContext>state.context;
this.context = <vscode.ExtensionContext>Container.context;

// Namespace of the context's globalState
this.namespace = namespace || 'cache';
Expand Down
2 changes: 2 additions & 0 deletions src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ export * from './commands/workspace/closeWorkspace';
export * from './commands/workspace/deleteWorkspace';
export * from './commands/workspace/saveWorkspace';
export * from './commands/workspace/switchToWorkspace';
export * from './commands/workspace/switchWorkspaceQuickPick';
export * from './commands/workspace/switchWorkspaceInNewWindowQuickPick';
2 changes: 1 addition & 1 deletion src/commands/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ export enum Commands {
OpenWorkspaceSettings = 'workspaceManager.openWorkspaceSettings',
RemoveFromFavorites = 'workspaceManager.removeFromFavorites',
SaveWorkspace = 'workspaceManager.saveWorkspace',
SwitchToWorkspace = 'workspaceManager.switchToWorkspace',
SwitchWorkspace = 'workspaceManager.switchWorkspace',
SwitchWorkspaceQuickPick = 'workspaceManager.switchWorkspaceQuickPick',
SwitchToWorkspace = 'workspaceManager.switchToWorkspace',
SwitchWorkspaceInNewWindow = 'workspaceManager.switchWorkspaceInNewWindow',
SwitchWorkspaceInNewWindowQuickPick = 'workspaceManager.switchWorkspaceInNewWindowQuickPick'
}
Expand Down
52 changes: 0 additions & 52 deletions src/commands/workspace/favorites/abstractFavorites.ts

This file was deleted.

9 changes: 0 additions & 9 deletions src/commands/workspace/favorites/addToFavorites.ts

This file was deleted.

9 changes: 0 additions & 9 deletions src/commands/workspace/favorites/removeFromFavorites.ts

This file was deleted.

File renamed without changes.
6 changes: 3 additions & 3 deletions src/environment.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as path from 'path';
import * as vscode from 'vscode';
import { state } from './state';
import { Container } from './container';

export enum OsType {
Windows = 'win32',
Expand Down Expand Up @@ -28,9 +28,9 @@ export class Environment {
this.OsType = process.platform as OsType;

if (!this.isPortable) {
if (state.context) {
if (Container.context) {
this.PATH = path
.resolve(state.context.globalStoragePath, '../../..')
.resolve(Container.context.globalStoragePath, '../../..')
.concat(path.normalize('/'));
}

Expand Down
5 changes: 0 additions & 5 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ import {
setCommandContext
} from './constants';
import { Container } from './container';
import { Environment } from './environment';
import { IOutputLevel, Logger } from './logger';
import { state } from './state';
import { Strings } from './system';
import * as telemetry from './telemetry';
import { getExtension } from './util/getExtension';
Expand All @@ -27,9 +25,6 @@ export async function activate(
// Pretend we are enabled (until we know otherwise) and set the view contexts to reduce flashing on load
setCommandContext(CommandContext.Enabled, true);

state.context = context;
state.environment = new Environment();

Logger.configure(
context,
configuration.get<IOutputLevel>(
Expand Down
12 changes: 0 additions & 12 deletions src/state.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/views/nodes/groupsNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export class GroupsNode extends ViewNode<GroupsView> {

getTreeItem(): TreeItem {
const item = new TreeItem('Groups', TreeItemCollapsibleState.Expanded);
item.contextValue = ResourceType.Workspaces;
item.contextValue = ResourceType.Group;

return item;
}
Expand Down
84 changes: 0 additions & 84 deletions src/views/viewBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,62 +208,6 @@ export abstract class ViewBase<TRoot extends ViewNode<View>>
this.triggerNodeChange(node);
}

@Log({
args: { 0: (n: ViewNode) => n.toString() }
})
async reveal(
node: ViewNode,
options?: {
select?: boolean;
focus?: boolean;
expand?: boolean | number;
}
) {
if (this._tree === undefined) return;

try {
await this._tree.reveal(node, options);
} catch (ex) {
Logger.error(ex);
}
}

@Log()
async show() {
try {
void (await commands.executeCommand(
`${this.id}${location ? `:${location}` : ''}.focus`
));
} catch (ex) {
Logger.error(ex);

const setting = `${Strings.splitSingle(this.id, '.')[1]}.enabled`;
if (!configuration.get(setting)) {
const actions: MessageItem[] = [
{ title: 'Enable' },
{ title: 'Cancel', isCloseAffordance: true }
];

const result = await window.showErrorMessage(
`Unable to show the ${this.name} view since it's currently disabled. Would you like to enable it?`,
...actions
);

if (result === actions[0]) {
await configuration.update(
setting,
true,
ConfigurationTarget.Global
);

void (await commands.executeCommand(
`${this.id}${location ? `:${location}` : ''}.focus`
));
}
}
}
}

@Debug({
args: { 0: (n: ViewNode) => n.toString() }
})
Expand All @@ -282,34 +226,6 @@ export abstract class ViewBase<TRoot extends ViewNode<View>>
this._lastMaxCounts.delete(node.id);
}

@Debug({
args: {
0: (n: ViewNode & PageableViewNode) => n.toString(),
3: (n?: ViewNode) => (n === undefined ? '' : n.toString())
}
})
async showMoreNodeChildren(
node: ViewNode & PageableViewNode,
maxCount: number | undefined,
previousNode?: ViewNode
) {
if (maxCount === undefined || maxCount === 0) {
node.maxCount = maxCount;
} else {
node.maxCount = (node.maxCount || maxCount) + maxCount;
}

if (node.rememberLastMaxCount) {
this._lastMaxCounts.set(node.id!, node.maxCount);
}

if (previousNode !== undefined) {
void (await this.reveal(previousNode, { select: true }));
}

return this.refreshNode(node);
}

@Debug({
args: { 0: (n: ViewNode) => (n != null ? n.toString() : '') }
})
Expand Down

0 comments on commit cbe2f0f

Please sign in to comment.