Show Changes Made to the Files Elsewhere Without Waiting for Focus

Open
#207 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
30/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
javascript, nodejs
Domain
full-stack

Research direction

The change spans the server, which should watch the served folder with recursive fs.watch, debounce events, skip .reader/ and reader's own writes, and push changes over server-sent events, and the open page, which must apply clean external edits without moving the caret or scroll and show the existing conflict notice for dirty ones. Start by finding where the server serves files and where the page currently checks for changes on focus, since that check stays as the fallback. Done means an external write to the open file shows up without focus changes, while saves from reader itself do not trigger a reload.

Written by the indexing model from the issue text.

Description

enhancement

reader notices an edit made to the open file somewhere else only when its window gets focus back. Anyone who writes in the file while it's open in reader, such as a collaborator answering an aside, an agent, or another editor, stays unseen until the reader switches away and back. It can even look as if nothing was written.

What it should do

The server watches the folder it serves and tells the open page when a file changes on disk (server-sent events, say).

  • The open file changed, nothing unsaved in the editor: the editor and the page take the new text in place. The caret and the page's scroll stay where they were.
  • The open file changed, with unsaved edits: reader's existing conflict notice, as it is now on focus.
  • Another file changed: the file list and versions update. Nothing else moves.

Why now

Reviews happen in a file, as ~# asides answered with ~c asides under them. Without this, the person reviewing doesn't see a reply until they leave reader and come back, so the file isn't yet a live conversation.

Notes

  • fs.watch with recursive works on macOS and Windows, and on Linux in recent Node. Changes should be debounced, since one save can fire several events.
  • Ignore .reader/ (backups and versions) and anything reader writes itself, so a save doesn't come back as a change.
  • Checking on focus stays, as the fallback.
Dominant language
JavaScript
Stars
0
Forks
1
Avg merge
2d 4h
Merged PRs (30d)
26

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from jzheaux/reader

All issues in jzheaux/reader

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.