Skip to content

feat(context): expose public API#305

Merged
sudo-tee merged 1 commit intosudo-tee:mainfrom
disrupted:feat/context-api
Mar 5, 2026
Merged

feat(context): expose public API#305
sudo-tee merged 1 commit intosudo-tee:mainfrom
disrupted:feat/context-api

Conversation

@disrupted
Copy link
Contributor

@disrupted disrupted commented Mar 3, 2026

this would allow context toggles in keymaps and other user configs

I've been using this one in recent weeks and it's super convenient imo :)

keymap = {
    input_window = {
        ['<C-a>'] = {
            function()
                local enabled =
                    require('opencode.context').toggle_context('current_file')
                if enabled ~= nil then
                    vim.notify('current file context: ' .. (enabled and 'on' or 'off'))
                end
            end,
            desc = 'Toggle current file context',
            mode = { 'n', 'i' },
        }
    }
}

@disrupted disrupted marked this pull request as ready for review March 3, 2026 22:50
@sudo-tee
Copy link
Owner

sudo-tee commented Mar 3, 2026

This is actually a pretty cool idea.

I will play around with it, but I really dig this

@sudo-tee
Copy link
Owner

sudo-tee commented Mar 4, 2026

@disrupted

I would add the api tho the README.md and maybe a quick section about using it the way you described in the in ther repo.

maybe we could also add the toggle_context in the api file and configure it like so

'toggle_context#current_file' where anything after the # is the param ? But this coule be in another PR

@sudo-tee sudo-tee merged commit cad16ea into sudo-tee:main Mar 5, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants