Skip to content

Commit d2d60e5

Browse files
authored
release: 1.1.0 (#6)
* feat: add yolo mode that closes unused tabs just * doc: update version and changelog
1 parent 32d0bba commit d2d60e5

File tree

6 files changed

+48
-12
lines changed

6 files changed

+48
-12
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
### 1.1.0
4+
5+
1. Add 'YOLO mode' support, which means unused tabs will be closed without being archived for later retrieval.
6+
37
### 1.0.4
48

59
Use status bar message for better user experience.

docs.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,11 @@ The default value is `5`.
4040
Number of hours after which an unused tab is automatically archived.
4141

4242
The default value is `12`.
43+
44+
### `tabarchive.yoloMode`
45+
46+
When enabled, unused tabs will be closed without being archived for later retrieval. This means you won't be able to access these tabs from the archived tabs list.
47+
48+
The name comes from "You Only Live Once" - reflecting that tabs are permanently closed rather than saved for later access.
49+
50+
The default value is `false`.

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"displayName": "Tab Archive",
44
"icon": "logo-220x220.png",
55
"description": "Unused tab archive",
6-
"version": "1.0.4",
6+
"version": "1.1.0",
77
"publisher": "guza",
88
"repository": "github:guuzaa/vscode-tabarchive",
99
"engines": {
@@ -61,6 +61,11 @@
6161
"minimum": 1,
6262
"default": 12,
6363
"markdownDescription": "Number of hours after which an unused tab is automatically archived."
64+
},
65+
"tabarchive.yoloMode": {
66+
"type": "boolean",
67+
"default": false,
68+
"markdownDescription": "When enabled, unused tabs will be closed without being archived for later retrieval. You Only Live Once!"
6469
}
6570
}
6671
}

src/settings.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ const settings = {
2323
minimum: 1,
2424
default: 12,
2525
},
26+
"tabarchive.yoloMode": {
27+
type: "boolean",
28+
default: false,
29+
},
2630
};
2731

2832
type SettingKey = keyof typeof settings;
@@ -40,9 +44,12 @@ export function getSettingValue(
4044
export function getSettingValue(
4145
settingKey: "tabarchive.tabAgeForAutomaticArchiving",
4246
): number;
47+
export function getSettingValue(
48+
settingKey: "tabarchive.yoloMode",
49+
): boolean;
4350
export function getSettingValue(
4451
settingKey: SettingKey,
45-
): string | string[] | number | undefined {
52+
): string | string[] | number | boolean | undefined {
4653
const setting = settings[settingKey];
4754
const value = vscode.workspace.getConfiguration().get(settingKey);
4855

@@ -67,6 +74,10 @@ export function getSettingValue(
6774

6875
return value;
6976
}
77+
78+
if (setting.type === "boolean") {
79+
return typeof value === "boolean" ? value : setting.default;
80+
}
7081
}
7182

7283
export const updateSettingValue = (section: SettingKey, value: unknown) =>

src/tabarchive.ts

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,8 @@ export const clearArchivedTabs = async (context: vscode.ExtensionContext) => {
177177
};
178178

179179
export const listArchivedTabs = async (context: vscode.ExtensionContext) => {
180+
const isYoloMode = getSettingValue("tabarchive.yoloMode");
181+
180182
const items = Array.from(archivedTabs.values()).map(({ group, label, uri }) => ({
181183
description: `Group: ${group} - ${vscode.workspace.asRelativePath(vscode.Uri.parse(uri)).replace(`/${label}`, "")}`,
182184
group,
@@ -193,7 +195,9 @@ export const listArchivedTabs = async (context: vscode.ExtensionContext) => {
193195

194196
const quickPick = vscode.window.createQuickPick();
195197
quickPick.items = items;
196-
quickPick.placeholder = 'Archived tabs since this workspace was opened';
198+
quickPick.placeholder = isYoloMode
199+
? 'Come on! You Only Live Once!'
200+
: 'Archived tabs since this workspace was opened';
197201
quickPick.matchOnDescription = true;
198202
quickPick.matchOnDetail = true;
199203

@@ -249,6 +253,7 @@ export const listArchivedTabs = async (context: vscode.ExtensionContext) => {
249253
export const archiveTabs = (maxTabAgeInHours = 0) => {
250254
lg("Archiving tabs!");
251255

256+
const isYoloMode = getSettingValue("tabarchive.yoloMode");
252257
vscode.window.tabGroups.all.forEach((tabGroup) => {
253258
lg(`Group ${tabGroup.viewColumn}`);
254259

@@ -315,13 +320,16 @@ export const archiveTabs = (maxTabAgeInHours = 0) => {
315320

316321
lg(`Group ${tabGroup.viewColumn} - Archiving tab ${label}`);
317322

318-
const tabKey = createTabKey(tabGroup.viewColumn.toString(), label, tabUri);
319-
archivedTabs.set(tabKey, {
320-
date,
321-
group: tabGroup.viewColumn.toString(),
322-
label,
323-
uri: tabUri,
324-
});
323+
// In YOLO mode, just close the tab without archiving it
324+
if (!isYoloMode) {
325+
const tabKey = createTabKey(tabGroup.viewColumn.toString(), label, tabUri);
326+
archivedTabs.set(tabKey, {
327+
date,
328+
group: tabGroup.viewColumn.toString(),
329+
label,
330+
uri: tabUri,
331+
});
332+
}
325333

326334
vscode.window.tabGroups.close(tab);
327335
});

0 commit comments

Comments
 (0)