Skip to content

feat(tabs): add close left/right/other tab commands#2026

Merged
bajrangCoder merged 3 commits intoAcode-Foundation:mainfrom
bajrangCoder:feat/tab-close-commands
Apr 12, 2026
Merged

feat(tabs): add close left/right/other tab commands#2026
bajrangCoder merged 3 commits intoAcode-Foundation:mainfrom
bajrangCoder:feat/tab-close-commands

Conversation

@bajrangCoder
Copy link
Copy Markdown
Member

No description provided.

@github-actions github-actions bot added enhancement New feature or request translations Anything related to Translations Whether a Issue or PR labels Apr 12, 2026
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 12, 2026

Greptile Summary

This PR adds "Close Left", "Close Right", and "Close Others" tab commands wired through the existing file menu, key-bindings registry, and i18n system. The shared closeTabs() helper cleanly refactors the existing close-all-tabs logic and the resolveReferenceFile() helper correctly resolves both string IDs (from the HTML attribute) and EditorFile objects, making the commands safe for both menu and keyboard invocation. The wasActive guard in editorFile.js is a correct fix that prevents inadvertent focus switches when closing non-active tabs.

Confidence Score: 5/5

Safe to merge; all remaining findings are P2 quality-of-life suggestions that do not affect correctness.

No P0 or P1 issues found. The close-all-tabs refactor is a faithful extraction. The new commands handle edge cases (empty lists, pinned tabs, active-file focus) correctly. The two P2 comments flag a silent save-skip and a missing toast — nice-to-haves, not blockers.

src/lib/commands.js — minor quality concerns in closeTabs(); all other files are straightforward.

Important Files Changed

Filename Overview
src/lib/commands.js Introduces closeTabs(), resolveReferenceFile(), getTabsRelativeToFile() helpers and three new close commands; refactors close-all-tabs to reuse the shared helper; toggle-pin-tab updated to respect a referenceFile argument
src/lib/editorFile.js wasActive guard prevents spurious makeActive() calls on non-active tab removal — correctness fix that benefits all close paths
src/views/file-menu.hbs Adds file_id value attribute to toggle-pin-tab and three new close menu items; icons chosen are reasonable material icons
src/main.js Passes file_id and localized label strings to the file-menu template; no logic changes beyond template data
src/lib/keyBindings.js Registers three new key-binding slots with key: null (no default binding); correct pattern matching existing entries
src/lang/en-us.json Adds 8 new i18n keys for the close-tabs feature; all other locales receive the same English text as fallback

Sequence Diagram

sequenceDiagram
    participant User
    participant FileMenu
    participant acode
    participant commands
    participant closeTabs
    participant EditorFile

    User->>FileMenu: click "Close Right" (value=file_id)
    FileMenu->>acode: exec("close-tabs-to-right", file_id)
    acode->>commands: close-tabs-to-right(file_id)
    commands->>commands: resolveReferenceFile(file_id)
    commands->>commands: getTabsRelativeToFile("right", file)
    commands->>closeTabs: closeTabs(tabsToRight, options)
    alt unsaved files exist
        closeTabs->>User: confirm("warning", unsavedWarning)
        User-->>closeTabs: ok
        closeTabs->>User: select(save/close/cancel)
        User-->>closeTabs: save or close
        closeTabs->>User: confirm(saveWarning or closeWarning)
        User-->>closeTabs: ok
    end
    loop for each closable file
        alt save = true
            closeTabs->>EditorFile: file.save()
        end
        closeTabs->>EditorFile: file.remove(force=true, silentPinned=true)
        EditorFile-->>closeTabs: removed
    end
    closeTabs-->>commands: true
Loading

Reviews (2): Last reviewed commit: "fix" | Re-trigger Greptile

@bajrangCoder

This comment was marked as outdated.

@bajrangCoder bajrangCoder merged commit eab7192 into Acode-Foundation:main Apr 12, 2026
7 checks passed
@bajrangCoder bajrangCoder deleted the feat/tab-close-commands branch April 12, 2026 09:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request translations Anything related to Translations Whether a Issue or PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant