Skip to content

Commit

Permalink
Prepared Release.
Browse files Browse the repository at this point in the history
[1.1.1]

- `AddFolderToWorkspace: Add manually a directory...` - Paths can be added manually from now on. After that, the new workspace can be saved directly in the settings.
- Fixed bug - when a workspace has already been added.
  • Loading branch information
dennykorsukewitz committed Sep 14, 2023
1 parent 3888312 commit 5d214db
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 18 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

All notable changes to the "AddFolderToWorkspace" extension will be documented in this file.

## [1.1.1]

`AddFolderToWorkspace: Add manually a directory...` - Paths can be added manually from now on. After that, the new workspace can be saved directly in the settings.s

Fixed bug - when a workspace has already been added.

## [1.1.0]

### AddFolderToWorkspace
Expand Down
17 changes: 3 additions & 14 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,4 @@
# [1.1.0]
# [1.1.1]

## AddFolderToWorkspace

This Function provides a searchable list of folders (Workspaces) that can be added **simultaneous** to the current VSC Workspace. All configured folders will be displayed.

**Shortcut:** ```strg + alt + k, p```<br>
**Command:** ```AddFolderToWorkspace: Add Folder to Workspace.```

## RemoveFolderFromWorkspace

This Function provides a searchable list of folders (Workspaces) that can be removed **simultaneous** from the current VSC Workspace. All current open folders are displayed.

**Shortcut:** ```strg + alt + k, shift + p```<br>
**Command:** ```AddFolderToWorkspace: Remove Folder from Workspace.```
- `AddFolderToWorkspace: Add manually a directory...` - Paths can be added manually from now on. After that, the new workspace can be saved directly in the settings.
- Fixed bug - when a workspace has already been added.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "AddFolderToWorkspace",
"displayName": "Add Folder To Workspace",
"description": "This extension adds / removes the selected folder (multiple) to / from the workspace (VSC Workspace).",
"version": "1.1.0",
"version": "1.1.1",
"publisher": "dennykorsukewitz",
"icon": "doc/images/icon.png",
"license": "SEE LICENSE IN LICENSE",
Expand Down
59 changes: 56 additions & 3 deletions src/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ function initAddFolderToWorkspace(context) {
const addFolderToWorkspaceId = 'addFolderToWorkspace';
context.subscriptions.push(vscode.commands.registerCommand(addFolderToWorkspaceId, async () => {

let workspaceDirectories = [];
let workspaceDirectories = [],
newWorkspaceFound = 0,
manualWorkspace = '',
manualDirectoryString = '-- Add manually a directory --';

let config = vscode.workspace.getConfiguration('addFolderToWorkspace');

// Check if workspaces are defined.
Expand All @@ -50,26 +54,75 @@ function initAddFolderToWorkspace(context) {
return;
}

if (workspaceDirectories.length && !workspaceDirectories.includes(manualDirectoryString)) {
workspaceDirectories.unshift(manualDirectoryString);
}

// Open QuickPick and add selected Folder (Directory to VSC Workspace).
let workspaces = await vscode.window.showQuickPick(workspaceDirectories, {
title: 'AddFolderToWorkspace',
placeHolder: 'AddFolderToWorkspace: Select a folder...',
canPickMany: true,
})
if (!workspaces) return;

if (workspaces.length && workspaces.includes(manualDirectoryString)) {

workspaces.shift(manualDirectoryString);
newWorkspaceFound = 1;

manualWorkspace = await vscode.window.showInputBox({
title: 'AddFolderToWorkspace',
placeHolder: 'AddFolderToWorkspace: Add manually a directory...',
});

if (manualWorkspace){
workspaces.push(manualWorkspace);
}
}
if (!workspaces) return;

let workspaceURIs = [];
for await (const workspace of workspaces) {

// Get URI of selected directory.
let URI = vscode.Uri.file(workspace);
let URI = vscode.Uri.file(workspace),
URIexists = 0;

if (!URI) return;
workspaceURIs.push({ uri: URI });

vscode.workspace.workspaceFolders.sort().forEach(function (workspaceFolder) {

if (URI.path == workspaceFolder.uri.path){
URIexists = 1;
}
})

if (!URIexists){
workspaceURIs.push({ uri: URI });
}
}

if (!workspaceURIs.length) return;

if (newWorkspaceFound) {
let addNewWorkspaceToConfig = await vscode.window.showQuickPick(['yes','no'], {
title: 'AddFolderToWorkspace (New Workspace)',
placeHolder: 'AddFolderToWorkspace: Should I save the new workspace in the settings?',
canPickMany: false,
});

if (addNewWorkspaceToConfig == 'yes'){

if (!manualWorkspace.endsWith("/")){
manualWorkspace += '/';
}

config.workspaces.push(manualWorkspace);
await vscode.workspace.getConfiguration().update('addFolderToWorkspace.workspaces', config.workspaces);
}
}

// Add selected Folder to Workspace.
await updateWorkspaceAndWait(0, null, workspaceURIs);

Expand Down

0 comments on commit 5d214db

Please sign in to comment.