Giter VIP home page Giter VIP logo

Comments (5)

lambdalisue avatar lambdalisue commented on June 6, 2024

Yes. I made fila.vim to provide such generic tree viewer. For example, I would like to make a git repository viewer for a particular commit.

So what is your suggestion here? Do you want me to follow the TreeDataProvider API you've linked? Or do you mean that the current API is too difficult (have't documented yet).

from fern.vim.

prabirshrestha avatar prabirshrestha commented on June 6, 2024

I briefly looked into the code, haven't dug into it much but I saw references to process and files and posted this comment. I haven't played with the api so I cannot comment on if it is difficult.

My thought was if it would be possible to make it generic without any of those logic and support async by default (with callbacks and methods to modify the state for treeview). That way the core becomes very small and it only cares about rendering. It is the other plugins that can then hook into it. Also makes the maintenance very easy.

For example I could create a tree view for remote git repos, code hierarchy (namespace>class>functions), date tree view and so on.

Provide hooks such as on_expand, on_collapse, on_selection_change, set_busy and anyone can reuse it easily. For example in quickpick I provide those api and I don't care how sources fetch the data. It is just a UI component plugin. If they implement async they can call quickpick#set_busy(id, 1) to show spinner and internally they can either use neovim rpc or jobs or even pure sync vimscript. Quickpick doesn't care how others use it. Some of my thoughts are available in prabirshrestha/quickpick.vim#1 on what apis to add for quickpick which could be similar to treeview.

The reason I used vscode's api is because it works very well and is well thought. Though there are some extra things we need to add to make it better in vim. Since vim doesn't have Promise, I settled on generic callback and this allows pickers to implement whatever async libs they want. I'm creating one complicated picker and hence was looking for CancellationTokens and Rx in other threads.

from fern.vim.

lambdalisue avatar lambdalisue commented on June 6, 2024

I briefly looked into the code, haven't dug into it much but I saw references to process and files and posted this comment. I haven't played with the api so I cannot comment on if it is difficult.

My thought was if it would be possible to make it generic without any of those logic and support async by default (with callbacks and methods to modify the state for treeview). That way the core becomes very small and it only cares about rendering. It is the other plugins that can then hook into it. Also makes the maintenance very easy.

Actually, that what I'm trying here.
Yes, fila.vim has codes for specific operations (file operations) but these codes exists only under autoload/fila/scheme directory and these codes are easily removed from this repository.

Provide hooks such as on_expand, on_collapse, on_selection_change, set_busy and anyone can reuse it easily. For example in quickpick I provide those api and I don't care how sources fetch the data. It is just a UI component plugin. If they implement async they can call quickpick#set_busy(id, 1) to show spinner and internally they can either use neovim rpc or jobs or even pure sync vimscript. Quickpick doesn't care how others use it. Some of my thoughts are available in prabirshrestha/quickpick.vim#1 on what apis to add for quickpick which could be similar to treeview.

The reason I used vscode's api is because it works very well and is well thought. Though there are some extra things we need to add to make it better in vim. Since vim doesn't have Promise, I settled on generic callback and this allows pickers to implement whatever async libs they want. I'm creating one complicated picker and hence was looking for CancellationTokens and Rx in other threads.

Currently, fila.vim rely on Async.Promise so I'm not sure about what kind of hooks are useful yet.
I may add some hooks in additions to Promise mech.

I haven't settled the API yet but the ideally plugin authors requires to follow the rules below to show tree via fila.vim (to create an external plugin of fila.vim)

  • A node instance MUST provides an unique key in a tree (List)
  • A node instance may have children method which MUST returns Async.Promise<List<Node>> instance
  • A SCHEME must provide a root node instance for a URL
    • A root node instance MUST have children method

from fern.vim.

lambdalisue avatar lambdalisue commented on June 6, 2024

Applied. Documentation is not yet available thought.

from fern.vim.

lambdalisue avatar lambdalisue commented on June 6, 2024

https://github.com/lambdalisue/fern-bookmark.vim may help

from fern.vim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.