Skip to content

Lens.open() should reload if file already open with stale content #2

@williamsharkey

Description

@williamsharkey

Bug Description

When Lens.open('path') is called for a file that's already open in a tab, it switches to that tab but doesn't reload the content from disk. If the tab content was modified (e.g., via Studio.setContent()), the stale content persists.

Steps to Reproduce

  1. Lens.open('~/file.js') - opens file
  2. Studio.setContent('test') - modify content
  3. Lens.open('~/file.js') - returns success but content still 'test'

Expected Behavior

Lens.open() should either:

  • Always reload from disk (current behavior for new files)
  • Add a force parameter: Lens.open('path', {reload: true})
  • Check if disk content differs from tab content and prompt/reload

Current Workaround

Studio.close()  // Close current tab
Lens.open('~/file.js')  // Now loads fresh

Impact

  • Confusing for AI agents who expect open() to give fresh content
  • Can cause edits to wrong version of file

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