Skip to content

Commit a7936db

Browse files
committed
Parse comment if exist
1 parent 94dbb45 commit a7936db

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

test-crawler/collector/collector.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ type FunctionAnnotation struct {
3333
Name string `yaml:"name"`
3434
InputParams string `yaml:"inputParams"`
3535
ReturnValues string `yaml:"returnValues"`
36-
Description string
36+
Description string `yaml:"description"`
3737
Public bool
3838
}
3939

test-crawler/extractor/extractor.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,6 @@ func getFunctionNodes(content string, treeCursor *sitter.TreeCursor, parser *a.P
212212
if child != nil {
213213
if child.Type() == string(FUNCTION_DECLARATION) {
214214
if prevNode.Type() == string(COMMENT) {
215-
216215
value, annotationType, _ := parser.Parse(content[prevNode.StartByte():prevNode.EndByte()])
217216
if value != nil && annotationType == a.Ignore {
218217
isIgnored = value.(bool)
@@ -261,6 +260,13 @@ func getFunctionNodes(content string, treeCursor *sitter.TreeCursor, parser *a.P
261260
child.Child(4): parameter_list: (<-chan *types2.RequestEvent, error)
262261
*/
263262
if child.Type() == string(METHOD_DECLARATION) {
263+
if prevNode.Type() == string(COMMENT) {
264+
value, annotationType, _ := parser.Parse(content[prevNode.StartByte():prevNode.EndByte()])
265+
if value != nil && annotationType == a.Ignore {
266+
isIgnored = value.(bool)
267+
}
268+
}
269+
264270
funcName = content[child.Child(2).StartByte():child.Child(2).EndByte()]
265271
params := ""
266272
returnValues := ""

0 commit comments

Comments
 (0)