Skip to content

Vi and emacs don't properly live update in preview #563

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mythmon opened this issue Jan 19, 2024 · 9 comments · Fixed by #1132
Closed

Vi and emacs don't properly live update in preview #563

mythmon opened this issue Jan 19, 2024 · 9 comments · Fixed by #1132
Labels
bug Something isn’t working

Comments

@mythmon
Copy link
Member

mythmon commented Jan 19, 2024

Ambassador Martien reports that when saving files using vim and emacs in their default configurations, the CLI does not properly live update and instead shows an error about "file no longer exists".

Question: (I’m new to yarn):

  • when I use vi or emacs to edit, say, index.md , yarn says “file no longer exists: /index.md”, and the page in Safari does not update;
  • when I edit a copy of index.md and use that to overwrite index.md, yarn sees the update and updates the browser page.

What editor should I use?

I think I found it. In vi , :set nowritebackup) :

  • inode stays the same;
  • only modify and change timestamps change. Access and birth remain the same.
@mythmon mythmon added the bug Something isn’t working label Jan 19, 2024
@Fil
Copy link
Contributor

Fil commented Jan 19, 2024

it's probably because they don't edit a file (with the same inode) but replace it? I think we've seen that issue already (can't find the reference atm).

related #157

@eitanlees
Copy link

For Neovim I added the following to ~/.config/nvim/init.lua

vim.opt.backupcopy = 'yes'

and that alleviated the issue.

@Fil
Copy link
Contributor

Fil commented Mar 23, 2024

fixed with #1127

@Fil Fil closed this as completed Mar 23, 2024
@mbostock
Copy link
Member

I don’t see it fixed in vi. Can you confirm? When I save changes in vi, the file is written, but the preview server doesn’t see anything as changed, so I have to reload in the browser.

@mbostock mbostock reopened this Mar 23, 2024
@mbostock
Copy link
Member

It seems like the first save in vi triggers a reload, but subsequent saves (after the file no longer exists message) do not trigger updates.

@mbostock
Copy link
Member

I think the problem is a race condition where the await for lazy config #695 here handleWatch(socket, req, await this._readConfig()) means we can miss the _hello_↑ message that is sent immediately upon connect.

@Fil
Copy link
Contributor

Fil commented Mar 23, 2024

You're right, it's still failing.

@nelsonspbr
Copy link

Oh wow, I spent more time than I'd like to admit thinking why Observable framework doesn't react to changes in a simple file. I was using Vim to edit the file.

@mbostock
Copy link
Member

@nelsonspbr This was fixed a few months ago. Are running an old version of Framework? If you’re still experiencing a problem with the latest version of Framework, please file a new issue with steps to reproduce. I’ve just tested locally using vi and live preview is working as expected. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn’t working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants