danymat / neogen

A better annotation generator. Supports multiple languages and annotation conventions.
GNU General Public License v3.0
1.31k stars 56 forks source link

Annotate all nodes in a file or ones from visual selection #187

Open asmodeus812 opened 1 month ago

asmodeus812 commented 1 month ago

It would be great if we were to have an option in generate to scan over the entire file and all supported for annotation nodes, and annotate them at once. Another extension of this feature could be to allow for visually selecting multiple nodes and annotating them and their child nodes - e.g if one visually selects a class then the class and it's methods should be annotated.

danymat commented 1 month ago

Hello! Neat idea. A first example of this very same idea was created for the tests case, in order to generate all annotations at once. The idea is to take the last one in the file, generate it, and iterate by going up. See https://github.com/danymat/neogen/blob/main/tests/utils/textmate.lua

However, the most difficult here would be to know "where" to generate in the file. In the tests, it knows because we put |cursor| in the code