Skip to content

Flycheck is triggered multiple times on a single file save #20436

@ShoyuVanilla

Description

@ShoyuVanilla

While debugging my fumbles on flychecks I've found that flycheck is triggered two times on a single save, in a simple - with just a root package, like what generated by cargo new - cargo workspace.

More preciesly,

/// Schedule a re-start of the cargo check worker to do a workspace wide check.
pub(crate) fn restart_workspace(&self, saved_file: Option<AbsPathBuf>) {
let generation = self.generation.fetch_add(1, Ordering::Relaxed) + 1;
self.sender
.send(StateChange::Restart { generation, package: None, saved_file, target: None })
.unwrap();
}
/// Schedule a re-start of the cargo check worker to do a package wide check.
pub(crate) fn restart_for_package(&self, package: String, target: Option<Target>) {
let generation = self.generation.fetch_add(1, Ordering::Relaxed) + 1;
self.sender
.send(StateChange::Restart {
generation,
package: Some(package),
saved_file: None,
target,
})
.unwrap();
}

each of these two functions is called once.

Multiple triggering won't cause malfunctioning by itself as the previous one will be canceled by the later one, but ideally it should triggered only once.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-flycheckissues with flycheck a.k.a. "check on save"C-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions