@@ -16,6 +16,8 @@ function descLineToDocLine(content: string[], attrline: number, line: number): n
16
16
if ( ! content [ i ] . startsWith ( "///" ) ) {
17
17
result = i ;
18
18
break ;
19
+ } else if ( i == 0 ) {
20
+ result = - 1 ;
19
21
}
20
22
}
21
23
return result + attrline ;
@@ -78,16 +80,33 @@ function searchMatchToLine(
78
80
line = memend + Number ( match . line ) ;
79
81
}
80
82
} else {
81
- if ( match . attrline === undefined ) {
82
- // This is in the class member definition
83
- line = 1 ;
84
- } else {
85
- if ( match . attr === "Description" ) {
86
- // This is in the description
87
- line = descLineToDocLine ( content , match . attrline , i ) ;
88
- } else {
83
+ if ( match . attr === "Description" ) {
84
+ // This is in the description
85
+ line = descLineToDocLine ( content , match . attrline , i ) ;
86
+ } else if ( match . attrline || [ "Code" , "Data" , "SqlQuery" ] . includes ( match . attr ) ) {
87
+ if ( [ "Code" , "Data" , "SqlQuery" ] . includes ( match . attr ) ) {
89
88
// This is in the implementation
90
- line = memend + match . attrline ;
89
+ line = memend + ( match . attrline ?? 1 ) ;
90
+ } else {
91
+ // This is a keyword with a multiline value
92
+ line = i + ( match . attrline - 1 ?? 0 ) ;
93
+ }
94
+ } else {
95
+ // This is in the class member definition
96
+ // Need to loop due to the possibility of keywords with multiline values
97
+ for ( let j = i ; j < content . length ; j ++ ) {
98
+ if ( content [ j ] . includes ( match . attr ) ) {
99
+ line = j ;
100
+ break ;
101
+ } else if (
102
+ j > i &&
103
+ / ^ ( (?: C l a s s | C l i e n t ) ? M e t h o d | P r o p e r t y | X D a t a | Q u e r y | T r i g g e r | P a r a m e t e r | R e l a t i o n s h i p | I n d e x | F o r e i g n K e y | S t o r a g e | P r o j e c t i o n | \/ \/ \/ ) / . test (
104
+ content [ j ]
105
+ )
106
+ ) {
107
+ // Hit the beginning of the next member
108
+ break ;
109
+ }
91
110
}
92
111
}
93
112
}
@@ -123,15 +142,31 @@ function searchMatchToLine(
123
142
} else {
124
143
// This is in the class definition
125
144
const classMatchPattern = new RegExp ( `^Class ${ fileName . slice ( 0 , fileName . lastIndexOf ( "." ) ) } ` ) ;
145
+ let keywordSearch = false ;
126
146
for ( let i = 0 ; i < content . length ; i ++ ) {
127
147
if ( content [ i ] . match ( classMatchPattern ) ) {
128
- if ( match . attrline ) {
148
+ if ( match . attr == "Description" ) {
129
149
// This is in the class description
130
150
line = descLineToDocLine ( content , match . attrline , i ) ;
151
+ break ;
131
152
} else {
132
- line = i ;
153
+ // This is a class keyword or keyword value
154
+ // Need to keep looping due to the possibility of keywords with multiline values
155
+ keywordSearch = true ;
156
+ }
157
+ if ( keywordSearch ) {
158
+ if ( content [ i ] . includes ( match . attr ) ) {
159
+ line = match . attrline ? i + match . attrline - 1 : i ;
160
+ break ;
161
+ } else if (
162
+ / ^ ( (?: C l a s s | C l i e n t ) ? M e t h o d | P r o p e r t y | X D a t a | Q u e r y | T r i g g e r | P a r a m e t e r | R e l a t i o n s h i p | I n d e x | F o r e i g n K e y | S t o r a g e | P r o j e c t i o n | \/ \/ \/ ) / . test (
163
+ content [ i ]
164
+ )
165
+ ) {
166
+ // Hit the beginning of the next member
167
+ break ;
168
+ }
133
169
}
134
- break ;
135
170
}
136
171
}
137
172
}
0 commit comments