sublimehq / sublime_text

Issue tracker for Sublime Text
https://www.sublimetext.com
811 stars 39 forks source link

Add theme attributes for "tracked" and "committed" files and folders. #3143

Open deathaxe opened 4 years ago

deathaxe commented 4 years ago

Problem description

A theme might want to mark git tracked folders (and files) in the sidebar with a dedicated label color or icon to distinguish from normal untracked folders.

The currently available states "added", "deleted", "modified", "ignored", "untracked", "missing", and "unmerged" are sufficient for files contained by a tracked folder. A file within a tracked folder with none of those attributes can be considdered "committed". A file within an untracked folder however isn't marked "untracked" and thus looks committed.

Folder containing committed files only ("clean worktree") can't be distinguished from a normal untracked folder as well. A folder is marked "untracked" only if it contains at least one untracked file.

Therefore some attribute values for the file_system_entry would be nice to have in order to explicitly mark tracked files & folders.

Preferred solution

  1. The root of a repositorie's worktree might have a "worktree" attribute to be able to assign a unique folder icon to it with a git overlay icon or something like that. Just to see what folders in the sidebar are repositories and which not.

    {
     "class": "icon_folder",
     "parents": [
       {"class": "file_system_entry", "attributes": ["worktree"]},
     ],
     "layer2.texture": "Theme - DAneo/icons/icon_overlay_worktree.png",
    },
  2. Each tracked file & folder (worktree root or sub directory) might have a "committed" state, if it isn't marked added/deleted/modified/missing/unmerged. A tracked folder might be marked "committed" alongside with untracked/ignored.

    This would enable a theme to explicitly address clean folders and committed files to add a green check mark for instance.

    {
     "class": "icon_folder",
     "parents": [
       {"class": "file_system_entry", "attributes": ["committed"]},
     ],
     "layer2.texture": "Theme - DAneo/icons/icon_overlay_committed.png",
    },
  3. A "tracked" state could propably be used to easily address all tracked files and folders no matter which state they have.

    {
     "class": "icon_folder",
     "parents": [
       {"class": "file_system_entry", "attributes": ["tracked"]},
     ],
     "layer2.texture": "Theme - DAneo/icons/icon_overlay_tracked.png",
    },

    Note: Tracked folders containing untracked files would have the tracked and untracked attribute then, which might be a bit confusing.

    {
     "class": "icon_folder",
     "parents": [
       {"class": "file_system_entry", "attributes": ["tracked", "untracked"]},
     ],
     "layer2.texture": "Theme - DAneo/icons/icon_overlay_contains_untracked.png",
    },

    Note: Not sure how to handle sub directories of a worktree, which contain only untracked files and folders. Should they be marked !tracked or just the same as before?

    {
     "class": "icon_folder",
     "parents": [
       {"class": "file_system_entry", "attributes": ["!tracked"]},
     ],
     "layer2.texture": "Theme - DAneo/icons/icon_overlay_contains_only_untracked.png",
    },
  4. A mechanism to distinguish between folders containing some untracked/ignored files and those which contain only untracked/ignored files/folders would be nice to have. Theme - DAneo uses the "untracked" attribute to highlight collapsed folder labels, which looks like the whole folder is ignored/untracked even though some of the contained files are only.

Alternatives

A git repository could propably also be addressed by a special icon type

   {
     "class": "icon_folder folder_worktree",
     "layer2.texture": "Theme - DAneo/icons/icon_overlay_worktree.png",
   },

Additional Information (optional)

Maybe not the most beautiful example, but what I have in mind is something like the TortoiseGit Explorer Integration

https://tortoisegit.org/docs/tortoisegit/tgit-dug.html#tgit-dug-general-dia-icons

AmjadHD commented 3 years ago

Any consideration from the devs ?

AmjadHD commented 3 years ago

Also maybe add a way to distinguish sub-modules.