How to handle state of an external neotree source #1307
-
| Hi, I finally started working on a new source for neotree. Whenever I move focus to another window my neotree source gets reloaded due to  Any idea what could that be? I will share my full source code soon, I just want to clean it up a bit before. | 
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
| The trick is to create a table on your state called  | 
Beta Was this translation helpful? Give feedback.
-
| Feel free to borrow/beg/steal code from netman.nvim I went down this road already. You unfortunately need to serialize the entire tree and keep track of it yourself | 
Beta Was this translation helpful? Give feedback.
-
| Thanks for the suggestions.  | 
Beta Was this translation helpful? Give feedback.
I was actually able to do it without using
default_expanded_nodes. Maybe we have not understood each other. I admit, my problem description was quite shallow, but the same applied to my understanding of the problem at that time.Now I know a little bit better. There are different cases and each one has to be handled differently.
The case that I described, switching windows is the easiest. If we already have the tree and the window is visible then there is nothing to be done. My problem was that I was trying to do in this case.
Then I ran into another case which is when you are switching between different sources in neotree (e.g. by calling
:Neotree buffers,:Neotree my_source). I tried ca…