Skip to content

Watcher reporting (in)correct file names when saving in IntelliJ & co. #484

@vlascik

Description

@vlascik

So, IntelliJ / WebStorm / PHPStorm family of IDEs have an option in Settings -> Appearance & Behavior -> System Settings -> Back up files before saving. What it does is to save the edited file as <filename.ext>~, filename with a tilde appended to the end before saving to the original.

Sound innocuous enough, but this creates a problem with broccoli / ember-cli on rebuilds - broccoli watcher notices this change first, reports the changed file as e.g. broccoli:watcherAdapter change P:\Project\app/components\test1\template.hbs~ to the system, and "swallows" the consecutive change to the original file.

This is an issue for ember-cli addons that match the file extensions to decide if they should act on the file, e.g. https://github.com/lifeart/ember-ast-hot-load, probably also https://github.com/typed-ember/ember-cli-typescript, maybe also others.

E.g. https://github.com/lifeart/ember-ast-hot-load/blob/e006fad067e7bf818db0b498b4a3fd6ae7f337e6/lib/hot-reloader.js#L6 matches for js/ts/hbs extensions, but gets js~/ts~/hbs~ instead, and fails.

Now, this is definitely an edge case, but given how easy to miss it is and how used IntelliJ IDEs are (#⁠1 or #⁠2 spot along VS Code), maybe it deserves some attention - either as a fix/special case in watcher adapter, or at least a mention of a workaround (disabling the IntelliJ back up setting) in documentation?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions