simrat39 / rust-tools.nvim

Tools for better development in rust using neovim's builtin lsp
MIT License
2.17k stars 160 forks source link

file locking causing problems using trunk #383

Open akshatdevp opened 1 year ago

akshatdevp commented 1 year ago

When using trunk serve with neovim and rust tools, trunk is unable to access the dist folder for hot reloads. The error is that dist cannot be cleaned because access is denied. This doesn't happen when using just rust-analyzer. OS : Windows 10

Steps to reproduce

rustup target add wasm32-unknown-unknown
cargo install --locked trunk

cargo.toml

[dependencies]
yew = { version = "0.20.0", features = ["csr"] }

src/main.rs

use yew::prelude::*;

#[function_component]
fn App() -> Html {
    let counter = use_state(|| 0);
    let onclick = {
        let counter = counter.clone();
        move |_| {
            let value = *counter + 1;
            counter.set(value);
        }
    };

    html! {
        <div>
            <button {onclick}>{ "+1" }</button>
            <p>{ *counter }</p>
        </div>
    }
}

fn main() {
    yew::Renderer::<App>::new().render();
}

index.html

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <title>Yew App</title>
    </head>
</html>

trunk serve --open

The first run works, but if you make some changes it tries to modify the dist folder and fails.