Skip to content

Handle cloned buffers and give error message when not visiting a file #75

Closed
@michaeldickens

Description

@michaeldickens

Currently, if I run prettier-js inside a cloned buffer (created by clone-indirect-buffer), prettier-js will fail with an unhelpful error message. Looks like the issue is that it determines where to run the prettier executable by calling buffer-file-name, but buffer-file-name is nil inside cloned buffers. It would be better to either find the base file by calling (buffer-file-name (buffer-base-buffer)) or at least print a more readable error message.

Relatedly, running prettier-js inside a buffer that's not visiting a file gives an unfriendly error message. prettier-js could check whether the buffer has a file and if not, raise a descriptive error message.

I wrote a PR to try to fix this issue: #76

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