starscope icon indicating copy to clipboard operation
starscope copied to clipboard

Consider adding cscope output append feature

Open zhaozhongn opened this issue 5 years ago • 4 comments

Starscope is great in handling the languages it supports. When working with large mixed-language repository, however, it is desirable to generate a single cscope.out file that cscope -d mode can navigate among source files of all languages (e.g., C and Go). Other tools expecting a single cscope.out file would also be able to work on the entire code base.

Although cscope and starscope can separately index C and Go files, there currently lacks a way to merge their indexing result into a single cscope.out files. While this can be done in a new tool specifically created for this, it would be great if starscope can optionally read in a cscope.out file and simply append its indexing result to it, making starscope a perfect companion to cscope.

zhaozhongn avatar Apr 08 '19 06:04 zhaozhongn

That's a great idea. Unfortunately, the cscope file format is not really "appendable", it has a header at the top which becomes invalid if you add more data, and is difficult to just recalculate.

eapache avatar Apr 08 '19 13:04 eapache

By "append" I meant semantically, i.e., starscope, upon exporting to cscope, will optionally read in an existing cscope.out file, append its own indexing data to the existing data in memory, and write out a new cscope.out file containing the entire indexing data.

I assume it should be straight-forward for starscope to read in existing cscope.out files as it already knows how to write out to one.

zhaozhongn avatar Apr 08 '19 16:04 zhaozhongn

Unfortunately not a true assumption, the support for writing a cscope file is pretty hacky and doesn't naturally invert to support reading. The first step would probably be extracting support for the file format into a proper library that did support reading and writing.

eapache avatar Apr 08 '19 16:04 eapache

I see. Thanks for the explanation!

zhaozhongn avatar Apr 08 '19 16:04 zhaozhongn