diff --git a/README.md b/README.md index 3d8a4c4..944fd84 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ This extension contributes the following settings: - `auto-arrange-tabs.millis`: The number of milliseconds to move the tab from activation. - `auto-arrange-tabs.fixTabs`: The number of fixed tabs from left side. They don't move when time is reached. +- `auto-arrange-tabs.countPinnedInFixTabs`: Whether pinned tabs are counted as part of the fixed tabs. If false, fixed tabs = pinned tabs + fixTabs. ## Release Notes diff --git a/extension.js b/extension.js index 7269514..61222d2 100644 --- a/extension.js +++ b/extension.js @@ -40,9 +40,15 @@ const activate = () => { // Find tab numbers with matching labels. const tabNum = getActiveTabNum(activeGroup); console.log("tn", tabNum); - if (tabNum < config.get("fixTabs")) return; + const pinnedCount = getNotPinnedNum(activeGroup) ?? activeGroup.tabs.length; + const fixedTabs = config.get("fixTabs"); + const countPinnedInFixTabs = config.get("countPinnedInFixTabs"); + const fixedThreshold = countPinnedInFixTabs + ? fixedTabs + : pinnedCount + fixedTabs; + if (tabNum < fixedThreshold) return; - const notPinnedNum = getNotPinnedNum(activeGroup); + const notPinnedNum = pinnedCount; vscode.commands.executeCommand("moveActiveEditor", { by: "tab", to: "left", diff --git a/package.json b/package.json index de43b1e..d3f8e1e 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,12 @@ "scope": "resource", "type": "number" }, + "auto-arrange-tabs.countPinnedInFixTabs": { + "default": true, + "markdownDescription": "Whether pinned tabs are counted as part of the fixed tabs. If false, fixed tabs = pinned tabs + fixTabs.", + "scope": "resource", + "type": "boolean" + }, "auto-arrange-tabs.millis": { "default": 3000, "markdowDescription": "Specifies the number of milliseconds to move the tab from activation.",