-
Notifications
You must be signed in to change notification settings - Fork 65
Added filewatch and cache functionality, notes can be searched by aliases #142
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
base: main
Are you sure you want to change the base?
Conversation
really nice feature! would need to look into the code more in the next few days, meanwhile you can fix the style issue with |
@neo451 Maybe I need to add additional configurations to |
No idea why is that, but you can look at the action result, stylua wants to add a ps: My local stylua does inform me of this error. |
Quite interesting. I was actually just playing with porting a sqlite full text search that I used and adapting it for obsidian. While doing that I thought it might be cool to use sqlite as a cache. This goes into a similar direction. @kostabekre it would be interesting to see how much faster this is compared to the base case which just uses |
Right now this implementation only works for |
@sotte I was thinking of using SQLite myself, and I have founded this repository. But after some time and searching the implementations of other people, I decided that adding a new dependency won't be a good idea.
Well, I don't think SQLite is bad or anything, it might be the ideal solution for our needs but I decided take a more simple route both for users and for developers - using JSON.
Could you describe how that works? |
Yes, for now I made the implementation only for telescope (and not a very good one, it needs some polishing) because I haven't used other pickers. |
Okay, I can do that. |
@kostabekre sorry for the long process, I finally addressed some pain points in the codebase #251 also see #237 The thing that kept me from merging this is, you make cache a class, the only valuable info it stores is the client, and then you add it as a field in the client, it is not bad but just did not sit well with me. And you are only using client to access state, like So now:
|
@neo451 We are not in hurry, so I think we shouldn't be worry that it takes long! It's much better to take slow but controlled steps. I will make the changes in the following days. |
thank you for your continued work, I kept being sorry because I am the kind of person whose passion dies down super quickly if I don't get positive feedback lol. Yes lua is quite a different experience from like for example python which is what the og author have a background in, and why there's an abc class. But lua tables are 90% of the time expressive enough and class is no need. Also plugin development is quite a different mindset. I guess the rule of thumb is not to use a class if you don't store much state and only use one instance of the class in an neovim session. I think I need to write some of these in the CONTRIBUTING.md. |
@neo451 Hi!
Well, I can't really activate cache without exposing a method like And I can't use The following comment is just my thoughts about the style of the project. |
yes yeah I know global variables have bad rep, but just think of it as some cache for the config values, it should not contain too much logic like you said. |
@neo451 For now I didn't create an event handler when workspace is updated. |
yes I was mistaken, I meant |
@kostabekre I did not catch this part last time
|
@neo451 sorry, I meant that I didn't implement the event when the workspace was changed. I didn't have time to finish.
Maybe it's not necessary, but I thought it could be more flexible that way. |
Since there's like the concept of stuff like dynamic workspaces (which I don't understand now as well), I think we can follow the current approach as it is. |
Okay! Now, there are two things that are not implemented:
I will read how to do that and implement the solutions on the weekends. |
… the lock file exists.
@neo451 hi! Is there anything that I need to do? |
The lock file is created in the root of the workspace, maybe I need to move it to other place? |
sorry I don't have time to properly review this recently, but I had the idea the other day that we should maybe put cache in Also, I am working on #339 for limiting jobs (will merge soon), and we don't want to rely on plenary no more on the main, so also look into that. |
Why don't you use |
it's not just use I'm not advanced user of |
In order to implement search by alises, a more faster solution is needed than grep search.
In order to solve this, the cache of the vault is created on the startup as a JSON file and updated every time a note is changed.
The cache is used in search of the notes and their aliases.
For the current moment only telescope search is available.
Solves this issue.