Skip to content

Conversation

@Caylub
Copy link

@Caylub Caylub commented Jan 16, 2026

Summary

Add absolute_paths config option for file path formatting in contexts.

Problem

The plugin allows connecting to opencode instances in subdirectories of
Neovim's CWD, but relative paths don't resolve correctly in that case.
When opencode wasn't in the exact same directory as Neovim, the model
returned gibberish because it couldn't read the referenced files.

Solution

New absolute_paths = true option uses full paths instead of CWD-relative paths.

Usage

vim.g.opencode_opts = { absolute_paths = true }

@NickvanDyke
Copy link
Owner

Thanks for surfacing this!

I wonder if this depends on the model? IME opencode succesfully ignores the "extra" dirs at the beginning of the path.

IMO we should solve this without additional, conditional configuration. We could either:

  1. Only find opencodes that exactly match Neovim's CWD. I only allowed sub-dirs because it initially seemed to work for me.
  2. Send file paths relative to opencode's CWD (which we now have), instead of Neovim's.

I like the simplicity and predictability of 1, but idk if that'd break anyone's workflow. It'd also work better after #104

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