eapache / starscope

Smart code search for Ruby, Go, and JavaScript
https://rubygems.org/gems/starscope
MIT License
266 stars 18 forks source link

add sample .starscope.json for reference #179

Closed twnaing closed 2 years ago

twnaing commented 4 years ago

Can you please add a sample (annotated if possible) .starscope.json for reference?

Currently, there is only one mention of .starscope.json about excluding files and I want to know the followings

I assume I need to and if I am correct, the document should explicitly say so.

eapache commented 4 years ago

Good questions, I'll try and write up something better at some point. In the meantime:

is it possible to source .ctags file it is present in the directory? (the reason is ctags supports ruby and there are quite some tools available for ctags e.g. gem-ctags, but cscope support for ruby is poor)

Are you asking if starscope can extract information from existing tag files? It cannot, but it can generate all the same information itself. Or have I misunderstood?

what are the patterns we can use to exclude files and folders?

Anything supported by Ruby's File.fnmatch? method: https://ruby-doc.org/core-2.5.0/File.html#method-c-fnmatch

command line --exclude is the same as json file "excludes"?

Yes.

how can I view the currently excluded file/folders?

starscope --no-update --dump _excludes will show the current list of patterns excluded from the local db. This list gets combined with the patterns in .starscope.json.

If you're looking for the actual files/folders, I don't think there's a way to get that list? It's calculated from the exclude patterns and isn't stored or output anywhere.

do I need to run starscope before I export the cscope format?

Yes? Again I'm not sure what you're asking. You can't export to cscope without running the program, since the program is what does the export...

twnaing commented 4 years ago

Are you asking if starscope can extract information from existing tag files? It cannot, but it can generate all the same information itself. Or have I misunderstood?

ctags read command-line options from .ctags file (like starscope use .starscope.json) man ctags's FILES section tells more. Previously I used ctags and migrated to starscop. I had to migrate my .ctags to .starscope.json. If starscope could understand the .ctags file, the transition would be seamless.

Yes? Again I'm not sure what you're asking. You can't export to cscope without running the program, since the program is what does the export...

I just wanted to confirm that because (this part of) USER GUIDE does not mention the need to run starscope before export. And I thought export command run the starscope (db generation code) before exporting.

Just place the line starscope --quiet -e cscope & into the hooks documented by Tim.

eapache commented 4 years ago

ctags read command-line options from .ctags file (like starscope use .starscope.json) man ctags's FILES section tells more. Previously I used ctags and migrated to starscop. I had to migrate my .ctags to .starscope.json. If starscope could understand the .ctags file, the transition would be seamless.

Ah, I understand now. I don't have time to add that feature myself right now, but I'd be happy to take a pull request.

I just wanted to confirm that because (this part of) USER GUIDE does not mention the need to run starscope before export. And I thought export command run the starscope (db generation code) before exporting.

Yes, if you just run e.g. starscope -e cscope that will generate the database and do the export - you don't need to generate the database separately first.

twnaing commented 4 years ago

I don't have time to add that feature myself right now, but I'd be happy to take a pull request.

What will be your preferred workflow? I am considering, "if .ctags file found, read it and merge with .starscope.json and .starscope take precedence."

eapache commented 4 years ago

That would make sense to me.

eapache commented 2 years ago

The documentation on what currently exists has been improved. I have no plans to work on importing .ctags files (or adding more features to .starscope.json) so I'm going to close this, but I'm still happy to take pull requests for those features.