jpmonettas / clindex

A Clojure[Script] source code indexer
Eclipse Public License 1.0
116 stars 6 forks source link

include edn files in scan #7

Open slifin opened 4 years ago

slifin commented 4 years ago

What would be involved in including edn files during the scan? I'm interested in scanning configuration files but I also want my scan to pick up changes the same way that clindex gets notifications from hawk/watch! so I'd rather try and extend clindex rather than implement something outside it

jpmonettas commented 4 years ago

Hey that shouldn't be hard. I thought about indexing other(non source) files you might be interested in but never added that functionality.

Let me think a little about the api and I'll try it on a branch.

jpmonettas commented 4 years ago

@slifin take a look and try the generic-file-indexing branch.

Added a section in the readme on how to use the new functionality. https://github.com/jpmonettas/clindex/blob/generic-file-indexing/README.md#using-clindex-for-indexing-othe-project-files-experimental

I'll experiment and test the api and implementation some more before merging it into master.

Let me know if it work for your use case since I currently don't have a real one.

You just provide a predicate :index-file? to say you are interested in indexing that file and then provide :file-facts which will be called for every file that matches the predicate so you can provide the datoms for that file. When the file changes clindex will automatically retract all the facts for that file and call your :file-facts function again.

Be aware that it works for the entire project tree not only your base folder.

slifin commented 4 years ago

ah nice thank you, I've only just seen this, will try it out @jpmonettas