Skip to content
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

--watch not working with helix-editor #12677

Closed
urbantrout opened this issue Jul 25, 2024 · 11 comments · Fixed by #12856
Closed

--watch not working with helix-editor #12677

urbantrout opened this issue Jul 25, 2024 · 11 comments · Fixed by #12856
Assignees
Milestone

Comments

@urbantrout
Copy link

What version of Hugo are you using (hugo version)?

$ hugo version
hugo v0.129.0+extended darwin/amd64 BuildDate=2024-07-17T13:29:16Z VendorInfo=brew

Steps to reproduce:

  1. Run hugo server or hugo --watch
  2. Change files in Helix

Expected result

Hugo reacts to file changes and rebuilds pages

Actual result

Hugo reacts to file changes and builds pages, but not all of them and the output is the same as the one without the changes.

This only happens in Helix editor. In vim everything works as expected.

@bep bep removed the NeedsTriage label Jul 25, 2024
@bep bep self-assigned this Jul 25, 2024
@bep bep added this to the v0.130.0 milestone Jul 25, 2024
@bep
Copy link
Member

bep commented Jul 25, 2024

Could you try to run

hugo server --logLevel info

And note the lines with livereload in them when you change something.

You could also try hugo server --poll 1s. If that works, the Helix must doing some non-standard way of saving files that does not trigger the expected fs events.

@urbantrout
Copy link
Author

This is the output with --logLevel info

Change detected, rebuilding site (#1).
2024-07-25 16:35:34.441 +0200
Template added /_default/baseof.htmlc3gzwd.bck
Template added /_default/baseof.html
INFO  build:  step process substep resolve content adapter change set changes 2 checked 2 matches 0 duration 36.901µs
INFO  build:  step process substep resolve page output change set changes 2 checked 448 matches 0 duration 3.843363ms
INFO  build:  step process substep gc dynacache duration 196.695µs
INFO  build:  step process substep rebuild templates duration 8.210313ms
INFO  build:  step process duration 13.327644ms
INFO  build:  step assemble duration 777ns
INFO  build:  step render substep pages site de outputFormat html duration 20.021809ms
INFO  build:  step render pages 0 content 0 duration 20.075914ms
INFO  build:  step render deferred count 0 duration 917ns
INFO  build:  step postProcess duration 9.17µs
INFO  build:  duration 33.51625ms
Web Server is available at http://localhost:1313/ (bind address 0.0.0.0)
Total in 33 ms
INFO  livereload: build changed 0 files

@urbantrout
Copy link
Author

adding --poll 1s fixes the issue.

@urbantrout
Copy link
Author

This is not a hugo issue but a helix issue.

@urbantrout urbantrout closed this as not planned Won't fix, can't repro, duplicate, stale Jul 25, 2024
@bep
Copy link
Member

bep commented Jul 25, 2024

This is not a hugo issue but a helix issue.

Well, that's debatable.

Looking at these 2 lines:

Template added /_default/baseof.htmlc3gzwd.bck
Template added /_default/baseof.html

I'm guessing that the above is hinting at the problem; I suspect that Helix saves to a temp file and then renames it, not sure.

@urbantrout
Copy link
Author

Well, that's debatable.

@David-Else
Copy link
Contributor

adding --poll 1s fixes the issue.

I just spent the day tearing my hair out trying to solve this problem, and this solved it! Maybe there is some better way to deal with this long term than adding --poll 1s?

@kirawi
Copy link

kirawi commented Aug 24, 2024

This is not a hugo issue but a helix issue.

Well, that's debatable.

Looking at these 2 lines:

Template added /_default/baseof.htmlc3gzwd.bck
Template added /_default/baseof.html

I'm guessing that the above is hinting at the problem; I suspect that Helix saves to a temp file and then renames it, not sure.

I'd be surprised if this was the issue. Vim also writes to a temporary file and renames it.

@jmooring
Copy link
Member

@kirawi We have a few exclusions related to vim, but nothing for .bck files.

istemp := strings.HasSuffix(ext, "~") ||
(ext == ".swp") || // vim
(ext == ".swx") || // vim
(ext == ".tmp") || // generic temp file
(ext == ".DS_Store") || // OSX Thumbnail
baseName == "4913" || // vim
strings.HasPrefix(ext, ".goutputstream") || // gnome
strings.HasSuffix(ext, "jb_old___") || // intelliJ
strings.HasSuffix(ext, "jb_tmp___") || // intelliJ
strings.HasSuffix(ext, "jb_bak___") || // intelliJ
strings.HasPrefix(ext, ".sb-") || // byword
strings.HasPrefix(baseName, ".#") || // emacs
strings.HasPrefix(baseName, "#") // emacs
if istemp {
continue
}

@bep bep modified the milestones: v0.133.0, Unscheduled Aug 29, 2024
bep pushed a commit that referenced this issue Sep 18, 2024
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants