Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature] universal fern #402

Open
ydzhou opened this issue Mar 15, 2022 · 10 comments
Open

[feature] universal fern #402

ydzhou opened this issue Mar 15, 2022 · 10 comments
Labels
enhancement New feature or request help wanted Extra attention is needed maybe oneday Things maybe implemented oneday

Comments

@ydzhou
Copy link
Contributor

ydzhou commented Mar 15, 2022

I would like to see an universal fern similar to what is in this PR

We will have essentially one fern across all the buffers for this vim instance.

@lambdalisue lambdalisue added enhancement New feature or request help wanted Extra attention is needed maybe oneday Things maybe implemented oneday labels Mar 16, 2022
@ydzhou
Copy link
Contributor Author

ydzhou commented Mar 16, 2022

Hi I thought that PR is enough to bring back the universal fern. What is missing here?

I am willing to help on the coding side if any gap need filled.

@lambdalisue
Copy link
Owner

At that time, there is no right side drawer. That's why the PR probably does not support it.

@ydzhou
Copy link
Contributor Author

ydzhou commented Mar 19, 2022

Hi Alisue, can you take a look at the PR?

The main idea is to preserve a global copy of fern instance and always retrieve it for all the buffers. But I am not sure how vimscript handle the assignment of buffer local variable. If it is a deep copy, then maybe I need to find another way to avoid unnecessary memory wasting.

@ydzhou
Copy link
Contributor Author

ydzhou commented Mar 19, 2022

Looks like we are allowing both left and right drawer displayed in the same window. I am not understanding the purpose of that. But following this design choice, I create a new PR to treat the left and right drawer as two separate things. We will have one universal drawer on the left and another one on the right.

Personally I think the -right feature is confusing. My proposal is to keep only one fern drawer in one window.
For example, if I run Fern . -drawer, it creates a drawer at the left side. Then I run Fern . -drawer -right, it close the existing left drawer and redraw it on the right side.

What do you think about it?

@lambdalisue
Copy link
Owner

Looks like we are allowing both left and right drawer displayed in the same window. I am not understanding the purpose of that. But following this design choice, I create a new PR to treat the left and right drawer as two separate things. We will have one universal drawer on the left and another one on the right.

Because fern is not just a file explorer but a general purpose tree viewer. User may want to see JSON structure or vim-iced-fern-debugger or whatever on the right side, addition to the file explorer on the left side.

Personally I think the -right feature is confusing. My proposal is to keep only one fern drawer in one window.
For example, if I run Fern . -drawer, it creates a drawer at the left side. Then I run Fern . -drawer -right, it close the existing left drawer and redraw it on the right side.

If the behavior is an opt-in feature, I think it's fair enough. However, that's a bit out of the topic so the PR should be separated if you'll do it.

@ydzhou
Copy link
Contributor Author

ydzhou commented Mar 20, 2022

Looks like we are allowing both left and right drawer displayed in the same window. I am not understanding the purpose of that. But following this design choice, I create a new PR to treat the left and right drawer as two separate things. We will have one universal drawer on the left and another one on the right.

Because fern is not just a file explorer but a general purpose tree viewer. User may want to see JSON structure or vim-iced-fern-debugger or whatever on the right side, addition to the file explorer on the left side.

Wow, great to hear that Fern can do so many things!

Still I think, drawer concept is a little confusing to me. The reason why I discuss drawer here is because that I feel like current code has many hardcode parts to handle left and right drawer separately, yet I do not see much uniqueness of those two types of drawers. I am wondering if we can make code more generic.

My understanding is that the difference between a drawer and a Fern tree is that a drawer is unique per tab, thus it can be toggled and its content can be perserved. Is that correct? Should we just introduce a type of Fern tree called persistent tree or whatever name you prefer and make it generic? So left or right is just one of the properties (position) of this persistent tree and also universal for all tabs can be another property.

For the new tree, it can be

FRI: fern://drawer:{uuid}/{path};width=30&pos=left&universal=1&tabpage=1

@lambdalisue
Copy link
Owner

I'm sorry but I couldn't find the benefit of your suggestion. "Making two options generic" is not enough for me to apply massive changes to the current code.

@ydzhou
Copy link
Contributor Author

ydzhou commented Mar 21, 2022

Yeah not much actual customer benefits, it is more of a refactoring so that we can support more cases easier. But I understand the return on investment for this work is very uncertain and we do not need to proceed unless you are seeing a clear benefit.

@ydzhou
Copy link
Contributor Author

ydzhou commented Mar 15, 2023

Hi Alisue

I am thinking to introduce a feature, it looks like this. When you open a drawer, it will stay opened in other tabs. When you close a draw, it will stay closed in other tabs.

For example,
I toggle the fern in this tab, then when I switch to other tabs, fern is already opened.
If I toggle the fern to close, then when I switch to other tabs, there will be no fern drawer.

This feature makes fern behave similar to sidebar for file tree in some IDEs.

How do you like it?

@lambdalisue
Copy link
Owner

It's interesting but a bit different from the feature described in this issue I think. Please create a new feature request for clarify the feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed maybe oneday Things maybe implemented oneday
Projects
None yet
Development

No branches or pull requests

2 participants