Comments (5)
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.
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.
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 returnsAsync.Promise<List<Node>>
instance - A SCHEME must provide a root node instance for a URL
- A root node instance MUST have
children
method
- A root node instance MUST have
from fern.vim.
Applied. Documentation is not yet available thought.
from fern.vim.
https://github.com/lambdalisue/fern-bookmark.vim may help
from fern.vim.
Related Issues (20)
- [Feature request] New 'FernLeadingText' highlight group HOT 6
- Some fern.vim keybindings don't work. HOT 2
- Is there a way to automatically redraw fern when a buffer is written? HOT 4
- When opening a file, auto-hide or auto-defocus fern HOT 4
- [Feature] Support switching tabpages on `FernDo` HOT 3
- [Feature] Add the ability to retain the open/closed status of the fern drawer between tabpages HOT 3
- Add mouse support HOT 4
- Fern reveal triggers vim to hang with 100% cpu usage HOT 3
- Remove signcolumn in fern HOT 2
- nvim: "Window was closed immediately" when opening floating window while opening fern in split window HOT 7
- Option to reset drawer width when toggled HOT 2
- Reveal doesn't work with slach (`/`) separated path on Windows HOT 12
- Is it possible to search files by their names? HOT 2
- feat: configure what files/directories are considered 'hidden' HOT 2
- [bug] node expansion inconsistent behaviour
- Remote authentication required but no callback set HOT 3
- vim like mapping for zz? HOT 9
- Default branch warning HOT 1
- How to open multiple files HOT 2
- bug(vital): infinite autocmd loop on `FernDo FernReveal` HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fern.vim.