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

dx serve prints "Failed to parse file: No such file or directory" and starts rebuild sometime on static string change (Neovim) #2312

Open
2 of 3 tasks
Andrew15-5 opened this issue Apr 15, 2024 · 7 comments
Labels
cli Related to the dioxus-cli program

Comments

@Andrew15-5
Copy link
Contributor

Problem

dx serve (I guess starting from 0.5.x) now gives an error:

2024-04-15T14:10:04.619499Z ERROR dioxus_cli::server: Failed to parse file: No such file or directory (os error 2)

when changing a static string in the rsx block (or probably anything else). In rare cases, it triggers a rebuild.

After some debugging, I tried VSCodium and after each save absolutely nothing happened, and at that point I realized, it's typst/typst#2633 (comment) all over again. And, of course, the workaround is the same:

local rust_group = vim.api.nvim_create_augroup("rust_group", {})
vim.api.nvim_create_autocmd({ "FileType" }, {
  pattern = "rust",
  callback = function()
    vim.opt_local.backupcopy = "yes"
  end,
  group = rust_group,
})

I think it is also caused by notify crate (same as with Typst). So either some configuration must be changed for the watcher to work better, or the upstream crate should accommodate the "fix" of the default when saving files in Neovim. Some new option or something. Otherwise, I think this won't be resolved (there is probably no chance Neovim will change its default behavior).

Steps To Reproduce

  • dx new for desktop + tailwind
  • cd
  • nvim src/main.rs (Neovim 0.9.4)
  • dx serve
  • try changing some static string in the rsx block
  • see error or sudden rebuild

Expected behavior

No errors or rebuilds.

Environment:

  • Dioxus version: 0.5.4, main
  • Rust version: 1.79.0-nightly
  • OS info: Pop!_OS
  • App platform: desktop

Questionnaire

  • I'm interested in fixing this myself but don't know where to start
  • I would like to fix and I have a solution
  • I don't have time to fix this right now, but maybe later
@ealmloff ealmloff added the cli Related to the dioxus-cli program label Apr 16, 2024
@JustSimplyKyle
Copy link

This is also present in helix, do you know any workarounds for that?

@Andrew15-5
Copy link
Contributor Author

I don't.

@FelipeFTN
Copy link

FelipeFTN commented May 1, 2024

I'm having the same issue here.
Environment:
Dioxus version: 0.5.4, main
Rustc version: 1.80.0-nightly
OS info: Manjaro-i3
App platform: web
Neovim version: v0.9.5

The workaround from typst/typst#2633 seems to work fine on my neovim lua files:

-- Rust dioxus workaround
vim.opt_local.backupcopy = "yes"

But I'm still getting the error message when trying to set up the tailwind:
image

@Andrew15-5
Copy link
Contributor Author

This is most likely an unrelated error. Try changing public to assets (depending on the value of the asset_dir in the Dioxus.toml) or removing the line completely (and using the path directly in the link element, see default template with dx new for example).

@Andrew15-5
Copy link
Contributor Author

I can no longer reproduce it. At least with new template and 79e18c2. The latest commit is broken as it panics on asset optimization step and has a fancy UI that is definitely isn't complete. I had backupcopy=auto. Maybe I should use April 16th commit.

@jkelleyrtp
Copy link
Member

If you're using nix we have a bug report on manganis where we're looking for the wrong "sh" and optimization fails - looks like there's a simple fix.

@Andrew15-5
Copy link
Contributor Author

using nix how?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli Related to the dioxus-cli program
Projects
None yet
Development

No branches or pull requests

5 participants