Skip to content

bug: When write is called on a file that does not exist yet, opencode.nvim is not able to pull up the diff in nvim. #309

Description

@r0ckHopper

Prerequisites

  • I searched the docs
  • I searched existing issues

:checkhealth opencode output

==============================================================================
opencode: 1 ⚠️

opencode.nvim ~

  • OS: Linux 6.19.11-200.fc43.x86_64 (x86_64)
  • nvim version: 0.12.1+v0.12.1.
  • opencode.nvim git commit hash: 615634114c93335a4e7f76d943b4ba787ab364dd.
  • vim.g.opencode_opts: {
    events = {
    permissions = {
    floating = true
    }
    },
    lsp = {
    enabled = true
    }
    }

opencode.nvim [binaries] ~

  • ✅ OK opencode available with version 1.17.11.
  • ✅ OK curl available.
  • ✅ OK pgrep available.
  • ✅ OK lsof available.

opencode.nvim [snacks] ~

  • ✅ OK snacks.input enabled: ask() enhanced.
  • ⚠️ WARNING snacks.picker disabled: select() enhanced.

Describe the bug

When you ask opencode to make an edit on a file that does not exist you get the following error
Cannot resolve OpenCode edit target file: /location/file.txt

Steps To Reproduce

  1. Ask opencode to make an edit to a nonexistent file using write tool
  2. get error in nvim messages

Expected Behavior

Should pull up a diff against an empty file which user can accept or reject from within nvim using da/dr

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions