cbochs / grapple.nvim

Neovim plugin for tagging important files
MIT License
501 stars 19 forks source link

Hierarchical scopes #140

Open FCO opened 4 months ago

FCO commented 4 months ago

It would be interesting if it could be defined a hierarchical order for the scopes, that way, if I make git > git_banch, when I'm on git_branch scope, I could use git_branch's AND git's tags. That way, it there are files very "popular" on a git repo, I could leave them on git scope and still jump to them when on git_branch scope.

cbochs commented 4 months ago

This could be an interesting option to make available. I would love to flush the idea out a bit more.

I'm thinking that scopes might not necessarily need to be hierarchical, but maybe layered? For example, you could define a layered (combined?) scope like so (mock implementation):

require("grapple").define_scope({
    layers = { "git", "git_branch" } -- could be "combined" instead of "layered"?
})

Where the scopes are resolved, in order. The last one being the "top" of the stack.

Another question arises, then. What should be expected behaviour be in the Tags Window when a user adds/deletes/edits a tag? There could be tags from several scopes, where should new tags go?

FCO commented 4 months ago

I think layers would be great! About editing the tags, I think it should show tags from all layers, but if edited, all of them should be saved on the first layer (git on your example) (not removing if from the original one).