@@ -16,6 +16,8 @@ function descLineToDocLine(content: string[], attrline: number, line: number): n
1616 if ( ! content [ i ] . startsWith ( "///" ) ) {
1717 result = i ;
1818 break ;
19+ } else if ( i == 0 ) {
20+ result = - 1 ;
1921 }
2022 }
2123 return result + attrline ;
@@ -78,16 +80,33 @@ function searchMatchToLine(
7880 line = memend + Number ( match . line ) ;
7981 }
8082 } 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 ) ) {
8988 // 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+ }
91110 }
92111 }
93112 }
@@ -123,15 +142,31 @@ function searchMatchToLine(
123142 } else {
124143 // This is in the class definition
125144 const classMatchPattern = new RegExp ( `^Class ${ fileName . slice ( 0 , fileName . lastIndexOf ( "." ) ) } ` ) ;
145+ let keywordSearch = false ;
126146 for ( let i = 0 ; i < content . length ; i ++ ) {
127147 if ( content [ i ] . match ( classMatchPattern ) ) {
128- if ( match . attrline ) {
148+ if ( match . attr == "Description" ) {
129149 // This is in the class description
130150 line = descLineToDocLine ( content , match . attrline , i ) ;
151+ break ;
131152 } 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+ }
133169 }
134- break ;
135170 }
136171 }
137172 }
0 commit comments