Skip to content

Make diff views extend FileView #888

@shumadrid

Description

@shumadrid

There is a way to work around this limitation for DiffViews:

This class is not extending FileView, because it needs a TFile, which is not possible for dot files like .gitignore, which this editor should support as well.`

by using the getFile utility function from the obsidian-dev-utils package, which creates a TFile from any vault path you provide (hidden files included).

Would there be benefits/drawbacks to refactoring the DiffViews to extend FileView?

I know it would help with my plugin integration, so i can easily sync my views with with the current diff view state. But i could also probably make it work without this, with some gimmicks.

Regarding the obsidian-dev-utils package, the dev knows the Obsidian API very well, so it has a lot of other useful utilities that may be of use, like a dev script that automatically transfers your build output to the obsidian plugins folder, so you don't have to manually transfer files or develop from within that subfolder. (Also allows passing custom esbuild instructions)

But of course for this, the refactoring cost could outweigh the benefits.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions